xuehaipan / mate Goto Github PK
View Code? Open in Web Editor NEWMATE: the Multi-Agent Tracking Environment.
Home Page: https://mate-gym.readthedocs.io
License: MIT License
MATE: the Multi-Agent Tracking Environment.
Home Page: https://mate-gym.readthedocs.io
License: MIT License
I want to use mate/evaluate.py to evaluate the algorithm TarMAC, however, it raise error.
when I run following script
python3 -m mate.evaluate --episodes 1 --render-communication --camera-agent examples.tarmac.camera.agent:TarMACCameraAgent --target-agent examples.tarmac.target.agent:TarMACTargetAgent --config MATE-4v2-9.yaml --seed 0
it report :
File "/home/anaconda3/envs/mate/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/anaconda3/envs/mate/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/mate-main/mate/evaluate.py", line 481, in
main()
File "/home/mate-main/mate/evaluate.py", line 426, in main
status = evaluate(env, target_agents, render=True, video_path=args.save_video)
File "/home/mate-main/mate/evaluate.py", line 119, in evaluate
env, target_agents, target_joint_observation, target_infos
File "/home/mate-main/mate/wrappers/single_team.py", line 90, in group_step
joint_action = group_act(agents, joint_observation, infos, deterministic=deterministic)
File "/home/mate-main/mate/wrappers/single_team.py", line 75, in group_act
for agent, observation, info in zip(agents, joint_observation, infos)
File "/home/mate-main/mate/wrappers/single_team.py", line 75, in
for agent, observation, info in zip(agents, joint_observation, infos)
File "/home/mate-main/examples/tarmac/target/agent.py", line 59, in act
observation, state=self.hidden_state, info=info, deterministic=deterministic
File "/home/mate-main/examples/utils/rllib_policy.py", line 184, in compute_single_action
preprocessed_observation = self.preprocess_observation(observation)
File "/home/mate-main/examples/tarmac/target/agent.py", line 93, in preprocess_observation
] = preprocessed_observation.ravel()
ValueError: could not broadcast input array from shape (101,) into shape (61,)
when I change the env config to MATE-4v4-9.yaml, it report:
ValueError: could not broadcast input array from shape (111,) into shape (61,)
Is there any suggestion? Looking forward to your reply, thanks!
Hello,
I encountered an issue while using your repository. When attempting to run the code, I encountered the following error:
AttributeError: 'numpy.random._generator.Generator' object has no attribute 'randint'
It seems that the error is caused by the missing randint attribute in the numpy.random.Generator object. According to my understanding, the randint method should be available in newer versions of NumPy.
I suspect that this issue may be related to the version of NumPy being used. Therefore, I have a few questions:
What version of NumPy did you use during the development and testing of this repository?
Could you provide a specific NumPy version number that I can try, either to downgrade or upgrade my own NumPy version to potentially resolve this issue?
If this issue is indeed related to the NumPy version, have you considered updating the code to accommodate a wider range of NumPy versions?
Thank you for your help and support! Please let me know if you need any further information.
Hello, the Mate you shared has been extremely helpful for my research. I am currently studying your code, but I have encountered a bug that I haven't been able to solve despite spending a lot of time on it. Could you please take a look and assist me?
Here is the process that triggered my issue:
mate/examples/psro/ray_results/debug/NE-camera.HRL-MAPPO-vs.-target.MAPPO/camera/00001/PSRO-camera.HRL-MAPPO/PSRO-camera.HRL-MAPPO-00001_0_2023-06-26_22-43-32/checkpoint_000001/checkpoint-1
self.checkpoint_path, self.worker, self.params = load_checkpoint(checkpoint_path)
By loading the aforementioned checkpoint-1, it retrieves self.worker. When setting the state of self.worker, the values of the parameters "fused" and "foreach" in self.worker['state']['shared_policy']['_optimizer_variables'][0]['param_groups'][0] are both None.
tensor = torch.from_numpy(np.asarray(item))
When the values of fused and foreach are None and are being converted to a tensor as items, the following error occurs:
TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
My approach has been:
2.Add parameters in the config file.
Within example/hrl/mappo/camera/config.py, I added the parameters 'foreach': False and 'fused': True under config['model']['custom_model_config']. However, when loading checkpoint-1, the values of these two parameters remained as None.
These are the two approaches I have tried, but neither of them has resolved the issue. I would greatly appreciate any insights you can provide.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.