thu-ml / tianshou

An elegant PyTorch deep reinforcement learning library.
https://tianshou.org
MIT License
7.79k stars 1.12k forks source link

cannot visualize result when testing mujoco #853

Closed zks204 closed 11 months ago

zks204 commented 1 year ago

I installed gym, mujoco version 2.10, with either py37 & py38, pyglet version downgrade to 1.2.4. When testing with trained policy, if I set render=0.03, env.render() will raise NotImplementedError which doesn't allow me to visualize the result. However, if I set render=0 with no visualization, the program runs successfully. Please help take a look, very appreciate!

Trinkle23897 commented 1 year ago

https://github.com/thu-ml/tianshou/blob/e7c2c3711eb4f4430ff36e6df1cf8630714815ad/examples/mujoco/mujoco_env.py#L13-L37

I guess your program ran into the first case using envpool. EnvPool doesn't support rendering results because of thgoughput concerns. You can either uninstall envpool or change the above code to let it fall into the second case using ShmemVectorEnv.

MischaPanch commented 11 months ago

Resolved