diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index 26102b8958..0237b6c34e 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to #### ml-agents / ml-agents-envs - Fixed a bug when using LSTM and SAC where the buffer might contain non-integer numbers of sequences. (#6301) - Fixed mixed CPU/GPU computation by ensuring tensors share a consistent device in the trainer; Updated training devices. (#6303) +- Fix typing on optional strings (#6311) #### Examples - Replace hardcoded value 200f by agentRotationSpeed in MoveAgent() (#6306) diff --git a/ml-agents-envs/mlagents_envs/timers.py b/ml-agents-envs/mlagents_envs/timers.py index 32b8602c9c..f230730338 100644 --- a/ml-agents-envs/mlagents_envs/timers.py +++ b/ml-agents-envs/mlagents_envs/timers.py @@ -71,7 +71,10 @@ def add_time(self, elapsed: float) -> None: self.count += 1 def merge( - self, other: "TimerNode", root_name: str = None, is_parallel: bool = True + self, + other: "TimerNode", + root_name: Optional[str] = None, + is_parallel: bool = True, ) -> None: """ Add the other node to this node, then do the same recursively on its children. diff --git a/ml-agents/mlagents/trainers/directory_utils.py b/ml-agents/mlagents/trainers/directory_utils.py index 80379d81e9..5e979fab93 100644 --- a/ml-agents/mlagents/trainers/directory_utils.py +++ b/ml-agents/mlagents/trainers/directory_utils.py @@ -1,11 +1,12 @@ import os +from typing import Optional from mlagents.trainers.exception import UnityTrainerException from mlagents.trainers.settings import TrainerSettings from mlagents.trainers.model_saver.torch_model_saver import DEFAULT_CHECKPOINT_NAME def validate_existing_directories( - output_path: str, resume: bool, force: bool, init_path: str = None + output_path: str, resume: bool, force: bool, init_path: Optional[str] = None ) -> None: """ Validates that if the run_id model exists, we do not overwrite it unless --force is specified. diff --git a/ml-agents/mlagents/trainers/trainer/trainer_factory.py b/ml-agents/mlagents/trainers/trainer/trainer_factory.py index ffb7741513..c5b0cfd49d 100644 --- a/ml-agents/mlagents/trainers/trainer/trainer_factory.py +++ b/ml-agents/mlagents/trainers/trainer/trainer_factory.py @@ -1,5 +1,5 @@ import os -from typing import Dict +from typing import Dict, Optional from mlagents_envs.logging_util import get_logger from mlagents.trainers.environment_parameter_manager import EnvironmentParameterManager @@ -23,7 +23,7 @@ def __init__( load_model: bool, seed: int, param_manager: EnvironmentParameterManager, - init_path: str = None, + init_path: Optional[str] = None, multi_gpu: bool = False, ): """