torch2100 extras: pin torch explicitly now that xformers can be skipped

The torch2100 leaves relied on the xformers 0.0.34 wheel's transitive
torch==2.10.0 pin as their only torch constraint. With the new ARM64
platform_machine markers those leaves contributed no requirement at all
off x86-64, so a cu-torch2100 wrapper install on Linux aarch64 or Windows
ARM64 proceeded unpinned and resolved a newer torch. Pin torch==2.10.0
explicitly (identical to the transitive pin, so x86-64 resolution is
unchanged): Linux aarch64 installs the real 2.10.0 aarch64 wheels and
Windows ARM64 fails loudly instead of silently drifting.
This commit is contained in:
Daniel Han 2026-07-13 02:52:05 +00:00
commit 8997bf020a
2 changed files with 26 additions and 0 deletions

View file

@ -326,14 +326,24 @@ cu130onlytorch291 = [
"xformers @ https://download.pytorch.org/whl/cu130/xformers-0.0.33.post2-cp39-abi3-win_amd64.whl ; (sys_platform == 'win32')",
]
cu126onlytorch2100 = [
# The explicit torch pin replicates the xformers 0.0.34 wheel's transitive
# torch==2.10.0 pin on machines where the x86-64-only wheel is skipped
# (Linux aarch64 has real 2.10.0 wheels; Windows ARM64 fails loudly).
# Without it an ARM64 install of the cu126-torch2100 wrapper would proceed
# unpinned and resolve a newer torch.
"torch==2.10.0",
"xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.34-cp39-abi3-manylinux_2_28_x86_64.whl ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",
"xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.34-cp39-abi3-win_amd64.whl ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",
]
cu128onlytorch2100 = [
# Same explicit torch pin as cu126onlytorch2100 above.
"torch==2.10.0",
"xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.34-cp39-abi3-manylinux_2_28_x86_64.whl ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",
"xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.34-cp39-abi3-win_amd64.whl ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",
]
cu130onlytorch2100 = [
# Same explicit torch pin as cu126onlytorch2100 above.
"torch==2.10.0",
"xformers @ https://download.pytorch.org/whl/cu130/xformers-0.0.34-cp39-abi3-manylinux_2_28_x86_64.whl ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",
"xformers @ https://download.pytorch.org/whl/cu130/xformers-0.0.34-cp39-abi3-win_amd64.whl ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')",
]

View file

@ -86,3 +86,19 @@ def test_torch2110_wrapper_references_matching_leaf(cuda: str, variant: str):
"bitsandbytes>=0.45.5,!=0.46.0,!=0.48.0",
f"unsloth[{cuda}onlytorch2110]",
]
@pytest.mark.parametrize("cuda", ["cu126", "cu128", "cu130"])
def test_cuda12_torch2100_keeps_torch_pinned_off_x86(cuda: str):
# The torch2100 leaves used to rely on the xformers 0.0.34 wheel's transitive
# torch==2.10.0 pin. Now that the x86-64-only wheels carry platform_machine
# markers, the leaf must pin torch explicitly so an ARM64 install stays on
# torch 2.10 (Linux aarch64 wheels exist) or fails loudly (Windows ARM64)
# instead of resolving an unpinned newer torch.
reqs = _reqs(_extra(f"{cuda}onlytorch2100"))
(torch_req,) = reqs["torch"]
assert str(torch_req.specifier) == "==2.10.0", (
f"{cuda}onlytorch2100 must pin torch==2.10.0 for machines where the "
f"x86-64-only xformers wheel (and its transitive pin) is skipped"
)
assert torch_req.marker is None, "the torch pin must apply on every machine"