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

Warning on float64 training with PyTorch 2.1 #306

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Warning on float64 training with PyTorch 2.1 #306

merged 2 commits into from
Jan 24, 2024

Conversation

ilyes319
Copy link
Contributor

@ilyes319 ilyes319 commented Jan 24, 2024

PyTorch 2.1 has a known bug preventing training in float64: https://discuss.pytorch.org/t/tensors-of-the-same-index-must-be-on-the-same-device-and-the-same-dtype-except-step-tensors-that-can-be-cpu-and-float32-notwithstanding/190335

There are three workarounds:

  • Downgrade to PyTorch 2.0 (the current PR)
  • Select foreach = False in the optimizer but this downgrades the computational performance.
  • Upcast manually all tensors to float64 by hand instead of doing torch.set_default_dtype(torch.float64).

As PyTorch seems to fix that in the next release, I recommend just making the first point. If it is not fixed in 2.2, then we should try the last point.

@ilyes319 ilyes319 merged commit 88d49f9 into main Jan 24, 2024
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

Successfully merging this pull request may close these issues.

1 participant