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

Seed issue with dqn.py and others #171

Closed
Tracked by #173 ...
vwxyzjn opened this issue Apr 24, 2022 · 0 comments · Fixed by #173
Closed
Tracked by #173 ...

Seed issue with dqn.py and others #171

vwxyzjn opened this issue Apr 24, 2022 · 0 comments · Fixed by #173

Comments

@vwxyzjn
Copy link
Owner

vwxyzjn commented Apr 24, 2022

Problem Description

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

cleanrl/cleanrl/dqn.py

Lines 69 to 81 in a1b5b71

def make_env(env_id, seed, idx, capture_video, run_name):
def thunk():
env = gym.make(env_id)
env = gym.wrappers.RecordEpisodeStatistics(env)
if capture_video:
if idx == 0:
env = gym.wrappers.RecordVideo(env, f"videos/{run_name}")
env.seed(seed)
env.action_space.seed(seed)
env.observation_space.seed(seed)
return env
return thunk

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

The correct implementation should be

envs = gym.vector.SyncVectorEnv([make_env(args.env_id, args.seed, 0, args.capture_video, run_name)]) 
vwxyzjn added a commit that referenced this issue Apr 24, 2022
vwxyzjn added a commit that referenced this issue May 9, 2022
* Fix the seed issue: see #171

* Quick fix

* log `episodic_length`

* Fix #172

* Fix #148 and #172-style problem for SAC

* Add benchmark scripts

* add sac script

* Removes gradient clipping reference

* use the latest reproduction script

* Remove past reproducibility script

* update documentation
@vwxyzjn vwxyzjn mentioned this issue May 31, 2022
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant