-
Notifications
You must be signed in to change notification settings - Fork 32
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
Same seed yields different results on GPU #5
Comments
Looks like this is caused by some non-deterministic CUDA functions - since when running the same seed on the CPU the results are identical. From https://pytorch.org/docs/stable/notes/randomness.html:
|
Try torch.backends.cudnn.deterministic = True ? I use this all the time, appears to save memory. |
Ah, sorry I didn't mention that of course I had tried all the usual settings mentioned in the docs. It does not help. |
Oh yes... good to know. |
It's good to know the CPU results are identical, that rules out issues & bugs directly in this library ;-) It's not clear to me what is causing the non-determinism on GPU. It may be that the L-BFGS optimizer itself also introduces some non-determinism. Testing a plain SGD optimizer would rule that out... |
I had first suspected the LBFGS solver and tentatively replaced it with Adam. The results look like crap, but they also differ when run on CUDA with the same seed. I forgot to quote the most important line from that "Reprocibility" link above:
** It's a pity since I was trying to do some seed interpolation animations as well as a sliding window test for getting larger textures than fit in the GPU, but both of them do not work with CUDA since they change on every iteration. |
The interpolation would not be deterministic anyway, as soon as you change the content of the starting tensor, it would introduce different numbers and hence instability. As for larger textures, I have a variety of code for tiling but not with gram matrices yet... I will see what's possible! |
Running texturizer with the same seed results in slightly different results when repeated. I would expect the same seed to generated the identical texture every time. Here are three examples:
The text was updated successfully, but these errors were encountered: