-
Notifications
You must be signed in to change notification settings - Fork 106
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
Comments
I am afraid that the only way is to pass a seed to |
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. |
One solution is to wrap the environment with a global config call “global_seed” and instantiate a RNG with that seed and automatically generate next interger in each env.reset call from SubProcEnv and auto fill that integer into env.reset(random_seed=..)
Best,
Zhenghao
… On Apr 15, 2024, at 7:17 PM, Altriaex ***@***.***> wrote:
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.
—
Reply to this email directly, view it on GitHub <#701 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AFJNUE5WXN4GYHRGLCPSCVDY5SC2ZAVCNFSM6AAAAABGBQAMP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYGEYTEMZQGY>.
You are receiving this because you are subscribed to this thread.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: