Skip to content

Torch load issue fix with pytorch 2.6 #543

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

Merged
merged 2 commits into from
Mar 23, 2025

Conversation

ArozHada
Copy link
Contributor

@ArozHada ArozHada commented Feb 16, 2025

Pytorch 2.6 updated the torch.load function with "weights_only = True" as default.
This caused an issue with the library making any load process crash. This also caused the tests to fail for other PRs #540 and even other bot PRs, #536, #537.

I set for all torch.load functions to be "weight_only = False" instead of the default True to fix this issue.


📚 Documentation preview 📚: https://pytorch-tabular--543.org.readthedocs.build/en/543/

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 16, 2025
@manujosephv manujosephv merged commit 98ac171 into manujosephv:main Mar 23, 2025
4 checks passed
@manujosephv
Copy link
Owner

Thanks a lot @ArozHada For the PR. This was blocking other PRs and failing test cases :)

@manujosephv
Copy link
Owner

@ArozHada So, apparently, the test cases for older versions of Python and by extension PyTorch is failing cause of the new change. see here

Can you raise a new PR and have a try catch block to catch the error and try again without weights only? so that it works for older versions of PyTorch? PR #540 is failing (so will others) cause of this.

@ArozHada
Copy link
Contributor Author

Hello,
Yup, I see the problem. Would it make sense to just have the requirements changed so that Pytorch 2.6 is the default or should I catch the version of Pytorch and then use an if statement to have the correct syntax for torch.load ?

@manujosephv
Copy link
Owner

I guess the second option.. PyTorch and newer versions are typically not available in many cases. For instance you are forced to run an older version of python, or the CUDA runtimes you are working with is not latest, or the OS is not latest(like Ubuntu 20.04). All of this impacts which version of PyTorch one is working with.

So, I guess to be working for majority of people, I guess second option would be great..

@YoungAgile
Copy link

Hello, I encountered the same problem while running the code. How can I download the latest update now.

@ArozHada
Copy link
Contributor Author

@YoungAgile, if you use a python version > 3.9 and Pytorch 2.6 should work. For older versions, will try to get the fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants