-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
How to properly fix random seed with pytorch lightning? #1565
Comments
Also have the same problem without DDP mode. What's your environment?
|
Could you set num workers to 0 to see if it is related to the dataloading? I had this problem before with regular pytorch and I think I solved it by setting the seed also in the dataloading, because each subprocess would have its own seed. |
@awaelchli tried and failed |
Is there a chance you could share a colab with a minimal example? If not I will try to reproduce with the pl_exampels this weekend when i get to it. |
In my case, it is caused by dropout. |
@haichao592, could you please share your solution? Thanks, |
Just call pl.seed_everything(args.seed) in self.on_fit_start() |
Hey @haichao592, thanks for your response. I tried to reproduce this issue on MNIST dataset with a model having dropouts but I did not observe this issue. Maybe they have fixed this issue in the newer versions of PL. The only thing I used differently was Here is the code in case you wanna see it (I just took it from the web for a quick check). Could you please confirm it? I just want to make sure that I would not face such issues on my project related to the fine-tuning where debugging might not be trivial as is this one. Thanks, |
For me helped setting generator argument in random_split fuction: |
For anyone in the future, I am at version 1.7.6 and it is not an issue anymore. |
What is your question?
Hello guys
I wonder how to fix seed to get reproducibility of my experiments
Right now I'm using this function before the start of the training
But it doesn't work.
I run training in DDP mode if it is somehow important.
Thanks in advance!
What's your environment?
The text was updated successfully, but these errors were encountered: