opendilab / DI-drive

Decision Intelligence Platform for Autonomous Driving simulation.
https://opendilab.github.io/DI-drive/
Apache License 2.0
569 stars 58 forks source link

Attribution Error when running simple_rl_train.py #25

Closed chengzelei closed 1 year ago

chengzelei commented 1 year ago

ISSUE TEMPLATE

Traceback (most recent call last): File "simple_rl_train.py", line 243, in main(args) File "simple_rl_train.py", line 181, in main cfg.policy.eval.evaluator, evaluate_env, policy.eval_mode, tb_logger, exp_name=cfg.exp_name File "/home/zck7060/DI-drive/core/eval/serial_evaluator.py", line 59, in init super().init(cfg, env, policy, tb_logger=tb_logger, exp_name=exp_name, instance_name=instance_name) File "/home/zck7060/DI-drive/core/eval/base_evaluator.py", line 49, in init self.env = env File "/home/zck7060/DI-drive/core/eval/serial_evaluator.py", line 76, in env self._env_manager.launch() File "/home/zck7060/anaconda3/envs/didrive/lib/python3.7/site-packages/ding/envs/env_manager/subprocess_env_manager.py", line 333, in launch self._create_state() File "/home/zck7060/anaconda3/envs/didrive/lib/python3.7/site-packages/ding/envs/env_manager/subprocess_env_manager.py", line 250, in _create_state shape = obs_space.shape AttributeError: 'NoneType' object has no attribute 'shape'

Before running the program, I had started the Carla server with ports 9000 and 9002.

I also tried other versions of DI-Engine like 0.4.0 but same error. Any idea of how this error occurs is appreciated!

RobinC94 commented 1 year ago

This issue is probably caused by a wrong DI-engine (i.e. greater than 0.4), or setting the 'shared_memory' in config of env.manager to 'True'. This will call the 'obs_shape' property in env to get the shape of shared space, which is often set to 'None' in Carla environments.

You can try to add 'shared_memory = False' in config.env.manager to see if it is fixed.

zqiilmc commented 9 months ago

ISSUE TEMPLATE

  • [ ] I have marked all applicable categories:

    • [x] exception-raising bug
    • [ ] RL algorithm bug
    • [ ] system worker bug
    • [ ] system utils bug
    • [ ] code design/refactor
    • [ ] documentation request
    • [ ] new feature request
  • [x] I have visited the readme and doc
  • [x] I have searched through the issue tracker and pr tracker
  • [x] I have mentioned version numbers, operating system and environment, where applicable:
    import core, torch, sys
    print(core.__version__, torch.__version__, sys.version, sys.platform)

I installed the latest version of DI-Drive with DI-Engine (version 0.3.1) and Carla (0.9.10) according to the instruction. No error was raised when entering "python -c "import carla"". However, when I run the simple_rl_train.py, the program raised an error

Traceback (most recent call last): File "simple_rl_train.py", line 243, in main(args) File "simple_rl_train.py", line 181, in main cfg.policy.eval.evaluator, evaluate_env, policy.eval_mode, tb_logger, exp_name=cfg.exp_name File "/home/zck7060/DI-drive/core/eval/serial_evaluator.py", line 59, in init super().init(cfg, env, policy, tb_logger=tb_logger, exp_name=exp_name, instance_name=instance_name) File "/home/zck7060/DI-drive/core/eval/base_evaluator.py", line 49, in init self.env = env File "/home/zck7060/DI-drive/core/eval/serial_evaluator.py", line 76, in env self._env_manager.launch() File "/home/zck7060/anaconda3/envs/didrive/lib/python3.7/site-packages/ding/envs/env_manager/subprocess_env_manager.py", line 333, in launch self._create_state() File "/home/zck7060/anaconda3/envs/didrive/lib/python3.7/site-packages/ding/envs/env_manager/subprocess_env_manager.py", line 250, in _create_state shape = obs_space.shape AttributeError: 'NoneType' object has no attribute 'shape'

Before running the program, I had started the Carla server with ports 9000 and 9002.

I also tried other versions of DI-Engine like 0.4.0 but same error. Any idea of how this error occurs is appreciated!

Have you solved the problem?