diff --git a/pyproject.toml b/pyproject.toml index 927cf7612c..28ed380266 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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')", ] diff --git a/tests/test_torch2110_cuda_extras.py b/tests/test_torch2110_cuda_extras.py index b9524d6e4b..19d40560f4 100644 --- a/tests/test_torch2110_cuda_extras.py +++ b/tests/test_torch2110_cuda_extras.py @@ -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"