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

setting seed doesn't guarantee reprudicibility #105

Open
HitLuca opened this issue Dec 20, 2021 · 4 comments
Open

setting seed doesn't guarantee reprudicibility #105

HitLuca opened this issue Dec 20, 2021 · 4 comments

Comments

@HitLuca
Copy link

HitLuca commented Dec 20, 2021

Looks like setting the seed doesn't truly produce the same results. After some testing I noticed that these lines

        torch.manual_seed(seed)
        torch.backends.cudnn.benchmark = False

should be improved by adding the following statements

        torch.manual_seed(seed)
        torch.cuda.manual_seed(seed)
        torch.cuda.manual_seed_all(seed)
        np.random.seed(seed)
        random.seed(seed)
        torch.backends.cudnn.benchmark = False
        torch.backends.cudnn.deterministic = True

If this is not the case then I may have modified some files when checking out this project and removed determinism

@FaradaysInfinity
Copy link

these lines, are they in the generate.py?

i have found the same but cannot find where to add your code in

@HitLuca
Copy link
Author

HitLuca commented Jan 4, 2022

@FaradaysInfinity you can add the seed-related lines here, and the cudnn-related lines here. I rewritten most of this project from scratch, so I have everything in the same place but it shouldn't matter

@ceathar
Copy link

ceathar commented Mar 7, 2022

hi, did you find any other parameters needed to assure reproducibility? I have implemented the lines your mention, and I get very close results, but not exactly the same.

@HitLuca
Copy link
Author

HitLuca commented Mar 9, 2022

The weird thing is that even after searching online I couldn't figure out what other randomness source could be at play here

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