XuehaiPan / mate

MATE: the Multi-Agent Tracking Environment.
https://mate-gym.readthedocs.io
MIT License
33 stars 22 forks source link

Error in evaluate #3

Closed xinyu-site closed 1 year ago

xinyu-site commented 1 year ago

I have come across an error when running the evaluation script (evaluate.py), and I believe it may be a bug in the framework.

python3 -m evaluate --episodes 1 --config MATE-4v2-9.yaml

Error Description: When executing the script, I receive the following error message:

(mate) admire@admire-System-Product-Name:~/mate/mate/mate$ python3 -m evaluate --episodes 1 --config MATE-4v2-9.yaml
/home/admire/anaconda3/envs/mate/lib/python3.8/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
  warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
/home/admire/anaconda3/envs/mate/lib/python3.8/site-packages/gym/utils/seeding.py:47: DeprecationWarning: WARN: Function `rng.randint(low, [high, size, dtype])` is marked as deprecated and will be removed in the future. Please use `rng.integers(low, [high, size, dtype])` instead.
  deprecation(
/home/admire/mate/mate/mate/entities.py:585: DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)
  self.empty_bits = np.zeros(consts.NUM_WAREHOUSES, dtype=np.bool8)
/home/admire/mate/mate/mate/environment.py:476: DeprecationWarning: `np.bool8` is a deprecated alias for `np.bool_`.  (Deprecated NumPy 1.24)
  (self.num_cameras, self.num_targets), dtype=np.bool8
Traceback (most recent call last):
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/admire/mate/mate/mate/evaluate.py", line 481, in <module>
    main()
  File "/home/admire/mate/mate/mate/evaluate.py", line 403, in main
    env = mate.make('MultiAgentTracking-v0', config=args.config, wrappers=wrappers)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/site-packages/gym/envs/registration.py", line 676, in make
    return registry.make(id, **kwargs)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/site-packages/gym/envs/registration.py", line 520, in make
    return spec.make(**kwargs)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/site-packages/gym/envs/registration.py", line 137, in make
    env = self.entry_point(**_kwargs)
  File "/home/admire/mate/mate/mate/__init__.py", line 41, in make_environment
    env = wrapper(env)
  File "/home/admire/mate/mate/mate/wrappers/typing.py", line 103, in __call__
    return self.wrapper(env, *self.args, **self.kwargs)
  File "/home/admire/mate/mate/mate/wrappers/single_team.py", line 307, in __init__
    super().__init__(env, team=Team.TARGET, opponent_agent=camera_agent)
  File "/home/admire/mate/mate/mate/wrappers/single_team.py", line 185, in __init__
    self.opponent_agents_ordered = opponent_agent.spawn(self.num_opponents)
  File "/home/admire/mate/mate/mate/agents/base.py", line 105, in spawn
    return [self.clone() for _ in range(num_agents)]
  File "/home/admire/mate/mate/mate/agents/base.py", line 105, in <listcomp>
    return [self.clone() for _ in range(num_agents)]
  File "/home/admire/mate/mate/mate/agents/base.py", line 98, in clone
    clone = copy.deepcopy(self)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 269, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 229, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 263, in _reconstruct
    y = func(*args)
TypeError: _generator_ctor() takes from 0 to 1 positional arguments but 2 were given

I have made sure that all the dependencies, including MATE, Gym, and NumPy, are up to date and compatible with each other. However, the error persists. I have also attempted to install other version of gym but was unable to find a resolution.

Steps to Reproduce:

Run the evaluate.py script with the provided command:

python3 -m evaluate --episodes 1 --config MATE-4v2-9.yaml.

Environment Information: python 3.8.0 gym 0.23.1 numpy 1.24.3

Please provide me with the versions of all the packages you have installed to ensure smooth execution of the entire framework. Thank you for your attention to this matter, and I look forward to your response.

Best regards

xinyu-site commented 1 year ago

您好,我使用中文和您沟通。我尝试了环境的其他功能,仍然有些问题,我的环境中某个包的版本可能不兼容。 我执行了如下代码:

import mate
env = mate.make('MultiAgentTracking-v0')
env = mate.MultiTarget(env, camera_agent=mate.GreedyCameraAgent(seed=0))
env.seed(0)
done = False
target_joint_observation = env.reset()
while not done:
    target_joint_action = env.action_space.sample()  # your agent here (this takes random actions)
    target_joint_observation, target_team_reward, done, target_infos = env.step(target_joint_action)

遇到了如下错误:

Traceback (most recent call last):
  File "/home/admire/mate/mate/test.py", line 4, in <module>
    env = mate.MultiTarget(env, camera_agent=mate.GreedyCameraAgent(seed=0))
  File "/home/admire/mate/mate/mate/wrappers/single_team.py", line 307, in __init__
    super().__init__(env, team=Team.TARGET, opponent_agent=camera_agent)
  File "/home/admire/mate/mate/mate/wrappers/single_team.py", line 185, in __init__
    self.opponent_agents_ordered = opponent_agent.spawn(self.num_opponents)
  File "/home/admire/mate/mate/mate/agents/base.py", line 105, in spawn
    return [self.clone() for _ in range(num_agents)]
  File "/home/admire/mate/mate/mate/agents/base.py", line 105, in <listcomp>
    return [self.clone() for _ in range(num_agents)]
  File "/home/admire/mate/mate/mate/agents/base.py", line 98, in clone
    clone = copy.deepcopy(self)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 269, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 229, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/admire/anaconda3/envs/mate/lib/python3.8/copy.py", line 263, in _reconstruct
    y = func(*args)
TypeError: _generator_ctor() takes from 0 to 1 positional arguments but 2 were given

请问是什么包冲突了,十分感谢您的解答!