NM512 / dreamerv3-torch

Implementation of Dreamer v3 in pytorch.
MIT License
422 stars 96 forks source link

[Feature Request] Add “set seed everywhere” feature to ensure reproducibility of experiments #34

Closed ygjldd closed 1 year ago

ygjldd commented 1 year ago

Hi, Thanks very much for this implementation! Currently, the project does not have a consistent way of setting the random seed for torch and other random number generators. This can lead to different results for the same experiment. To address this issue, I propose to add a feature that allows the user to set the seed for all relevant modules and libraries at the beginning of the experiment. Like this : https://github.com/thuml/Flowformer/blob/bc8c4d22b48dde62519f086ba6a9f22463277741/Flowformer_RL/utils.py#L16 This way, we can ensure that the results are reproducible and reliable. I hope this suggestion will be helpful for the project.

NM512 commented 1 year ago

Hi, Thank you for your suggestion! I've added the option for a deterministic run at this commit.

You can use it like this:

python dreamer.py --config dmc_vision --logdir ./logdir/test --deterministic_run True

I was able to verify deterministic results among the DMC proprio, DMC vision, Atari100k, and MemoryMaze environments. However, it seems that the deterministic run is not supported for the Minecraft and Crafter environments. Please check this issue if you want to know the status of support for full-deterministic runs in MineRL.