vwxyzjn / cleanrl

High-quality single file implementation of Deep Reinforcement Learning algorithms with research-friendly features (PPO, DQN, C51, DDPG, TD3, SAC, PPG)
http://docs.cleanrl.dev
Other
5.54k stars 631 forks source link

Seed issue with `dqn.py` and others #171

Closed vwxyzjn closed 2 years ago

vwxyzjn commented 2 years ago

Problem Description

Currently, dqn.py and other scripts incorrectly set the environment seed to be always 0

https://github.com/vwxyzjn/cleanrl/blob/a1b5b71134d7a576992488d7f42cb75f68117243/cleanrl/dqn.py#L69-L81 https://github.com/vwxyzjn/cleanrl/blob/a1b5b71134d7a576992488d7f42cb75f68117243/cleanrl/dqn.py#L135

The correct implementation should be

envs = gym.vector.SyncVectorEnv([make_env(args.env_id, args.seed, 0, args.capture_video, run_name)])