From a5707576242b1bf4f503ead839d7184af32caf50 Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 11:14:05 -0700 Subject: [PATCH 01/11] bump editor version. --- .yamato/training-backcompat-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.yamato/training-backcompat-tests.yml b/.yamato/training-backcompat-tests.yml index b9ead7a8db..426c250351 100644 --- a/.yamato/training-backcompat-tests.yml +++ b/.yamato/training-backcompat-tests.yml @@ -1,6 +1,6 @@ -test_mac_backcompat_2020.1: - {% capture editor_version %}2020.1{% endcapture %} +test_mac_backcompat_2020.3: + {% capture editor_version %}2020.3{% endcapture %} {% capture csharp_backcompat_version %}1.0.0{% endcapture %} # This test has to run on mac because it requires the custom build of tensorflow without AVX # Test against 2020.1 because 2020.2 has to run against package version 1.2.0 From 87c06f2c8cb1e581e0d3c58747c308073450a90c Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 11:54:34 -0700 Subject: [PATCH 02/11] Use 2019.4 for backcompat tests. --- .yamato/training-backcompat-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.yamato/training-backcompat-tests.yml b/.yamato/training-backcompat-tests.yml index 426c250351..2e78da6a91 100644 --- a/.yamato/training-backcompat-tests.yml +++ b/.yamato/training-backcompat-tests.yml @@ -1,6 +1,6 @@ -test_mac_backcompat_2020.3: - {% capture editor_version %}2020.3{% endcapture %} +test_mac_backcompat_2019.4: + {% capture editor_version %}2019.4{% endcapture %} {% capture csharp_backcompat_version %}1.0.0{% endcapture %} # This test has to run on mac because it requires the custom build of tensorflow without AVX # Test against 2020.1 because 2020.2 has to run against package version 1.2.0 From 80a6b87867d06831a895bd5ecfb3cf4ed565ff6d Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 12:16:41 -0700 Subject: [PATCH 03/11] try new image, probably won't work. --- .yamato/training-backcompat-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.yamato/training-backcompat-tests.yml b/.yamato/training-backcompat-tests.yml index 2e78da6a91..b261d145c1 100644 --- a/.yamato/training-backcompat-tests.yml +++ b/.yamato/training-backcompat-tests.yml @@ -7,7 +7,7 @@ test_mac_backcompat_2019.4: name: Test Mac Backcompat Training {{ editor_version }} agent: type: Unity::VM::osx - image: ml-agents/ml-agents-bokken-mac:0.1.4-492264 + image: desktop/unity-macos-10.15-xcode-12.2:stable flavor: b1.small variables: UNITY_VERSION: {{ editor_version }} From b04e0045a915eba738b151147b9d262f114a8cab Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 12:48:54 -0700 Subject: [PATCH 04/11] bump back compat tests. --- .yamato/training-backcompat-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.yamato/training-backcompat-tests.yml b/.yamato/training-backcompat-tests.yml index b261d145c1..1551fa39bb 100644 --- a/.yamato/training-backcompat-tests.yml +++ b/.yamato/training-backcompat-tests.yml @@ -25,7 +25,7 @@ test_mac_backcompat_2019.4: - | python3 -m venv venv_old && source venv_old/bin/activate python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple - python -u -m ml-agents.tests.yamato.training_int_tests --python 0.16.0 + python -u -m ml-agents.tests.yamato.training_int_tests --python 0.24.0 triggers: cancel_old_ci: true recurring: From df5a92a0994a6155aad8bc3c71c8cf5c877722ac Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 13:12:16 -0700 Subject: [PATCH 05/11] don't install tensorflow. --- ml-agents/tests/yamato/yamato_utils.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ml-agents/tests/yamato/yamato_utils.py b/ml-agents/tests/yamato/yamato_utils.py index 2302227db1..d81cdd34bb 100644 --- a/ml-agents/tests/yamato/yamato_utils.py +++ b/ml-agents/tests/yamato/yamato_utils.py @@ -134,13 +134,10 @@ def init_venv( pip_commands = ["--upgrade pip", "--upgrade setuptools"] if mlagents_python_version: # install from pypi - if platform != "darwin": - raise RuntimeError("Yamato can only run tensorflow on mac platforms!") pip_commands += [ f"mlagents=={mlagents_python_version}", f"gym-unity=={mlagents_python_version}", # TODO build these and publish to internal pypi - "~/tensorflow_pkg/tensorflow-2.0.0-cp37-cp37m-macosx_10_14_x86_64.whl", "tf2onnx==1.6.1", ] else: From 7bbf99a55fce0178d4f34d0a3ad9f5d702defdf1 Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 14:08:08 -0700 Subject: [PATCH 06/11] don't use old yml config. --- ml-agents/tests/yamato/training_int_tests.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ml-agents/tests/yamato/training_int_tests.py b/ml-agents/tests/yamato/training_int_tests.py index 3797738182..b35ea9c538 100644 --- a/ml-agents/tests/yamato/training_int_tests.py +++ b/ml-agents/tests/yamato/training_int_tests.py @@ -5,7 +5,6 @@ import sys import subprocess import time -from typing import Any from .yamato_utils import ( find_executables, @@ -14,7 +13,6 @@ run_standalone_build, init_venv, override_config_file, - override_legacy_config_file, checkout_csharp_version, undo_git_checkout, ) @@ -70,17 +68,11 @@ def run_training(python_version: str, csharp_version: str) -> bool: # Copy the default training config but override the max_steps parameter, # and reduce the batch_size and buffer_size enough to ensure an update step happens. yaml_out = "override.yaml" - if python_version: - overrides: Any = {"max_steps": 100, "batch_size": 10, "buffer_size": 10} - override_legacy_config_file( - python_version, "config/trainer_config.yaml", yaml_out, **overrides - ) - else: - overrides = { - "hyperparameters": {"batch_size": 10, "buffer_size": 10}, - "max_steps": 100, - } - override_config_file("config/ppo/3DBall.yaml", yaml_out, overrides) + overrides = { + "hyperparameters": {"batch_size": 10, "buffer_size": 10}, + "max_steps": 100, + } + override_config_file("config/ppo/3DBall.yaml", yaml_out, overrides) log_output_path = f"{get_base_output_path()}/training.log" env_path = os.path.join(get_base_output_path(), standalone_player_path) From b0acfaa69117032a053166003f96edb6b321d385 Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 16:35:21 -0700 Subject: [PATCH 07/11] update image to use python 3.8 --- .yamato/training-backcompat-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.yamato/training-backcompat-tests.yml b/.yamato/training-backcompat-tests.yml index 1551fa39bb..674226ce4c 100644 --- a/.yamato/training-backcompat-tests.yml +++ b/.yamato/training-backcompat-tests.yml @@ -7,13 +7,13 @@ test_mac_backcompat_2019.4: name: Test Mac Backcompat Training {{ editor_version }} agent: type: Unity::VM::osx - image: desktop/unity-macos-10.15-xcode-12.2:stable + image: ml-agents/ml-agents-bokken-mac:0.1.5-853758 flavor: b1.small variables: UNITY_VERSION: {{ editor_version }} commands: - | - python3 -m venv venv && source venv/bin/activate + python -m venv venv && source venv/bin/activate python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple python -m pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple --upgrade unity-downloader-cli -u {{ editor_version }} -c editor --wait --fast @@ -23,7 +23,7 @@ test_mac_backcompat_2019.4: python -u -m ml-agents.tests.yamato.standalone_build_tests --build-target=mac python -u -m ml-agents.tests.yamato.training_int_tests --csharp {{ csharp_backcompat_version }} - | - python3 -m venv venv_old && source venv_old/bin/activate + python -m venv venv_old && source venv_old/bin/activate python -m pip install pyyaml --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple python -u -m ml-agents.tests.yamato.training_int_tests --python 0.24.0 triggers: From c25e31697668816c20cb94ce5d6f50f36f7972c5 Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Mon, 30 Aug 2021 17:01:06 -0700 Subject: [PATCH 08/11] catch exception when trying to close the channel. --- .../Runtime/Communicator/RpcCommunicator.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs b/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs index b3f25e839a..b253c7b28a 100644 --- a/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs +++ b/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs @@ -241,7 +241,14 @@ UnityInputProto Initialize(int port, UnityOutputProto unityOutput, out UnityInpu void NotifyQuitAndShutDownChannel() { QuitCommandReceived?.Invoke(); - m_Channel.ShutdownAsync().Wait(); + try + { + m_Channel.ShutdownAsync().Wait(); + } + catch (InvalidOperationException) + { + // do nothing + } } #endregion From 6a4b6867328095cdf8dd72822e9a9b50817de95f Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Tue, 31 Aug 2021 09:54:03 -0700 Subject: [PATCH 09/11] Don't wait for shutdown. --- com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs b/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs index b253c7b28a..85049f9234 100644 --- a/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs +++ b/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs @@ -141,7 +141,7 @@ out input Debug.Log($"Unexpected exception when trying to initialize communication: {ex}"); } initParametersOut = new UnityRLInitParameters(); - m_Channel.ShutdownAsync().Wait(); + m_Channel.ShutdownAsync(); return false; } From 4bd3f2020a0fc968c5f583b980abe5e6a64b3291 Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Tue, 31 Aug 2021 10:14:00 -0700 Subject: [PATCH 10/11] catch any exception. --- com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs b/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs index 85049f9234..8e6e211b1a 100644 --- a/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs +++ b/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs @@ -141,7 +141,7 @@ out input Debug.Log($"Unexpected exception when trying to initialize communication: {ex}"); } initParametersOut = new UnityRLInitParameters(); - m_Channel.ShutdownAsync(); + NotifyQuitAndShutDownChannel(); return false; } @@ -245,7 +245,7 @@ void NotifyQuitAndShutDownChannel() { m_Channel.ShutdownAsync().Wait(); } - catch (InvalidOperationException) + catch (Exception) { // do nothing } From 2196e0650a04f79716909290e3d9bfa47e0bd7cf Mon Sep 17 00:00:00 2001 From: Christopher Goy Date: Tue, 31 Aug 2021 10:36:48 -0700 Subject: [PATCH 11/11] change output dir. --- ml-agents/tests/yamato/training_int_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ml-agents/tests/yamato/training_int_tests.py b/ml-agents/tests/yamato/training_int_tests.py index b35ea9c538..8678c166d7 100644 --- a/ml-agents/tests/yamato/training_int_tests.py +++ b/ml-agents/tests/yamato/training_int_tests.py @@ -24,7 +24,7 @@ def run_training(python_version: str, csharp_version: str) -> bool: print( f"Running training with python={python_version or latest} and c#={csharp_version or latest}" ) - output_dir = "models" if python_version else "results" + output_dir = "results" onnx_file_expected = f"./{output_dir}/{run_id}/3DBall.onnx" if os.path.exists(onnx_file_expected):