浏览代码

[bug-fix] Fix issue with initialize not resetting step count (#3962)

/docs-update
GitHub 4 年前
当前提交
abbc6424
共有 3 个文件被更改,包括 6 次插入0 次删除
  1. 1
      com.unity.ml-agents/CHANGELOG.md
  2. 1
      ml-agents/mlagents/trainers/policy/tf_policy.py
  3. 4
      ml-agents/mlagents/trainers/tests/test_nn_policy.py

1
com.unity.ml-agents/CHANGELOG.md


- Unity Player logs are now written out to the results directory. (#3877)
- Run configuration YAML files are written out to the results directory at the end of the run. (#3815)
### Bug Fixes
- An issue was fixed where using `--initialize-from` would resume from the past step count. (#3962)
#### com.unity.ml-agents (C#)
#### ml-agents / ml-agents-envs / gym-unity (Python)

1
ml-agents/mlagents/trainers/policy/tf_policy.py


)
)
if reset_global_steps:
self._set_step(0)
logger.info(
"Starting training from step 0 and saving to {}.".format(
self.model_path

4
ml-agents/mlagents/trainers/tests/test_nn_policy.py


trainer_params["output_path"] = path1
policy = create_policy_mock(trainer_params)
policy.initialize_or_load()
policy._set_step(2000)
policy.save_model(2000)
assert len(os.listdir(tmp_path)) > 0

policy2.initialize_or_load()
_compare_two_policies(policy, policy2)
assert policy2.get_current_step() == 2000
# Try initialize from path 1
trainer_params["model_path"] = path2

_compare_two_policies(policy2, policy3)
# Assert that the steps are 0.
assert policy3.get_current_step() == 0
def _compare_two_policies(policy1: NNPolicy, policy2: NNPolicy) -> None:

正在加载...
取消
保存