-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-53453][PYTHON][ML] Unblock 'torch<2.6.0' #52197
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
Changes from 5 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -381,7 +381,7 @@ def _save_core_model(self, path: str) -> None: | |
| def _load_core_model(self, path: str) -> None: | ||
| import torch | ||
|
|
||
| lor_torch_model = torch.load(path) | ||
| lor_torch_model = torch.load(path, weights_only=False) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to have the weights_only=False . From there page "Loading un-trusted checkpoint with weights_only=False MUST never be done." https://github.com/pytorch/pytorch/security
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value of weights_only is False in Ideally, we should use weights_only=True, it will needs some investigation. Thanks for pointing it out. |
||
| self.torch_model = lor_torch_model[0] | ||
|
|
||
| def _get_extra_metadata(self) -> Dict[str, Any]: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,7 +183,8 @@ def test_save_load(self): | |
|
|
||
| # test saved torch model can be loaded by pytorch solely | ||
| lor_torch_model = torch.load( | ||
| os.path.join(local_model_path, "LogisticRegressionModel.torch") | ||
| os.path.join(local_model_path, "LogisticRegressionModel.torch"), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dito but this is for a tests so I think its ok. |
||
| weights_only=False, | ||
| ) | ||
|
|
||
| with torch.inference_mode(): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do other Dockerfiles need to be handled in separate pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch