diff --git a/tests/test_torch2110_cuda_extras.py b/tests/test_torch2110_cuda_extras.py index c110bad682..2ec0bb701c 100644 --- a/tests/test_torch2110_cuda_extras.py +++ b/tests/test_torch2110_cuda_extras.py @@ -11,12 +11,16 @@ Hermetic: only parses pyproject.toml, no network or install. from __future__ import annotations -import tomllib from pathlib import Path import pytest from packaging.requirements import Requirement +try: # tomllib is stdlib on Python 3.11+; older interpreters need the tomli backport. + import tomllib +except ModuleNotFoundError: # pragma: no cover - Python 3.9 / 3.10 + tomllib = pytest.importorskip("tomli") + PYPROJECT = Path(__file__).resolve().parents[1] / "pyproject.toml" _TORCH_TRIO = ("torch", "torchvision", "torchaudio") diff --git a/unsloth/_auto_install.py b/unsloth/_auto_install.py index 13f5167856..396fa34d12 100644 --- a/unsloth/_auto_install.py +++ b/unsloth/_auto_install.py @@ -41,4 +41,8 @@ else: raise RuntimeError(f"Torch = {v} too new!") if v > V('2.6.9') and cuda not in ("11.8", "12.6", "12.8", "13.0"): raise RuntimeError(f"CUDA = {cuda} not supported!") if v >= V('2.10.0') and cuda not in ("12.6", "12.8", "13.0"): raise RuntimeError(f"Torch 2.10 requires CUDA 12.6, 12.8, or 13.0! Got CUDA = {cuda}") x = x.format(cuda.replace(".", ""), "-ampere" if False else "") # is_ampere is broken due to flash-attn -print(f'pip install --upgrade pip setuptools wheel && pip install --no-deps git+https://github.com/unslothai/unsloth-zoo.git && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git" --no-build-isolation') \ No newline at end of file +# The cu126/cu128 torch2110 extras pin torch==2.11.0+cuNNN, a local build that only +# resolves from the matching PyTorch CUDA index (torch 2.11's default PyPI wheel is +# CUDA 13.0), so add that index for exactly those CUDA-12 torch 2.11 environments. +extra_index = f' --extra-index-url https://download.pytorch.org/whl/cu{cuda.replace(".", "")}' if (x.endswith('-torch2110') and cuda in ("12.6", "12.8")) else '' +print(f'pip install --upgrade pip setuptools wheel && pip install --no-deps git+https://github.com/unslothai/unsloth-zoo.git && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git" --no-build-isolation{extra_index}') \ No newline at end of file