Skip to content

[SPARK-53453][PYTHON][ML] Unblock 'torch<2.6.0'#52197

Closed
zhengruifeng wants to merge 6 commits intoapache:masterfrom
zhengruifeng:torch_280
Closed

[SPARK-53453][PYTHON][ML] Unblock 'torch<2.6.0'#52197
zhengruifeng wants to merge 6 commits intoapache:masterfrom
zhengruifeng:torch_280

Conversation

@zhengruifeng
Copy link
Copy Markdown
Contributor

@zhengruifeng zhengruifeng commented Sep 2, 2025

What changes were proposed in this pull request?

Unblock 'torch<2.6.0'

Why are the changes needed?

to test with latest torch

Does this PR introduce any user-facing change?

No

How was this patch tested?

CI

Was this patch authored or co-authored using generative AI tooling?

No

RUN python3.11 -m pip install --ignore-installed blinker>=1.6.2 # mlflow needs this
RUN python3.11 -m pip install $BASIC_PIP_PKGS unittest-xml-reporting $CONNECT_PIP_PKGS && \
python3.11 -m pip install 'torch<2.6.0' torchvision --index-url https://download.pytorch.org/whl/cpu && \
python3.11 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

Copy link
Copy Markdown
Contributor

@LuciferYang LuciferYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are fine with me.

Copy link
Copy Markdown
Contributor

@WeichenXu123 WeichenXu123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Nice. Thank you, @zhengruifeng and all.

Merged to master for Apache Spark 4.1.0.

@zhengruifeng zhengruifeng deleted the torch_280 branch September 3, 2025 00:24
import torch

lor_torch_model = torch.load(path)
lor_torch_model = torch.load(path, weights_only=False)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value of weights_only is False in <2.6.0. And the default value was changed to True since 2.6.0.
This PR keeps the behavior.

Ideally, we should use weights_only=True, it will needs some investigation. Thanks for pointing it out.

# 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"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito but this is for a tests so I think its ok.

zhengruifeng added a commit that referenced this pull request Sep 5, 2025
### What changes were proposed in this pull request?
Update `dev/requirements`

### Why are the changes needed?
follow up of #52197

### Does this PR introduce _any_ user-facing change?
no

### How was this patch tested?
ci

### Was this patch authored or co-authored using generative AI tooling?
no

Closes #52244 from zhengruifeng/dev_torch.

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
### What changes were proposed in this pull request?
Unblock 'torch<2.6.0'

### Why are the changes needed?
to test with latest torch

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
CI

### Was this patch authored or co-authored using generative AI tooling?
No

Closes apache#52197 from zhengruifeng/torch_280.

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
### What changes were proposed in this pull request?
Update `dev/requirements`

### Why are the changes needed?
follow up of apache#52197

### Does this PR introduce _any_ user-facing change?
no

### How was this patch tested?
ci

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#52244 from zhengruifeng/dev_torch.

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants