diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index 544fcefb2..7a9c6937f 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -9,13 +9,13 @@ and this project adheres to ## [Unreleased] ### Major Changes #### com.unity.ml-agents / com.unity.ml-agents.extensions (C#) -- Updated to PyTorch 1.13.1 -- Deprecated support for Python 3.8.x and 3.9.x - Upgraded ML-Agents to Sentis 1.2.0-exp.2 (#) - The minimum supported Unity version was updated to 2022.3. (#) - Added batched raycast sensor option. (#) #### ml-agents / ml-agents-envs +- Updated to PyTorch 1.13.1 +- Deprecated support for Python 3.8.x and 3.9.x ### Minor Changes #### com.unity.ml-agents / com.unity.ml-agents.extensions (C#) @@ -23,6 +23,7 @@ and this project adheres to - This will allow the staggering of execution timing when using multi-agents, leading to more stable performance. #### ml-agents / ml-agents-envs +- Added timeout cli and yaml config file support for specifying environment timeout. - Added training config feature to evenly distribute checkpoints throughout training. (#5842) - Updated training area replicator to add a condition to only replicate training areas when running a build. (#5842) diff --git a/docs/Training-ML-Agents.md b/docs/Training-ML-Agents.md index 2457963a9..ced355f5e 100644 --- a/docs/Training-ML-Agents.md +++ b/docs/Training-ML-Agents.md @@ -213,6 +213,7 @@ env_settings: env_args: null base_port: 5005 num_envs: 1 + timeout_wait: 10 seed: -1 max_lifetime_restarts: 10 restarts_rate_limit_n: 1 diff --git a/ml-agents/mlagents/trainers/cli_utils.py b/ml-agents/mlagents/trainers/cli_utils.py index de420c42a..6eb7a785f 100644 --- a/ml-agents/mlagents/trainers/cli_utils.py +++ b/ml-agents/mlagents/trainers/cli_utils.py @@ -233,6 +233,13 @@ def _create_parser() -> argparse.ArgumentParser: help="Results base directory", ) + argparser.add_argument( + "--timeout-wait", + default=60, + help="The period of time to wait on a Unity environment to startup for training.", + action=DetectDefault, + ) + eng_conf = argparser.add_argument_group(title="Engine Configuration") eng_conf.add_argument( "--width", diff --git a/ml-agents/mlagents/trainers/learn.py b/ml-agents/mlagents/trainers/learn.py index 69320920a..f3a3372ff 100644 --- a/ml-agents/mlagents/trainers/learn.py +++ b/ml-agents/mlagents/trainers/learn.py @@ -101,6 +101,7 @@ def run_training(run_seed: int, options: RunOptions, num_areas: int) -> None: engine_settings.no_graphics, run_seed, num_areas, + env_settings.timeout_wait, port, env_settings.env_args, os.path.abspath(run_logs_dir), # Unity environment requires absolute path @@ -175,6 +176,7 @@ def create_environment_factory( no_graphics: bool, seed: int, num_areas: int, + timeout_wait: int, start_port: Optional[int], env_args: Optional[List[str]], log_folder: str, @@ -194,6 +196,7 @@ def create_unity_environment( additional_args=env_args, side_channels=side_channels, log_folder=log_folder, + timeout_wait=timeout_wait, ) return create_unity_environment diff --git a/ml-agents/mlagents/trainers/settings.py b/ml-agents/mlagents/trainers/settings.py index 2aca4fdb1..d7fa113e1 100644 --- a/ml-agents/mlagents/trainers/settings.py +++ b/ml-agents/mlagents/trainers/settings.py @@ -817,6 +817,7 @@ class EnvironmentSettings: base_port: int = parser.get_default("base_port") num_envs: int = attr.ib(default=parser.get_default("num_envs")) num_areas: int = attr.ib(default=parser.get_default("num_areas")) + timeout_wait: int = attr.ib(default=parser.get_default("timeout_wait")) seed: int = parser.get_default("seed") max_lifetime_restarts: int = parser.get_default("max_lifetime_restarts") restarts_rate_limit_n: int = parser.get_default("restarts_rate_limit_n") diff --git a/ml-agents/mlagents/trainers/tests/test_learn.py b/ml-agents/mlagents/trainers/tests/test_learn.py index 7837d59eb..b03d90e11 100644 --- a/ml-agents/mlagents/trainers/tests/test_learn.py +++ b/ml-agents/mlagents/trainers/tests/test_learn.py @@ -105,6 +105,7 @@ def test_bad_env_path(): no_graphics=True, seed=-1, num_areas=1, + timeout_wait=1, start_port=8000, env_args=None, log_folder="results/log_folder",