Zhehui-Huang / quad-swarm-rl

Additional environments compatible with OpenAI gym
98 stars 39 forks source link

AttributeError: 'QuadrotorEnvMulti' object has no attribute 'render_speed' #47

Closed sAz-G closed 7 months ago

sAz-G commented 7 months ago

I get the mentioned error when I try to run the experiment.

I followed your instructions in this section.

Then I used the command python -m swarm_rl.enjoy --algo=APPO --env=quadrotor_multi --replay_buffer_sample_prob=0 --quads_use_numba=False --train_dir=./train_dir/paper_quads_multi_mix_baseline_8a_attn_v116/single_ --experiment=00_single_see_0 --quads_view_mode topdown

The full error message is


(swarm-rl) saz@saz-Lenovo-Z50-70:~/GitHub/quad-swarm-rl$ python -m swarm_rl.enjoy --algo=APPO --env=quadrotor_multi --replay_buffer_sample_prob=0 --quads_use_numba=False --train_dir=./train_dir/paper_quads_multi_mix_baseline_8a_attn_v116/single_ --experiment=00_single_see_0 --quads_view_mode topdown
[2023-11-16 14:20:12,879][127130] register_encoder_factory: <function make_quadmulti_encoder at 0x7f27372830d0>
[2023-11-16 14:20:12,922][127130] Loading existing experiment configuration from ./train_dir/paper_quads_multi_mix_baseline_8a_attn_v116/single_/00_single_see_0/config.json
[2023-11-16 14:20:12,923][127130] Overriding arg 'quads_use_numba' with value False passed from command line
[2023-11-16 14:20:12,923][127130] Overriding arg 'replay_buffer_sample_prob' with value 0.0 passed from command line
[2023-11-16 14:20:12,923][127130] Overriding arg 'quads_view_mode' with value ['topdown'] passed from command line
[2023-11-16 14:20:12,923][127130] Adding new argument 'fps'=0 that is not in the saved config file!
[2023-11-16 14:20:12,923][127130] Adding new argument 'eval_env_frameskip'=None that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'no_render'=False that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'save_video'=False that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'video_frames'=1000000000.0 that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'video_name'=None that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'max_num_frames'=1000000000.0 that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'max_num_episodes'=1000000000.0 that is not in the saved config file!
[2023-11-16 14:20:12,924][127130] Adding new argument 'push_to_hub'=False that is not in the saved config file!
[2023-11-16 14:20:12,925][127130] Adding new argument 'hf_repository'=None that is not in the saved config file!
[2023-11-16 14:20:12,925][127130] Adding new argument 'policy_index'=0 that is not in the saved config file!
[2023-11-16 14:20:12,925][127130] Adding new argument 'eval_deterministic'=False that is not in the saved config file!
[2023-11-16 14:20:12,925][127130] Adding new argument 'train_script'=None that is not in the saved config file!
[2023-11-16 14:20:12,925][127130] Adding new argument 'enjoy_script'=None that is not in the saved config file!
[2023-11-16 14:20:12,926][127130] Using frameskip 1 and render_action_repeat=1 for evaluation
/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/site-packages/gymnasium/spaces/box.py:130: UserWarning: WARN: Box bound precision lowered by casting to float32
  gym.logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
Observation components: ['xyz', 'vxyz', 'R', 'omega']
[2023-11-16 14:20:13,200][127130] Loading state from checkpoint ./train_dir/paper_quads_multi_mix_baseline_8a_attn_v116/single_/00_single_see_0/checkpoint_p0/checkpoint_000000000_0.pth...
Traceback (most recent call last):
  File "/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/saz/GitHub/quad-swarm-rl/swarm_rl/enjoy.py", line 17, in <module>
    sys.exit(main())
  File "/home/saz/GitHub/quad-swarm-rl/swarm_rl/enjoy.py", line 12, in main
    status = enjoy(cfg)
  File "/home/saz/.local/lib/python3.8/site-packages/sample_factory/enjoy.py", line 169, in enjoy
    last_render_start = render_frame(cfg, env, video_frames, num_episodes, last_render_start)
  File "/home/saz/.local/lib/python3.8/site-packages/sample_factory/enjoy.py", line 78, in render_frame
    env.render()
  File "/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/site-packages/gymnasium/core.py", line 418, in render
    return self.env.render()
  File "/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/site-packages/gymnasium/core.py", line 418, in render
    return self.env.render()
  File "/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/site-packages/gymnasium/core.py", line 418, in render
    return self.env.render()
  File "/home/saz/GitHub/quad-swarm-rl/swarm_rl/env_wrappers/compatibility.py", line 57, in render
    return self.env.render()
  File "/home/saz/anaconda3/envs/swarm-rl/lib/python3.8/site-packages/gymnasium/core.py", line 418, in render
    return self.env.render()
  File "/home/saz/GitHub/quad-swarm-rl/gym_art/quadrotor_multi/quadrotor_multi.py", line 730, in render
    self.init_scene_multi()
  File "/home/saz/GitHub/quad-swarm-rl/gym_art/quadrotor_multi/quadrotor_multi.py", line 334, in init_scene_multi
    render_speed=self.render_speed, formation_size=self.quads_formation_size, obstacles=self.obstacles,
AttributeError: 'QuadrotorEnvMulti' object has no attribute 'render_speed'```
sAz-G commented 7 months ago

I added the argument --quads_render=True to the command and now it works