From 90557d800d94c132feec3d4a499cf52e639c5c16 Mon Sep 17 00:00:00 2001 From: Miguel Alonso Jr Date: Tue, 21 Nov 2023 22:44:09 -0500 Subject: [PATCH] Fixed precommit issues. --- docs/Python-LLAPI-Documentation.md | 19 +++++++++---------- ml-agents-envs/mlagents_envs/environment.py | 18 ++++++++---------- ml-agents/mlagents/trainers/cli_utils.py | 4 ++-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/docs/Python-LLAPI-Documentation.md b/docs/Python-LLAPI-Documentation.md index dfd868ca05..640c4ddb99 100644 --- a/docs/Python-LLAPI-Documentation.md +++ b/docs/Python-LLAPI-Documentation.md @@ -634,22 +634,21 @@ class UnityEnvironment(BaseEnv) #### \_\_init\_\_ ```python - | __init__(file_name: Optional[str] = None, worker_id: int = 0, base_port: Optional[int] = None, seed: int = 0, no_graphics: bool = False, timeout_wait: int = 60, additional_args: Optional[List[str]] = None, side_channels: Optional[List[SideChannel]] = None, log_folder: Optional[str] = None, num_areas: int = 1) + | __init__(file_name: Optional[str] = None, worker_id: int = 0, base_port: Optional[int] = None, seed: int = 0, no_graphics: bool = False, no_graphics_monitor: bool = False, timeout_wait: int = 60, additional_args: Optional[List[str]] = None, side_channels: Optional[List[SideChannel]] = None, log_folder: Optional[str] = None, num_areas: int = 1) ``` Starts a new unity environment and establishes a connection with the environment. Notice: Currently communication between Unity and Python takes place over an open socket without authentication. Ensure that the network where training takes place is secure. -:string file_name: Name of Unity environment binary. -:int base_port: Baseline port number to connect to Unity environment over. worker_id increments over this. -If no environment is specified (i.e. file_name is None), the DEFAULT_EDITOR_PORT will be used. -:int worker_id: Offset from base_port. Used for training multiple environments simultaneously. -:bool no_graphics: Whether to run the Unity simulator in no-graphics mode -:int timeout_wait: Time (in seconds) to wait for connection from environment. -:list args: Addition Unity command line arguments -:list side_channels: Additional side channel for no-rl communication with Unity -:str log_folder: Optional folder to write the Unity Player log file into. Requires absolute path. +:string file_name: Name of Unity environment binary. :int base_port: Baseline port number to connect to Unity +environment over. worker_id increments over this. If no environment is specified (i.e. file_name is None), +the DEFAULT_EDITOR_PORT will be used. :int worker_id: Offset from base_port. Used for training multiple +environments simultaneously. :bool no_graphics: Whether to run the Unity simulator in no-graphics mode :bool +no_graphics_monitor: Whether to run the main worker in graphics mode, with the remaining in no-graphics mode +:int timeout_wait: Time (in seconds) to wait for connection from environment. :list args: Addition Unity +command line arguments :list side_channels: Additional side channel for no-rl communication with Unity :str +log_folder: Optional folder to write the Unity Player log file into. Requires absolute path. #### close diff --git a/ml-agents-envs/mlagents_envs/environment.py b/ml-agents-envs/mlagents_envs/environment.py index e131ac4533..b2a107441d 100644 --- a/ml-agents-envs/mlagents_envs/environment.py +++ b/ml-agents-envs/mlagents_envs/environment.py @@ -161,16 +161,14 @@ def __init__( Notice: Currently communication between Unity and Python takes place over an open socket without authentication. Ensure that the network where training takes place is secure. - :string file_name: Name of Unity environment binary. - :int base_port: Baseline port number to connect to Unity environment over. worker_id increments over this. - If no environment is specified (i.e. file_name is None), the DEFAULT_EDITOR_PORT will be used. - :int worker_id: Offset from base_port. Used for training multiple environments simultaneously. - :bool no_graphics: Whether to run the Unity simulator in no-graphics mode - :bool no_graphics_monitor: Whether to run the main worker in graphics mode, with the remaining in no-graphics mode - :int timeout_wait: Time (in seconds) to wait for connection from environment. - :list args: Addition Unity command line arguments - :list side_channels: Additional side channel for no-rl communication with Unity - :str log_folder: Optional folder to write the Unity Player log file into. Requires absolute path. + :string file_name: Name of Unity environment binary. :int base_port: Baseline port number to connect to Unity + environment over. worker_id increments over this. If no environment is specified (i.e. file_name is None), + the DEFAULT_EDITOR_PORT will be used. :int worker_id: Offset from base_port. Used for training multiple + environments simultaneously. :bool no_graphics: Whether to run the Unity simulator in no-graphics mode :bool + no_graphics_monitor: Whether to run the main worker in graphics mode, with the remaining in no-graphics mode + :int timeout_wait: Time (in seconds) to wait for connection from environment. :list args: Addition Unity + command line arguments :list side_channels: Additional side channel for no-rl communication with Unity :str + log_folder: Optional folder to write the Unity Player log file into. Requires absolute path. """ atexit.register(self._close) self._additional_args = additional_args or [] diff --git a/ml-agents/mlagents/trainers/cli_utils.py b/ml-agents/mlagents/trainers/cli_utils.py index 104e4b47b5..30066717a7 100644 --- a/ml-agents/mlagents/trainers/cli_utils.py +++ b/ml-agents/mlagents/trainers/cli_utils.py @@ -302,8 +302,8 @@ def _create_parser() -> argparse.ArgumentParser: default=False, action=DetectDefaultStoreTrue, help="Whether to run the main Unity worker in graphics mode with the remaining workers in no graphics mode" - "(i.e. without initializing the graphics driver. Use this only if your agents don't use visual " - "observations.", + "(i.e. without initializing the graphics driver. Use this only if your agents don't use visual " + "observations.", ) torch_conf = argparser.add_argument_group(title="Torch Configuration")