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

How to remove the randomness to get reproducible runs #63

Open
a-mos opened this issue May 26, 2023 · 1 comment
Open

How to remove the randomness to get reproducible runs #63

a-mos opened this issue May 26, 2023 · 1 comment

Comments

@a-mos
Copy link

a-mos commented May 26, 2023

Hello! I am trying to get fully-reproducible pipeline, however with all seeds fixed i got different grad values on first iteration in single_circle.py app even with same loss value:

Fixing all seeds:

import random
import os

seed = 0
torch.set_printoptions(precision=16)
os.environ['PYTHONHASHSEED'] = str(seed)
torch.manual_seed(seed)
random.seed(seed)
np.random.seed(seed)
torch.backends.cudnn.benchmark = False
torch.use_deterministic_algorithms(True)
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.enabled = False
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.set_deterministic_debug_mode(2)

Run1 python single_circle.py

iteration: 0
loss: 6360.21044921875
radius.grad: tensor(-6679.3833007812500000)
center.grad: tensor([-16965.3789062500000000,   8691.6396484375000000])

Run2 python single_circle.py

iteration: 0
loss: 6360.21044921875
radius.grad: tensor(-6679.9208984375000000)
center.grad: tensor([-16965.9726562500000000,   8691.4550781250000000])
@tanguymagne
Copy link

Hello,
I am facing the same issue. Did you manage to solve it?
Thank you very much

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

2 participants