Conversation
torch 2.13 hard-removed the named tensor feature (pytorch/pytorch#173895), so Tensor.align_as, align_to, refine_names and rename no longer exist. The auto registration table in default_torch_ops.py dereferences them while building a module-level dict literal, which makes `import thunder` fail outright there with `AttributeError: type object 'Tensor' has no attribute 'align_as'`. Gate those four entries on a new `_TORCH_GREATER_EQUAL_2_13` constant, and add thunder/constants.py as a home for such checks, following litgpt/constants.py.
import thunder on PyTorch 2.13 (named tensor removal)
torch/testing/_internal/common_utils.py reads the deprecated torch._dynamo.config.inline_inbuilt_nn_modules as a default argument, so the FutureWarning fires when the module is imported. With `error::FutureWarning` set, that fails collection of all the distributed tests. Ignore that one message; every other FutureWarning stays fatal.
bhimrazy
requested review from
k223kim,
lianakoleva and
tejapulagam
as code owners
September 15, 2026 10:21
torchaudio is not imported anywhere in the repo, but CI's adjust-torch-versions.py
pins it in lockstep with torch. torchaudio stopped tracking torch releases after
2.11 ('compatible with future versions of torch'), so on torch 2.14 CI resolves
torchaudio==2.14.0, which does not exist, and every job fails at dependency
install before running a single test.
… into fix/torch-213-named-tensor-import
has_names went away in the same named-tensor removal as align_as/align_to/ refine_names/rename, so import still failed on torch 2.13 without it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
import thunderfailing on PyTorch 2.13.torch 2.13 removed the named tensor feature, so
Tensor.align_as,align_to,has_names,refine_namesandrenameare gone.default_torch_ops.pyreferences all five insidetorch_auto_registered_ops, a module-level dict literal — so the lookups happen at import time and the whole package fails to load:This gates those five entries on a new
_TORCH_GREATER_EQUAL_2_13constant so they are simply not registered on torch 2.13+.Note
Stacked on #2830 and #2831, both merged into this branch so CI here is not drowned by failures that belong to those. Diff shrinks as they land.
How it surfaced
Downstream, in litgpt#2295. litgpt's
constants.pyprobes thunder withRequirementCache("thunder"); on torch 2.13 that probe raises, breaking all CPU test collection on Linux. That PR capstorch<2.13as a stopgap and notes it should be dropped once thunder supports 2.13 — this is the thunder-side fix. thunder itself is unpinned (torch >=2.7.1), so the break is latent for anyone on 2.13; litgpt just hit it first.The removal landed via ghstack (see pytorch#173895, which shows closed rather than merged). Its
torch/overrides.pydiff is the authoritative list:Tensor.align_as,align_to,has_names,names,refine_names,rename,_update_names, plustorch.align_tensors. Of those, only the five above ever appear in this repo.