diff --git a/.github/workflows/colab.yml b/.github/workflows/colab.yml index 7946adfd5d0..4ece61ca6a4 100644 --- a/.github/workflows/colab.yml +++ b/.github/workflows/colab.yml @@ -16,7 +16,7 @@ on: jobs: colab: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest env: COLAB_ALWAYS_INSTALL_XVFB: 1 QLEARNING_NUM_TRAINING_STEPS: 5 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index d1422573e81..1a77b133546 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,7 +13,11 @@ jobs: pre-commit: runs-on: ubuntu-24.04 env: - DOTNET_NOLOGO: 1 + DOTNET_NOLOGO: 1 + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1" + DOTNET_CLI_HOME: "${{ github.workspace }}/.dotnet" + NUGET_PACKAGES: "${{ github.workspace }}/.nuget/packages" + TMPDIR: "${{ github.workspace }}/.tmp" steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -25,15 +29,20 @@ jobs: with: ruby-version: '2.7' bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Create writable dirs + run: | + mkdir -p "$DOTNET_CLI_HOME" "$NUGET_PACKAGES" "$TMPDIR" - uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.202' - - name: Clean dotnet shared memory - run: sudo rm -rf /tmp/.dotnet/shm - name: Install manual dependencies run: | python -m pip install pre-commit pre-commit install + - name: Pre-warm dotnet + run: | + dotnet --info + dotnet restore || true - name: Run pre-commit run: | pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08a8e33e720..2ab764c1025 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -94,7 +94,8 @@ repos: - id: dotnet-format name: dotnet-format language: system - entry: dotnet format whitespace --folder --include + entry: dotnet format whitespace --folder --include . --verify-no-changes + pass_filenames: false types_or: ["c#"] - id: markdown-link-check name: markdown-link-check diff --git a/.yamato/com.unity.ml-agents-test.yml b/.yamato/com.unity.ml-agents-test.yml index 6a62b4b85c6..dc0aeca8287 100644 --- a/.yamato/com.unity.ml-agents-test.yml +++ b/.yamato/com.unity.ml-agents-test.yml @@ -8,7 +8,7 @@ test_editors: enableNoDefaultPackages: !!bool true trunk_editor: - - version: trunk + - version: 6000.4 testProject: DevProject test_platforms: diff --git a/.yamato/test_versions.metafile b/.yamato/test_versions.metafile index abcec74931c..2d4a1ee5d34 100644 --- a/.yamato/test_versions.metafile +++ b/.yamato/test_versions.metafile @@ -7,5 +7,5 @@ test_editors: extra_test: gym - version: 6000.0 extra_test: sensor - - version: trunk + - version: 6000.3 extra_test: llapi diff --git a/DevProject/Packages/packages-lock.json b/DevProject/Packages/packages-lock.json index 39095c0939b..9ad658c8eb0 100644 --- a/DevProject/Packages/packages-lock.json +++ b/DevProject/Packages/packages-lock.json @@ -1,13 +1,15 @@ { "dependencies": { "com.unity.ai.inference": { - "version": "2.2.1", + "version": "2.4.1", "depth": 1, "source": "registry", "dependencies": { "com.unity.burst": "1.8.17", "com.unity.collections": "2.4.3", - "com.unity.modules.imageconversion": "1.0.0" + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.dt.app-ui": "1.3.1", + "com.unity.nuget.newtonsoft-json": "3.2.1" }, "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" }, @@ -51,6 +53,18 @@ }, "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" }, + "com.unity.dt.app-ui": { + "version": "1.3.1", + "depth": 2, + "source": "registry", + "dependencies": { + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.screencapture": "1.0.0" + }, + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" + }, "com.unity.ext.nunit": { "version": "2.0.5", "depth": 1, @@ -79,7 +93,7 @@ "depth": 0, "source": "local", "dependencies": { - "com.unity.ai.inference": "2.2.1", + "com.unity.ai.inference": "2.4.1", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.physics": "1.0.0" @@ -200,6 +214,12 @@ "source": "builtin", "dependencies": {} }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 3, + "source": "builtin", + "dependencies": {} + }, "com.unity.modules.hierarchycore": { "version": "1.0.0", "depth": 1, @@ -236,6 +256,14 @@ "source": "builtin", "dependencies": {} }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 3, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, "com.unity.modules.ui": { "version": "1.0.0", "depth": 0, diff --git a/PerformanceProject/Packages/packages-lock.json b/PerformanceProject/Packages/packages-lock.json index f3d6f8a3584..58780b41341 100644 --- a/PerformanceProject/Packages/packages-lock.json +++ b/PerformanceProject/Packages/packages-lock.json @@ -1,13 +1,15 @@ { "dependencies": { "com.unity.ai.inference": { - "version": "2.2.1", + "version": "2.4.1", "depth": 1, "source": "registry", "dependencies": { "com.unity.burst": "1.8.17", "com.unity.collections": "2.4.3", - "com.unity.modules.imageconversion": "1.0.0" + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.dt.app-ui": "1.3.1", + "com.unity.nuget.newtonsoft-json": "3.2.1" }, "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" }, @@ -40,6 +42,18 @@ }, "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" }, + "com.unity.dt.app-ui": { + "version": "1.3.1", + "depth": 2, + "source": "registry", + "dependencies": { + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.screencapture": "1.0.0" + }, + "url": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates" + }, "com.unity.editorcoroutines": { "version": "1.0.0", "depth": 1, @@ -106,7 +120,7 @@ "depth": 0, "source": "local", "dependencies": { - "com.unity.ai.inference": "2.2.1", + "com.unity.ai.inference": "2.4.1", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.physics": "1.0.0" diff --git a/Project/Packages/packages-lock.json b/Project/Packages/packages-lock.json index 80e18ad625c..91238b9cd2b 100644 --- a/Project/Packages/packages-lock.json +++ b/Project/Packages/packages-lock.json @@ -8,12 +8,14 @@ "url": "https://packages.unity.com" }, "com.unity.ai.inference": { - "version": "2.2.1", + "version": "2.4.1", "depth": 1, "source": "registry", "dependencies": { "com.unity.burst": "1.8.17", + "com.unity.dt.app-ui": "1.3.1", "com.unity.collections": "2.4.3", + "com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.modules.imageconversion": "1.0.0" }, "url": "https://packages.unity.com" @@ -58,6 +60,18 @@ }, "url": "https://packages.unity.com" }, + "com.unity.dt.app-ui": { + "version": "1.3.1", + "depth": 2, + "source": "registry", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.screencapture": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.ext.nunit": { "version": "2.0.5", "depth": 1, @@ -105,7 +119,7 @@ "depth": 0, "source": "local", "dependencies": { - "com.unity.ai.inference": "2.2.1", + "com.unity.ai.inference": "2.4.1", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.physics": "1.0.0" @@ -218,6 +232,12 @@ "source": "builtin", "dependencies": {} }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 3, + "source": "builtin", + "dependencies": {} + }, "com.unity.modules.animation": { "version": "1.0.0", "depth": 2, @@ -281,6 +301,14 @@ "source": "builtin", "dependencies": {} }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 3, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, "com.unity.modules.ui": { "version": "1.0.0", "depth": 1, diff --git a/colab/Colab_UnityEnvironment_1_Run.ipynb b/colab/Colab_UnityEnvironment_1_Run.ipynb index e70dca7b8a3..6cd7eb91df5 100644 --- a/colab/Colab_UnityEnvironment_1_Run.ipynb +++ b/colab/Colab_UnityEnvironment_1_Run.ipynb @@ -76,50 +76,13 @@ " INSTALL_XVFB = 'COLAB_ALWAYS_INSTALL_XVFB' in os.environ\n", "\n", "if INSTALL_XVFB:\n", - " with open('frame-buffer', 'w') as writefile:\n", - " writefile.write(\"\"\"#taken from https://gist.github.com/jterrace/2911875\n", - "XVFB=/usr/bin/Xvfb\n", - "XVFBARGS=\":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset\"\n", - "PIDFILE=./frame-buffer.pid\n", - "case \"$1\" in\n", - " start)\n", - " echo -n \"Starting virtual X frame buffer: Xvfb\"\n", - " /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS\n", - " echo \".\"\n", - " ;;\n", - " stop)\n", - " echo -n \"Stopping virtual X frame buffer: Xvfb\"\n", - " /sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE\n", - " rm $PIDFILE\n", - " echo \".\"\n", - " ;;\n", - " restart)\n", - " $0 stop\n", - " $0 start\n", - " ;;\n", - " *)\n", - " echo \"Usage: /etc/init.d/xvfb {start|stop|restart}\"\n", - " exit 1\n", - "esac\n", - "exit 0\n", - " \"\"\")\n", - " !sudo apt-get update\n", - " pro_bar.update(progress(10, 100))\n", - " !sudo DEBIAN_FRONTEND=noninteractive apt install -y daemon wget gdebi-core build-essential libfontenc1 libfreetype6 xorg-dev xorg\n", - " pro_bar.update(progress(20, 100))\n", - " !wget http://security.ubuntu.com/ubuntu/pool/main/libx/libxfont/libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb 2>&1\n", - " pro_bar.update(progress(30, 100))\n", - " !wget --output-document xvfb.deb http://security.ubuntu.com/ubuntu/pool/universe/x/xorg-server/xvfb_1.18.4-0ubuntu0.12_amd64.deb 2>&1\n", - " pro_bar.update(progress(40, 100))\n", - " !sudo dpkg -i libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb 2>&1\n", + " !sudo apt-get update -qq\n", " pro_bar.update(progress(50, 100))\n", - " !sudo dpkg -i xvfb.deb 2>&1\n", - " pro_bar.update(progress(70, 100))\n", - " !rm libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb\n", - " pro_bar.update(progress(80, 100))\n", - " !rm xvfb.deb\n", + " !sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq xvfb\n", " pro_bar.update(progress(90, 100))\n", - " !bash frame-buffer start\n", + " import subprocess\n", + " subprocess.Popen(['Xvfb', ':1', '-screen', '0', '1024x768x24', '-ac', '+extension', 'GLX', '+render', '-noreset'], \n", + " stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n", " os.environ[\"DISPLAY\"] = \":1\"\n", "pro_bar.update(progress(100, 100))" ], diff --git a/colab/Colab_UnityEnvironment_2_Train.ipynb b/colab/Colab_UnityEnvironment_2_Train.ipynb index 840d0fb3eb7..24d87b975e2 100644 --- a/colab/Colab_UnityEnvironment_2_Train.ipynb +++ b/colab/Colab_UnityEnvironment_2_Train.ipynb @@ -70,50 +70,13 @@ " INSTALL_XVFB = 'COLAB_ALWAYS_INSTALL_XVFB' in os.environ\n", "\n", "if INSTALL_XVFB:\n", - " with open('frame-buffer', 'w') as writefile:\n", - " writefile.write(\"\"\"#taken from https://gist.github.com/jterrace/2911875\n", - "XVFB=/usr/bin/Xvfb\n", - "XVFBARGS=\":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset\"\n", - "PIDFILE=./frame-buffer.pid\n", - "case \"$1\" in\n", - " start)\n", - " echo -n \"Starting virtual X frame buffer: Xvfb\"\n", - " /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS\n", - " echo \".\"\n", - " ;;\n", - " stop)\n", - " echo -n \"Stopping virtual X frame buffer: Xvfb\"\n", - " /sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE\n", - " rm $PIDFILE\n", - " echo \".\"\n", - " ;;\n", - " restart)\n", - " $0 stop\n", - " $0 start\n", - " ;;\n", - " *)\n", - " echo \"Usage: /etc/init.d/xvfb {start|stop|restart}\"\n", - " exit 1\n", - "esac\n", - "exit 0\n", - " \"\"\")\n", - " !sudo apt-get update\n", - " pro_bar.update(progress(10, 100))\n", - " !sudo DEBIAN_FRONTEND=noninteractive apt install -y daemon wget gdebi-core build-essential libfontenc1 libfreetype6 xorg-dev xorg\n", - " pro_bar.update(progress(20, 100))\n", - " !wget http://security.ubuntu.com/ubuntu/pool/main/libx/libxfont/libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb 2>&1\n", - " pro_bar.update(progress(30, 100))\n", - " !wget --output-document xvfb.deb http://security.ubuntu.com/ubuntu/pool/universe/x/xorg-server/xvfb_1.18.4-0ubuntu0.12_amd64.deb 2>&1\n", - " pro_bar.update(progress(40, 100))\n", - " !sudo dpkg -i libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb 2>&1\n", + " !sudo apt-get update -qq\n", " pro_bar.update(progress(50, 100))\n", - " !sudo dpkg -i xvfb.deb 2>&1\n", - " pro_bar.update(progress(70, 100))\n", - " !rm libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb\n", - " pro_bar.update(progress(80, 100))\n", - " !rm xvfb.deb\n", + " !sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq xvfb\n", " pro_bar.update(progress(90, 100))\n", - " !bash frame-buffer start\n", + " import subprocess\n", + " subprocess.Popen(['Xvfb', ':1', '-screen', '0', '1024x768x24', '-ac', '+extension', 'GLX', '+render', '-noreset'], \n", + " stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n", " os.environ[\"DISPLAY\"] = \":1\"\n", "pro_bar.update(progress(100, 100))" ], diff --git a/colab/Colab_UnityEnvironment_3_SideChannel.ipynb b/colab/Colab_UnityEnvironment_3_SideChannel.ipynb index f74291fb17e..5a9a7d0d148 100644 --- a/colab/Colab_UnityEnvironment_3_SideChannel.ipynb +++ b/colab/Colab_UnityEnvironment_3_SideChannel.ipynb @@ -71,50 +71,13 @@ " INSTALL_XVFB = 'COLAB_ALWAYS_INSTALL_XVFB' in os.environ\n", "\n", "if INSTALL_XVFB:\n", - " with open('frame-buffer', 'w') as writefile:\n", - " writefile.write(\"\"\"#taken from https://gist.github.com/jterrace/2911875\n", - "XVFB=/usr/bin/Xvfb\n", - "XVFBARGS=\":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset\"\n", - "PIDFILE=./frame-buffer.pid\n", - "case \"$1\" in\n", - " start)\n", - " echo -n \"Starting virtual X frame buffer: Xvfb\"\n", - " /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS\n", - " echo \".\"\n", - " ;;\n", - " stop)\n", - " echo -n \"Stopping virtual X frame buffer: Xvfb\"\n", - " /sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE\n", - " rm $PIDFILE\n", - " echo \".\"\n", - " ;;\n", - " restart)\n", - " $0 stop\n", - " $0 start\n", - " ;;\n", - " *)\n", - " echo \"Usage: /etc/init.d/xvfb {start|stop|restart}\"\n", - " exit 1\n", - "esac\n", - "exit 0\n", - " \"\"\")\n", - " !sudo apt-get update\n", - " pro_bar.update(progress(10, 100))\n", - " !sudo DEBIAN_FRONTEND=noninteractive apt install -y daemon wget gdebi-core build-essential libfontenc1 libfreetype6 xorg-dev xorg\n", - " pro_bar.update(progress(20, 100))\n", - " !wget http://security.ubuntu.com/ubuntu/pool/main/libx/libxfont/libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb 2>&1\n", - " pro_bar.update(progress(30, 100))\n", - " !wget --output-document xvfb.deb http://security.ubuntu.com/ubuntu/pool/universe/x/xorg-server/xvfb_1.18.4-0ubuntu0.12_amd64.deb 2>&1\n", - " pro_bar.update(progress(40, 100))\n", - " !sudo dpkg -i libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb 2>&1\n", + " !sudo apt-get update -qq\n", " pro_bar.update(progress(50, 100))\n", - " !sudo dpkg -i xvfb.deb 2>&1\n", - " pro_bar.update(progress(70, 100))\n", - " !rm libxfont1_1.5.1-1ubuntu0.16.04.4_amd64.deb\n", - " pro_bar.update(progress(80, 100))\n", - " !rm xvfb.deb\n", + " !sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq xvfb\n", " pro_bar.update(progress(90, 100))\n", - " !bash frame-buffer start\n", + " import subprocess\n", + " subprocess.Popen(['Xvfb', ':1', '-screen', '0', '1024x768x24', '-ac', '+extension', 'GLX', '+render', '-noreset'], \n", + " stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n", " os.environ[\"DISPLAY\"] = \":1\"\n", "pro_bar.update(progress(100, 100))" ], diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index d0b4d9dd15c..bc3ea6de1a6 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -9,8 +9,10 @@ and this project adheres to ## [Unreleased] ### Minor Changes #### com.unity.ml-agents (C#) +- Upgraded to Inference Engine 2.4.1 (#6269) - Fixed tensor indexing to use correct CHW layout (#6239) - Updated the installation doc (#6242) +- Fixed Unity Editor crashing when quitting in play mode (#6267) #### ml-agents / ml-agents-envs - Set the Torch version constraint to 2.8 (#6251) diff --git a/com.unity.ml-agents/Runtime/Academy.cs b/com.unity.ml-agents/Runtime/Academy.cs index 3cdc15f64c9..4867ddda0a7 100644 --- a/com.unity.ml-agents/Runtime/Academy.cs +++ b/com.unity.ml-agents/Runtime/Academy.cs @@ -261,6 +261,7 @@ protected Academy() LazyInitialize(); #if UNITY_EDITOR + EditorApplication.quitting += Dispose; EditorApplication.playModeStateChanged += HandleOnPlayModeChanged; #endif } diff --git a/com.unity.ml-agents/package.json b/com.unity.ml-agents/package.json index 394fd72689d..a92298cae59 100755 --- a/com.unity.ml-agents/package.json +++ b/com.unity.ml-agents/package.json @@ -5,7 +5,7 @@ "unity": "6000.0", "description": "Use state-of-the-art machine learning to create intelligent character behaviors in any Unity environment (games, robotics, film, etc.).", "dependencies": { - "com.unity.ai.inference": "2.2.1", + "com.unity.ai.inference": "2.4.1", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.physics": "1.0.0"