浏览代码

Update cattrs dependencies to support python3.9 (#4821)

/develop/gail-srl-hack
GitHub 4 年前
当前提交
c080a8fa
共有 4 个文件被更改,包括 14 次插入7 次删除
  1. 2
      com.unity.ml-agents/CHANGELOG.md
  2. 2
      ml-agents-envs/mlagents_envs/tests/test_envs.py
  3. 11
      ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py
  4. 6
      ml-agents/setup.py

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


#### com.unity.ml-agents / com.unity.ml-agents.extensions (C#)
#### ml-agents / ml-agents-envs / gym-unity (Python)
- The `encoding_size` setting for RewardSignals has been deprecated. Please use `network_settings` instead. (#4982)
- The `cattrs` version dependency was updated to allow `>=1.1.0` on Python 3.8 or higher. (#4821)
### Bug Fixes
#### com.unity.ml-agents (C#)
#### ml-agents / ml-agents-envs / gym-unity (Python)

2
ml-agents-envs/mlagents_envs/tests/test_envs.py


)
env = UnityEnvironment(file_name=file_name, worker_id=0, base_port=base_port)
assert expected == env._port
env.close()
@mock.patch("mlagents_envs.env_utils.launch_executable")

args = env._executable_args()
log_file_index = args.index("-logFile")
assert args[log_file_index + 1] == "./some-log-folder-path/Player-0.log"
env.close()
@mock.patch("mlagents_envs.env_utils.launch_executable")

11
ml-agents-envs/mlagents_envs/tests/test_rpc_utils.py


import io
import numpy as np
import pytest
from typing import List, Tuple
from typing import List, Tuple, Any
from mlagents_envs.communicator_objects.agent_info_pb2 import AgentInfoProto
from mlagents_envs.communicator_objects.observation_pb2 import (

reward = decision_steps.reward[agent_id_index]
done = False
max_step_reached = False
agent_mask = None
agent_mask: Any = None
agent_mask = [] # type: ignore
agent_mask = []
agent_mask = agent_mask.astype(np.bool).tolist()
observations: List[ObservationProto] = []
for all_observations_of_type in decision_steps.obs:
observation = all_observations_of_type[agent_id_index]

reward=reward,
done=done,
id=agent_id,
max_step_reached=max_step_reached,
max_step_reached=bool(max_step_reached),
action_mask=agent_mask,
observations=observations,
)

reward=reward,
done=done,
id=agent_id,
max_step_reached=max_step_reached,
max_step_reached=bool(max_step_reached),
action_mask=None,
observations=final_observations,
)

6
ml-agents/setup.py


# https://github.com/Unity-Technologies/ml-agents/blob/main/docs/Installation.md#windows-installing-pytorch
'torch>=1.6.0,<1.8.0;platform_system!="Windows"',
"tensorboard>=1.15",
# cattrs 1.1.0 dropped support for python 3.6.
"cattrs>=1.0.0,<1.1.0",
# cattrs 1.1.0 dropped support for python 3.6, but 1.0.0 doesn't work for python 3.9
# Since there's no version that supports both, we have to draw the line somwehere.
"cattrs<1.1.0; python_version<'3.8'",
"cattrs>=1.1.0; python_version>='3.8'",
"attrs>=19.3.0",
'pypiwin32==223;platform_system=="Windows"',
"importlib_metadata; python_version<'3.8'",

正在加载...
取消
保存