Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualize data on an intersection trained using RLlib, AttributeError and ValueError #1078

Open
sjtulhm opened this issue Jun 30, 2023 · 0 comments
Labels

Comments

@sjtulhm
Copy link

sjtulhm commented Jun 30, 2023

When I write "python flow/visualize/visualizer_rllib.py ~/ray_results/test0629/PPO_MultiAgentlhmNetwork1POEnv-v0_f48e2fe4_2023-06-29_20-17-46cjrol_re 400 --horizon 500 --gen_emission" in the terminal, it can open the sumo-gui, but run only 1 second some errors happened.
Then I will show the errors:
2023-06-30 09:45:40,604 INFO resource_spec.py:216 -- Starting Ray with 4.69 GiB memory available for workers and up to 2.35 GiB for objects. You can adjust these settings with ray.init(memory=, object_store_memory=).
2023-06-30 09:45:41,335 INFO trainer.py:371 -- Tip: set 'eager': true or the --eager flag to enable TensorFlow eager execution
2023-06-30 09:45:41,340 INFO trainer.py:512 -- Current log_level is WARN. For more information, set 'log_level': 'INFO' / 'DEBUG' or use the -v and -vv flags.
2023-06-30 09:45:41,344 WARNING ppo.py:168 -- Using the simple minibatch optimizer. This will significantly reduce performance, consider simple_optimizer=False.
2023-06-30 09:45:44,264 INFO trainable.py:346 -- Restored from checkpoint: /home/a906/ray_results/test0629/PPO_MultiAgentlhmNetwork1POEnv-v0_f48e2fe4_2023-06-29_20-17-46cjrol_re/checkpoint_400/checkpoint-400
2023-06-30 09:45:44,264 INFO trainable.py:353 -- Current state after restoring: {'_iteration': 400, '_timesteps_total': 28777138, '_time_total': 42873.71559095383, '_episodes_total': 1777}
Traceback (most recent call last):
File "/home/a906/anaconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/models/preprocessors.py", line 62, in check_shape
if not self._obs_space.contains(observation):
File "/home/a906/anaconda3/envs/flow/lib/python3.7/site-packages/gym-0.14.0-py3.7.egg/gym/spaces/box.py", line 102, in contains
return x.shape == self.shape and np.all(x >= self.low) and np.all(x <= self.high)
AttributeError: 'dict' object has no attribute 'shape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "flow/visualize/visualizer_rllib.py", line 386, in
visualizer_rllib(args)
File "flow/visualize/visualizer_rllib.py", line 229, in visualizer_rllib
action = agent.compute_action(state)
File "/home/a906/anaconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/agents/trainer.py", line 643, in compute_action
policy_id].transform(observation)
File "/home/a906/anaconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/models/preprocessors.py", line 166, in transform
self.check_shape(observation)
File "/home/a906/anaconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/models/preprocessors.py", line 69, in check_shape
"should be an np.array, not a Python list.", observation)
ValueError: ('Observation for a Box/MultiBinary/MultiDiscrete space should be an np.array, not a Python list.', {})
/home/a906/flow/flow/visualize/test_time_rollout/test0629_20230630-0945411688089541.3611593-0_emission.csv /home/a906/flow/flow/visualize/test_time_rollout/

So, how should I do? thank you very much!

@sjtulhm sjtulhm added the bug label Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant