Skip to content

Conversation

vkuzo
Copy link
Contributor

@vkuzo vkuzo commented Sep 2, 2025

Summary:

torch.__version__ has unexpected behavior when comparing to a string:

(Pdb) torch.__version__
'2.9.0.dev20250902+cu128'
(Pdb) str(torch.__version__)
'2.9.0.dev20250902+cu128'
(Pdb) '2.9.0.dev20250902+cu128' >= '2.9'
True
(Pdb) torch.__version__ >= '2.9'
False
(Pdb) torch.__version__ >= (2, 9)
False
(Pdb) torch.__version__ >= (2, 9, 0)
False
(Pdb) str(torch.__version__) >= '2.9'
True

To unblock the release, for now compare str(torch.__version__) to force the behavior we want for torch==2.9.x. We should make this more robust, saving that for a future PR.

Test Plan:

1. install torchao 0.13.0 from pip
2. install torch 2.8.0, verify torchao imports without errors
3. isntall torch 2.9.x, verify torchao imports correctly and a warning
   for skipping c++ kernel import is shown

Reviewers:

Subscribers:

Tasks:

Tags:

Summary:

`torch.__version__` has unexpected behavior when comparing to a string:

```python
(Pdb) torch.__version__
'2.9.0.dev20250902+cu128'
(Pdb) str(torch.__version__)
'2.9.0.dev20250902+cu128'
(Pdb) '2.9.0.dev20250902+cu128' >= '2.9'
True
(Pdb) torch.__version__ >= '2.9'
False
(Pdb) torch.__version__ >= (2, 9)
False
(Pdb) torch.__version__ >= (2, 9, 0)
False
(Pdb) str(torch.__version__) >= '2.9'
True
```

To unblock the release, for now compare `str(torch.__version__)` to
force the behavior we want for `torch==2.9.x`. We should make this
more robust, saving that for a future PR.

Test Plan:

```
1. install torchao 0.13.0 from pip
2. install torch 2.8.0, verify torchao imports without errors
3. isntall torch 2.9.x, verify torchao imports correctly and a warning
   for skipping c++ kernel import is shown
```

Reviewers:

Subscribers:

Tasks:

Tags:
Copy link

pytorch-bot bot commented Sep 2, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2922

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ No Failures, 9 Pending

As of commit 26f6546 with merge base f5a1d08 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 2, 2025
@vkuzo vkuzo added the topic: bug fix Use this tag for PRs that fix bugs label Sep 2, 2025
@vkuzo vkuzo merged commit 266f749 into main Sep 2, 2025
17 of 19 checks passed
vkuzo added a commit that referenced this pull request Sep 2, 2025
Summary:

`torch.__version__` has unexpected behavior when comparing to a string:

```python
(Pdb) torch.__version__
'2.9.0.dev20250902+cu128'
(Pdb) str(torch.__version__)
'2.9.0.dev20250902+cu128'
(Pdb) '2.9.0.dev20250902+cu128' >= '2.9'
True
(Pdb) torch.__version__ >= '2.9'
False
(Pdb) torch.__version__ >= (2, 9)
False
(Pdb) torch.__version__ >= (2, 9, 0)
False
(Pdb) str(torch.__version__) >= '2.9'
True
```

To unblock the release, for now compare `str(torch.__version__)` to
force the behavior we want for `torch==2.9.x`. We should make this
more robust, saving that for a future PR.

Test Plan:

```
1. install torchao 0.13.0 from pip
2. install torch 2.8.0, verify torchao imports without errors
3. isntall torch 2.9.x, verify torchao imports correctly and a warning
   for skipping c++ kernel import is shown
```

Reviewers:

Subscribers:

Tasks:

Tags:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: bug fix Use this tag for PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants