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

What is the best practice for reproducibility? #701

Open
Altriaex opened this issue Apr 11, 2024 · 3 comments
Open

What is the best practice for reproducibility? #701

Altriaex opened this issue Apr 11, 2024 · 3 comments

Comments

@Altriaex
Copy link

Hi, I am trying to improve the reproducibility of my experiments.

In this page https://metadrive-simulator.readthedocs.io/en/latest/training.html# the set_random_seed function from stable-baselines3 is used. However, I notice that when resetting the MetaDriveEnv, _reset_global_seed function computes its own seed, if I do not pass a seed explicitly to the env.reset() function call. So each time I run the program the agent gets different scenario_index.

After reading base_env.py, I see that there is a class attribute _DEBUG_RANDOM_SEED that play the role of the real seed. After setting it to some integer (e.g. 0) I manage to have deterministic scenario_index. But modifying such a class attribute can be tricky when we use multiple environments. So I wonder what is the best practice for reproducibility.

@QuanyiLi
Copy link
Member

I am afraid that the only way is to pass a seed to env.reset() It controls all random behaviors of the simulator. Could you tell us what problem blocks you from doing so?

@Altriaex
Copy link
Author

It becomes a bit tricky when we use multiple envs via, e.g., stable-baselines3's SubProc, because the base environments (i.e. MetaDriveEnv) are reset automatically by SubProc. Such resetting behavior assumes no arguments.

@pengzhenghao
Copy link
Member

pengzhenghao commented Apr 16, 2024 via email

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

No branches or pull requests

3 participants