From 1cde9cdd3cb29d88043ca3e343a572725a634ee4 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 30 Jun 2025 23:11:57 -0700 Subject: [PATCH 01/16] Remove stale bot --- .github/workflows/stale.yml | 2 +- use_existing_torch.py | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 use_existing_torch.py diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index d5ea2a3372..80cce7793b 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -23,7 +23,7 @@ jobs: For faster response times, please post on our Reddit server - https://www.reddit.com/r/unsloth or our Discord - https://discord.com/invite/unsloth # The number of days of inactivity before an issue is considered stale. - days-before-issue-stale: 10 + days-before-issue-stale: 9999 # Set to -1 to never close stale issues. days-before-issue-close: -1 diff --git a/use_existing_torch.py b/use_existing_torch.py deleted file mode 100644 index 0f1fe66e91..0000000000 --- a/use_existing_torch.py +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project and Unsloth project -# Copying from https://github.com/vllm-project/vllm/blob/main/use_existing_torch.py - -import glob - -requires_files = glob.glob('requirements/*.txt') -requires_files += ["pyproject.toml"] -for file in requires_files: - print(f">>> cleaning {file}") - with open(file) as f: - lines = f.readlines() - if "torch" in "".join(lines).lower(): - print("removed:") - with open(file, 'w') as f: - for line in lines: - if 'torch' not in line.lower(): - f.write(line) - else: - print(line.strip()) - print(f"<<< done cleaning {file}") - print() From ce923e31dc13df820469a18901be8632bd758486 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 30 Jun 2025 23:13:33 -0700 Subject: [PATCH 02/16] Update _utils.py --- unsloth/models/_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 5016e1be3a..9f9a3a46a6 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -77,7 +77,7 @@ import contextlib import re import warnings, subprocess, re, inspect, psutil, os, math from unsloth_zoo.utils import Version -from unsloth import DEVICE_TYPE +from unsloth_zoo import DEVICE_TYPE from unsloth_zoo.tokenizer_utils import ( patch_tokenizer as _patch_tokenizer, @@ -553,8 +553,6 @@ UNSLOTH_COMPILE_IGNORE_ERRORS = os.environ.get("UNSLOTH_COMPILE_IGNORE_ERRORS", import functools from torch._inductor.runtime.hints import DeviceProperties -from unsloth import DEVICE_TYPE - @functools.lru_cache(None) def is_big_gpu(index) -> bool: From 0ceeab0821447d09a3432a27d86bf288d6cb6c6a Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:05:56 -0700 Subject: [PATCH 03/16] Fix setup.py --- pyproject.toml | 5 +- requirements/common.txt | 12 +- requirements/cuda.txt | 6 +- setup.py | 284 +++++++++++++++++++++------------------- 4 files changed, 161 insertions(+), 146 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fb066b8ed3..ea86bfd20e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,9 +6,6 @@ requires = [ "packaging>=24.2", "setuptools>=77.0.3,<80.0.0", "setuptools-scm>=8.0", - "torch==2.7.0", - "wheel", - "jinja2" ] build-backend = "setuptools.build_meta" @@ -17,7 +14,7 @@ name = "unsloth" description = "2-5X faster LLM finetuning" readme = "README.md" requires-python = ">=3.9,<3.13" -dynamic = [ "version", "dependencies", "optional-dependencies"] +dynamic = ["version", "dependencies", "optional-dependencies"] license = { file = "LICENSE" } keywords = ["ai", "llm",] authors = [ diff --git a/requirements/common.txt b/requirements/common.txt index 61c547d7d1..6fa760103b 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -1,15 +1,21 @@ -unsloth_zoo>=2025.6.2 -packaging +unsloth_zoo>=2025.6.7 +packaging>=24.2 tyro -transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2 +transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3 datasets>=3.4.1 sentencepiece>=0.2.0 tqdm +tyro psutil wheel>=0.42.0 numpy accelerate>=0.34.1 trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0 peft>=0.7.1,!=0.11.0 +protobuf huggingface_hub hf_transfer +pillow +regex +msgspec +jinja2 diff --git a/requirements/cuda.txt b/requirements/cuda.txt index 8028f64124..5a1e343d74 100644 --- a/requirements/cuda.txt +++ b/requirements/cuda.txt @@ -1,7 +1,9 @@ # Common dependencies -r common.txt -torch +torch<=2.7.0 torchaudio torchvision -xformers +xformers<=0.0.30 +triton ; platform_system == 'Linux' +triton_windows ; platform_system == 'Windows' diff --git a/setup.py b/setup.py index 0f4a86330e..e75a10d409 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,51 @@ -# Copid and modified based on https://github.com/vllm-project/vllm/blob/main/setup.py -# SPDX-License-Identifier: Apache-2.0 +# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Modified from https://github.com/vllm-project/vllm/blob/main/setup.py -import ctypes import importlib.util -import json -import logging import os -import re import subprocess import sys from pathlib import Path -from shutil import which -import shutil - -import torch from packaging.version import Version, parse -from setuptools import Extension, setup -from setuptools.command.build_ext import build_ext -from setuptools_scm import get_version -from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME - +from setuptools import setup from setuptools.command.install import install -# This arg is for multi-device -UNSLOTH_TARGET_DEVICE = os.environ.get('UNSLOTH_TARGET_DEVICE', 'cuda') +ROOT_DIR = Path(__file__).parent +UNSLOTH_TARGET_DEVICE = os.environ.get("UNSLOTH_TARGET_DEVICE", "cuda") +IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) +UNSLOTH_VERSION = load_module_from_path('ver', os.path.join(ROOT_DIR, 'unsloth', 'version.py')) + +# Try importing torch +HAS_TORCH = False +HAS_CUDA = True +HAS_HIP = False +CUDA_HOME = None +ROCM_HOME = None +torch = None +if importlib.util.find_spec("torch") is not None: + try: + import torch + from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME + HAS_TORCH = True + HAS_CUDA = (torch.version.cuda is not None) + HAS_HIP = (torch.version. hip is not None) + + except Exception as e: + print(f"Unsloth: Importing torch failed with error = {str(e)}.") + HAS_TORCH = False +pass def load_module_from_path(module_name, path): @@ -32,25 +54,10 @@ def load_module_from_path(module_name, path): sys.modules[module_name] = module spec.loader.exec_module(module) return module - -ROOT_DIR = Path(__file__).parent +pass -# cannot import version directly because it depends on unsloth, -# which is not installed yet -ver = load_module_from_path('ver', os.path.join(ROOT_DIR, 'unsloth', 'version.py')) - -def _is_cuda() -> bool: - has_cuda = torch.version.cuda is not None - return UNSLOTH_TARGET_DEVICE == "cuda" and has_cuda - - -def _is_hip() -> bool: - return (UNSLOTH_TARGET_DEVICE == "cuda" - or UNSLOTH_TARGET_DEVICE == "rocm") and torch.version.hip is not None - - -def get_nvcc_cuda_version() -> Version: +def get_nvcc_cuda_version(): """Get the CUDA version from nvcc. Adapted from https://github.com/NVIDIA/apex/blob/8b7a1ff183741dd8f9b87e7bafd04cfde99cea28/setup.py @@ -62,11 +69,13 @@ def get_nvcc_cuda_version() -> Version: release_idx = output.index("release") + 1 nvcc_cuda_version = parse(output[release_idx].split(",")[0]) return nvcc_cuda_version +pass def get_rocm_version(): # Get the Rocm version from the ROCM_HOME/bin/librocm-core.so # see https://github.com/ROCm/rocm-core/blob/d11f5c20d500f729c393680a01fa902ebf92094b/rocm_version.cpp#L21 + import ctypes try: librocm_core_file = Path(ROCM_HOME) / "lib" / "librocm-core.so" if not librocm_core_file.is_file(): @@ -90,37 +99,38 @@ def get_rocm_version(): return None except Exception: return None +pass -def get_unsloth_version() -> str: - version = ver.__version__ +def get_unsloth_version(): + version = UNSLOTH_VERSION.__version__ if version is None: raise RuntimeError("unsloth version not found") sep = "+" if "+" not in version else "." # dev versions might contain + - if _is_cuda(): + if HAS_CUDA: cuda_version = str(get_nvcc_cuda_version()) cuda_version_str = cuda_version.replace(".", "")[:3] # skip this for source tarball, required for pypi if "sdist" not in sys.argv: version += f"{sep}cu{cuda_version_str}" - elif _is_hip(): + elif HAS_HIP: # Get the Rocm Version rocm_version = get_rocm_version() or torch.version.hip if rocm_version: version += f"{sep}rocm{rocm_version.replace('.', '')[:3]}" else: raise RuntimeError("Unknown runtime environment") - return version +pass -def get_requirements() -> list[str]: + +def get_requirements(): """Get Python package dependencies from requirements.txt.""" requirements_dir = ROOT_DIR / "requirements" - - def _read_requirements(filename: str) -> list[str]: + def _read_requirements(filename): with open(requirements_dir / filename) as f: requirements = f.read().strip().split("\n") resolved_requirements = [] @@ -131,110 +141,27 @@ def get_requirements() -> list[str]: "#") and line.strip() != "": resolved_requirements.append(line) return resolved_requirements - - if _is_cuda(): + pass + if HAS_CUDA: requirements = _read_requirements("cuda.txt") - elif _is_hip(): + elif HAS_HIP: requirements = _read_requirements("rocm.txt") else: requirements = _read_requirements("common.txt") raise ValueError( "Unsupported platform, please use CUDA, ROCm, " ) - return requirements +pass -INSTINCT_ARCH=("gfx942", "gfx90a") -RADEON_ARCH=("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201") - - -class RocmExtraInstallCommand(install): - def run(self): - - if os.path.exists('thirdparties'): - shutil.rmtree('thirdparties') - - os.mkdir('thirdparties') - os.chdir('thirdparties') - - # Extract ROCm GPU arch from environment variable. If unset, then detect ROCm arch from rocminfo - # Refer to https://github.com/bitsandbytes-foundation/bitsandbytes/blob/1abd5e781013a085f86586b30a248dc769909668/bitsandbytes/cuda_specs.py#L81 - # TODO(billishyahao): need to triage rocminfo unavailable observation from https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1444 - rocm_arch = os.environ.get('ROCM_ARCH', None) - if rocm_arch is None: - try: - result = subprocess.run(["rocminfo"], capture_output=True, text=True) - match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout) - if match: - rocm_arch = f"gfx{match.group(1)}" - print(f"Automatically detected ROCm GPU architecture: {rocm_arch}") - else: - print("Skipping ROCm extra install, cannot detect ROCm arch automatically...") - install.run(self) - return - except Exception as e: - print("Could not detect ROCm GPU architecture: {e}") - if torch.cuda.is_available(): - print("ROCm GPU architecture detection failed despite ROCm being available...") - install.run(self) - return - - # flash-attention - # MI3xx has both CK backend and Triton backend. - import importlib - if importlib.util.find_spec("flash_attn") is None: - print("Installing flash-attention...") - if rocm_arch in INSTINCT_ARCH: - subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) - os.chdir('flash-attention') - num_jobs = os.cpu_count() - 1 - subprocess.check_call(['pip', 'install', '-v', '.', f'MAX_JOBS={num_jobs}'], shell=True) - os.chdir('..') - # Only Triton backend supports Radeon GPUs - elif rocm_arch in RADEON_ARCH: - subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) - os.chdir('flash-attention') - subprocess.check_call(['git', 'checkout', 'main_perf']) - subprocess.check_call(['FLASH_ATTENTION_TRITON_AMD_ENABLE="TRUE"', 'python', 'setup.py', 'install', ], shell=True) - os.chdir('..') - - # Comment out the following if you need xformers installed. - # # only install xformers in Instinct GPUs - # if importlib.util.find_spec("xformers") is None: - # print("Installing xformers...") - # if rocm_arch in INSTINCT_ARCH: - # subprocess.check_call(['git', 'clone', 'https://github.com/ROCm/xformers.git']) - # os.chdir('xformers') - # subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive']) - # os.environ['PYTORCH_ROCM_ARCH'] = rocm_arch - # subprocess.check_call(['python', 'setup.py', 'install']) - # os.chdir('..') - - # bitsandbytes - if importlib.util.find_spec("bitsandbytes") is None: - print("Installing bitsandbytes...") - subprocess.check_call(['git', 'clone', '--recurse-submodules', 'https://github.com/ROCm/bitsandbytes']) - os.chdir('bitsandbytes') - subprocess.check_call(['git', 'checkout', 'rocm_enabled_multi_backend']) - subprocess.check_call(['pip', 'install', '-r', 'requirements-dev.txt']) - subprocess.check_call(['cmake', '-DCOMPUTE_BACKEND=hip', '-S', '.']) # Add -DBNB_ROCM_ARCH if needed - subprocess.check_call(['make']) - subprocess.check_call(['pip', 'install', '.']) - os.chdir('..') - - os.chdir('..') - - # Continue with regular install - install.run(self) - package_data = { "unsloth": [ "py.typed", ] } -extras_require = { +extras_requires = { "triton" : [ "triton-windows ; platform_system == 'Windows'", ], @@ -829,16 +756,99 @@ extras_require = { cmdclass = {} -if _is_hip(): +if HAS_HIP: + class RocmExtraInstallCommand(install): + def run(self): + import re + import shutil + INSTINCT_ARCH = ("gfx942", "gfx90a") + RADEON_ARCH = ("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201") + + if os.path.exists('thirdparties'): + shutil.rmtree('thirdparties') + + os.mkdir('thirdparties') + os.chdir('thirdparties') + + # Extract ROCm GPU arch from environment variable. If unset, then detect ROCm arch from rocminfo + # Refer to https://github.com/bitsandbytes-foundation/bitsandbytes/blob/1abd5e781013a085f86586b30a248dc769909668/bitsandbytes/cuda_specs.py#L81 + # TODO(billishyahao): need to triage rocminfo unavailable observation from https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1444 + rocm_arch = os.environ.get('ROCM_ARCH', None) + if rocm_arch is None: + try: + result = subprocess.run(["rocminfo"], capture_output=True, text=True) + match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout) + if match: + rocm_arch = f"gfx{match.group(1)}" + print(f"Automatically detected ROCm GPU architecture: {rocm_arch}") + else: + print("Skipping ROCm extra install, cannot detect ROCm arch automatically...") + install.run(self) + return + except Exception as e: + print("Could not detect ROCm GPU architecture: {e}") + if torch.cuda.is_available(): + print("ROCm GPU architecture detection failed despite ROCm being available...") + install.run(self) + return + + # flash-attention + # MI3xx has both CK backend and Triton backend. + if importlib.util.find_spec("flash_attn") is None: + print("Installing flash-attention...") + if rocm_arch in INSTINCT_ARCH: + subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) + os.chdir('flash-attention') + num_jobs = os.cpu_count() - 1 + subprocess.check_call(['pip', 'install', '-v', '.', f'MAX_JOBS={num_jobs}'], shell=True) + os.chdir('..') + # Only Triton backend supports Radeon GPUs + elif rocm_arch in RADEON_ARCH: + subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) + os.chdir('flash-attention') + subprocess.check_call(['git', 'checkout', 'main_perf']) + subprocess.check_call(['FLASH_ATTENTION_TRITON_AMD_ENABLE="TRUE"', 'python', 'setup.py', 'install', ], shell=True) + os.chdir('..') + + # Comment out the following if you need xformers installed. + # # only install xformers in Instinct GPUs + # if importlib.util.find_spec("xformers") is None: + # print("Installing xformers...") + # if rocm_arch in INSTINCT_ARCH: + # subprocess.check_call(['git', 'clone', 'https://github.com/ROCm/xformers.git']) + # os.chdir('xformers') + # subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive']) + # os.environ['PYTORCH_ROCM_ARCH'] = rocm_arch + # subprocess.check_call(['python', 'setup.py', 'install']) + # os.chdir('..') + + # bitsandbytes + if importlib.util.find_spec("bitsandbytes") is None: + print("Installing bitsandbytes...") + subprocess.check_call(['git', 'clone', '--recurse-submodules', 'https://github.com/ROCm/bitsandbytes']) + os.chdir('bitsandbytes') + subprocess.check_call(['git', 'checkout', 'rocm_enabled_multi_backend']) + subprocess.check_call(['pip', 'install', '-r', 'requirements-dev.txt']) + subprocess.check_call(['cmake', '-DCOMPUTE_BACKEND=hip', '-S', '.']) # Add -DBNB_ROCM_ARCH if needed + subprocess.check_call(['make']) + subprocess.check_call(['pip', 'install', '.']) + os.chdir('..') + + os.chdir('..') + + # Continue with regular install + install.run(self) + pass + pass cmdclass = { 'install': RocmExtraInstallCommand } +pass setup( - # static metadata should rather go in pyproject.toml - version=get_unsloth_version(), - install_requires=get_requirements(), - extras_require=extras_require, - cmdclass=cmdclass, - package_data=package_data, + version = get_unsloth_version(), + install_requires = get_requirements(), + extras_require = extras_requires, + cmdclass = cmdclass, + package_data = package_data, ) From b221ffc216c4bc1b000db7091d13d4c2b312c13e Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:13:00 -0700 Subject: [PATCH 04/16] Cmake and ninja move --- pyproject.toml | 4 +--- setup.py | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ea86bfd20e..9dd8b41fc6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,6 @@ [build-system] # Should be mirrored in requirements/build.txt requires = [ - "cmake>=3.26", - "ninja", "packaging>=24.2", "setuptools>=77.0.3,<80.0.0", "setuptools-scm>=8.0", @@ -13,7 +11,7 @@ build-backend = "setuptools.build_meta" name = "unsloth" description = "2-5X faster LLM finetuning" readme = "README.md" -requires-python = ">=3.9,<3.13" +requires-python = ">=3.9" dynamic = ["version", "dependencies", "optional-dependencies"] license = { file = "LICENSE" } keywords = ["ai", "llm",] diff --git a/setup.py b/setup.py index e75a10d409..703604c54a 100644 --- a/setup.py +++ b/setup.py @@ -770,6 +770,10 @@ if HAS_HIP: os.mkdir('thirdparties') os.chdir('thirdparties') + # Cmake and ninja + subprocess.check_call(['pip', 'install', 'cmake>=3.26']) + subprocess.check_call(['pip', 'install', 'ninja']) + # Extract ROCm GPU arch from environment variable. If unset, then detect ROCm arch from rocminfo # Refer to https://github.com/bitsandbytes-foundation/bitsandbytes/blob/1abd5e781013a085f86586b30a248dc769909668/bitsandbytes/cuda_specs.py#L81 # TODO(billishyahao): need to triage rocminfo unavailable observation from https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1444 From 34d3b9f6e152af4eb0def4a57189fad583ecb375 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:14:58 -0700 Subject: [PATCH 05/16] Update setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 703604c54a..fc4c113166 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,6 @@ from setuptools.command.install import install ROOT_DIR = Path(__file__).parent UNSLOTH_TARGET_DEVICE = os.environ.get("UNSLOTH_TARGET_DEVICE", "cuda") IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) -UNSLOTH_VERSION = load_module_from_path('ver', os.path.join(ROOT_DIR, 'unsloth', 'version.py')) # Try importing torch HAS_TORCH = False @@ -55,6 +54,7 @@ def load_module_from_path(module_name, path): spec.loader.exec_module(module) return module pass +ver = load_module_from_path('ver', os.path.join(ROOT_DIR, 'unsloth', 'version.py')) def get_nvcc_cuda_version(): @@ -103,7 +103,7 @@ pass def get_unsloth_version(): - version = UNSLOTH_VERSION.__version__ + version = ver.__version__ if version is None: raise RuntimeError("unsloth version not found") From 8253e921cc237a458f9f61be78c35aa8ef4a9ea1 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:18:22 -0700 Subject: [PATCH 06/16] Update setup.py --- setup.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index fc4c113166..b411d4d18c 100644 --- a/setup.py +++ b/setup.py @@ -30,9 +30,7 @@ IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) HAS_TORCH = False HAS_CUDA = True HAS_HIP = False -CUDA_HOME = None -ROCM_HOME = None -torch = None +torch = None if importlib.util.find_spec("torch") is not None: try: import torch @@ -44,9 +42,13 @@ if importlib.util.find_spec("torch") is not None: except Exception as e: print(f"Unsloth: Importing torch failed with error = {str(e)}.") HAS_TORCH = False + CUDA_HOME = None + ROCM_HOME = None +else: + CUDA_HOME = None + ROCM_HOME = None pass - def load_module_from_path(module_name, path): spec = importlib.util.spec_from_file_location(module_name, path) module = importlib.util.module_from_spec(spec) From 843734d2968be3547d4717d8018290410dbbeb4e Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:19:25 -0700 Subject: [PATCH 07/16] Update setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b411d4d18c..192aea7b7f 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,8 @@ if importlib.util.find_spec("torch") is not None: HAS_TORCH = True HAS_CUDA = (torch.version.cuda is not None) HAS_HIP = (torch.version. hip is not None) - + print(f"Unsloth: Imported torch with CUDA_HOME = {str(CUDA_HOME)}.") + print(f"Unsloth: Imported torch with ROCM_HOME = {str(ROCM_HOME)}.") except Exception as e: print(f"Unsloth: Importing torch failed with error = {str(e)}.") HAS_TORCH = False From e8d40ca2b25f606360bfefbaa0608e38549f745e Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:26:34 -0700 Subject: [PATCH 08/16] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 192aea7b7f..59e9410674 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) # Try importing torch HAS_TORCH = False -HAS_CUDA = True +HAS_CUDA = False HAS_HIP = False torch = None if importlib.util.find_spec("torch") is not None: From 9c6e27081f55a7b067457405d3f2d448f77a8e65 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:27:34 -0700 Subject: [PATCH 09/16] Update setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 59e9410674..b86de8c7e8 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,8 @@ HAS_TORCH = False HAS_CUDA = False HAS_HIP = False torch = None +print(f"Unsloth: Imported torch with CUDA_HOME = {str(CUDA_HOME)}.") +print(f"Unsloth: Imported torch with ROCM_HOME = {str(ROCM_HOME)}.") if importlib.util.find_spec("torch") is not None: try: import torch From 508be34294d296c07a07a0382a0b42dc7c9ca039 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:32:23 -0700 Subject: [PATCH 10/16] Update setup.py --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index b86de8c7e8..192aea7b7f 100644 --- a/setup.py +++ b/setup.py @@ -28,11 +28,9 @@ IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) # Try importing torch HAS_TORCH = False -HAS_CUDA = False +HAS_CUDA = True HAS_HIP = False torch = None -print(f"Unsloth: Imported torch with CUDA_HOME = {str(CUDA_HOME)}.") -print(f"Unsloth: Imported torch with ROCM_HOME = {str(ROCM_HOME)}.") if importlib.util.find_spec("torch") is not None: try: import torch From dd8df9b5a94f91724a12a1edafb42ed1d4ef089f Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:34:27 -0700 Subject: [PATCH 11/16] Update setup.py --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 192aea7b7f..e4e855912c 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,9 @@ ROOT_DIR = Path(__file__).parent UNSLOTH_TARGET_DEVICE = os.environ.get("UNSLOTH_TARGET_DEVICE", "cuda") IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) +import torch +from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME + # Try importing torch HAS_TORCH = False HAS_CUDA = True From 2952513ba85c9e7a9285791c626607c5f1a15337 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 00:51:04 -0700 Subject: [PATCH 12/16] subprocess --- pyproject.toml | 1 - setup.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9dd8b41fc6..affb813845 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,4 @@ [build-system] -# Should be mirrored in requirements/build.txt requires = [ "packaging>=24.2", "setuptools>=77.0.3,<80.0.0", diff --git a/setup.py b/setup.py index e4e855912c..060e760dd9 100644 --- a/setup.py +++ b/setup.py @@ -23,11 +23,10 @@ from setuptools import setup from setuptools.command.install import install ROOT_DIR = Path(__file__).parent -UNSLOTH_TARGET_DEVICE = os.environ.get("UNSLOTH_TARGET_DEVICE", "cuda") IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) -import torch -from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME +output = subprocess.run(["python", "-c", "from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME; from torch.version import cuda, hip; print(CUDA_HOME); print(ROCM_HOME); print(cuda); print(hip);"], capture_output = True, text = True) +print(output) # Try importing torch HAS_TORCH = False From b7b67439acbcfd26272b7beae83270866cc5c64b Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 01:02:51 -0700 Subject: [PATCH 13/16] Move AMD to AMD branch --- README.md | 39 +- pyproject.toml | 607 ++++++++++++++++++++++++++- requirements/build.txt | 7 - requirements/rocm.txt | 17 - setup.py | 863 --------------------------------------- unsloth/models/_utils.py | 13 +- unsloth/version.py | 1 - 7 files changed, 615 insertions(+), 932 deletions(-) delete mode 100644 requirements/build.txt delete mode 100644 requirements/rocm.txt delete mode 100644 setup.py delete mode 100644 unsloth/version.py diff --git a/README.md b/README.md index bf7e879ace..6279117888 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,6 @@ For Windows install instructions, see [here](https://docs.unsloth.ai/get-started - All kernels written in [OpenAI's Triton](https://openai.com/index/triton/) language. **Manual backprop engine**. - **0% loss in accuracy** - no approximation methods - all exact. - No change of hardware. Supports NVIDIA GPUs since 2018+. Minimum CUDA Capability 7.0 (V100, T4, Titan V, RTX 20, 30, 40x, A100, H100, L40 etc) [Check your GPU!](https://developer.nvidia.com/cuda-gpus) GTX 1070, 1080 works, but is slow. -- AMD ROCm GPUs including Instinct 3xx series and Radeon GPUs are now supported! - Works on **Linux** and **Windows** - If you trained a model with 🦄Unsloth, you can use this cool sticker!   @@ -98,42 +97,6 @@ pip install unsloth pip install --upgrade --force-reinstall --no-cache-dir unsloth unsloth_zoo ``` See [here](https://github.com/unslothai/unsloth/edit/main/README.md#advanced-pip-installation) for advanced pip install instructions. - -### AMD ROCm GPU Installation - -**Launch container environment:** -``` -CONTAINER_NAME= -IMAGE_NAME=rocm/vllm:rocm6.4.1_vllm_0.9.0.1_20250605 - -docker run -it \ - --rm \ - --device /dev/dri \ - --device /dev/kfd \ - --network host \ - --ipc host \ - --group-add video \ - --cap-add SYS_PTRACE \ - --security-opt seccomp=unconfined \ - --privileged \ - --shm-size 32G \ - --name ${CONTAINER_NAME} \ - ${IMAGE_NAME} /bin/bash -``` - -**Install by setup.py install** -``` -# choose your rocm arch from INSTINCT_ARCH=("gfx942", "gfx90a"), or -# RADEON_ARCH=("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201") -# Specify gfx942 here for MI300X device -ROCM_ARCH=gfx942 python setup.py bdist_wheel - -root@root:/workspace/unsloth# ls dist/ -unsloth-2025.6.5+rocm641-py3-none-any.whl - -pip install ./dist/unsloth-2025.6.5+rocm641-py3-none-any.whl -``` - ### Windows Installation > [!warning] > Python 3.13 does not support Unsloth. Use 3.12, 3.11 or 3.10 @@ -172,7 +135,7 @@ trainer = SFTTrainer( For **advanced installation instructions** or if you see weird errors during installations: -1. Install `torch` and `triton`. Go to https://pytorch.org to install it. For example `pip install torch torchvision torchaudio triton`. For AMD GPUs, please add `--extra-index-url https://download.pytorch.org/whl/rocm6.3` . For AMD support matrix info, please refer to https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html. +1. Install `torch` and `triton`. Go to https://pytorch.org to install it. For example `pip install torch torchvision torchaudio triton` 2. Confirm if CUDA is installed correctly. Try `nvcc`. If that fails, you need to install `cudatoolkit` or CUDA drivers. 3. Install `xformers` manually. You can try installing `vllm` and seeing if `vllm` succeeds. Check if `xformers` succeeded with `python -m xformers.info` Go to https://github.com/facebookresearch/xformers. Another option is to install `flash-attn` for Ampere GPUs. 4. Double check that your versions of Python, CUDA, CUDNN, `torch`, `triton`, and `xformers` are compatible with one another. The [PyTorch Compatibility Matrix](https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix) may be useful. diff --git a/pyproject.toml b/pyproject.toml index affb813845..2f82965077 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,28 @@ [build-system] +<<<<<<< HEAD requires = [ "packaging>=24.2", "setuptools>=77.0.3,<80.0.0", "setuptools-scm>=8.0", ] +======= +requires = ["setuptools", "setuptools-scm"] +>>>>>>> parent of 06ca5c2 ([Feature] enable unsloth on amd gpu (#2520)) build-backend = "setuptools.build_meta" [project] name = "unsloth" +dynamic = ["version"] description = "2-5X faster LLM finetuning" readme = "README.md" +<<<<<<< HEAD requires-python = ">=3.9" dynamic = ["version", "dependencies", "optional-dependencies"] license = { file = "LICENSE" } +======= +requires-python = ">=3.9,<3.13" +license = {text = "Apache-2.0"} +>>>>>>> parent of 06ca5c2 ([Feature] enable unsloth on amd gpu (#2520)) keywords = ["ai", "llm",] authors = [ {email = "info@unsloth.ai"}, @@ -26,15 +36,606 @@ classifiers = [ "Programming Language :: Python", ] +[tool.setuptools.dynamic] +version = {attr = "unsloth.models._utils.__version__"} + [tool.setuptools] include-package-data = false - [tool.setuptools.packages.find] -where = ["."] -include = ["unsloth*"] exclude = ["images*", "tests*", "kernels/moe*"] +[project.optional-dependencies] +triton = [ + "triton-windows ; platform_system == 'Windows'", +] + +huggingface = [ + "unsloth_zoo>=2025.6.7", + "packaging", + "tyro", + "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", + "datasets>=3.4.1", + "sentencepiece>=0.2.0", + "tqdm", + "psutil", + "wheel>=0.42.0", + "numpy", + "accelerate>=0.34.1", + "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", + "peft>=0.7.1,!=0.11.0", + "protobuf", + "huggingface_hub", + "hf_transfer", + "unsloth[triton]", +] +windows=[ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5 ; platform_system == 'Windows'", + "xformers>=0.0.22.post7 ; platform_system == 'Windows'", +] +cu118only = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu121only = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu118onlytorch211 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu121onlytorch211 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu118onlytorch212 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu121onlytorch212 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu118onlytorch220 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu121onlytorch220 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", +] +cu118onlytorch230 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu121onlytorch230 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu118onlytorch240 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu121onlytorch240 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu124onlytorch240 = [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu118onlytorch250 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu121onlytorch250 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu124onlytorch250 = [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu118onlytorch251 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu121onlytorch251 = [ + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu124onlytorch251 = [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu118onlytorch260 = [ + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", +] +cu124onlytorch260 = [ + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu126onlytorch260 = [ + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu126onlytorch270 = [ + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu128onlytorch270 = [ + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", +] +cu118 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118only]", +] +cu121 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121only]", +] +cu118-torch211 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu118onlytorch211]", +] +cu121-torch211 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", +] +cu118-torch212 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu118onlytorch212]", +] +cu121-torch212 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch212]", +] +cu118-torch220 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch220]", +] +cu121-torch220 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", +] +cu118-torch230 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch230]", +] +cu121-torch230 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch230]", +] +cu118-torch240 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch240]", +] +cu121-torch240 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch240]", +] +cu124-torch240 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch240]", +] +cu118-torch250 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch250]", +] +cu121-torch250 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch250]", +] +cu124-torch250 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch250]", +] +cu118-torch251 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch251]", +] +cu121-torch251 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch251]", +] +cu124-torch251 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch251]", +] +cu118-torch260 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch260]", +] +cu124-torch260 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch260]", +] +cu126-torch260 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch260]", +] +cu126-torch270 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch270]", +] +cu128-torch270 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu128onlytorch270]", +] +kaggle = [ + "unsloth[huggingface]", +] +kaggle-new = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", +] +conda = [ + "unsloth[huggingface]", +] +colab-torch211 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", +] +colab-ampere-torch211 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", + "packaging", + "ninja", + "flash-attn>=2.6.3", +] +colab-torch220 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", +] +colab-ampere-torch220 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", + "packaging", + "ninja", + "flash-attn>=2.6.3", +] +colab-new = [ + "unsloth_zoo>=2025.6.7", + "packaging", + "tyro", + "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", + "datasets>=3.4.1", + "sentencepiece>=0.2.0", + "tqdm", + "psutil", + "wheel>=0.42.0", + "numpy", + "protobuf", + "huggingface_hub", + "hf_transfer", + "bitsandbytes>=0.45.5", + "unsloth[triton]", +] +colab-no-deps = [ + "accelerate>=0.34.1", + "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", + "peft>=0.7.1", + "xformers", + "bitsandbytes>=0.45.5", + "protobuf", +] +colab = [ + "unsloth[cu121]", +] +flashattention = [ + "packaging ; platform_system == 'Linux'", + "ninja ; platform_system == 'Linux'", + "flash-attn>=2.6.3 ; platform_system == 'Linux'", +] +colab-ampere = [ + "unsloth[colab-ampere-torch220]", + "unsloth[flashattention]", +] +cu118-ampere = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118only]", + "unsloth[flashattention]", +] +cu121-ampere = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121only]", + "unsloth[flashattention]", +] +cu118-ampere-torch211 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu118onlytorch211]", + "unsloth[flashattention]", +] +cu121-ampere-torch211 = [ + "unsloth[huggingface]", + "bitsandbytes==0.45.5", + "unsloth[cu121onlytorch211]", + "unsloth[flashattention]", +] +cu118-ampere-torch220 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch220]", + "unsloth[flashattention]", +] +cu121-ampere-torch220 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch220]", + "unsloth[flashattention]", +] +cu118-ampere-torch230 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch230]", + "unsloth[flashattention]", +] +cu121-ampere-torch230 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch230]", + "unsloth[flashattention]", +] +cu118-ampere-torch240 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch240]", + "unsloth[flashattention]", +] +cu121-ampere-torch240 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch240]", + "unsloth[flashattention]", +] +cu124-ampere-torch240 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch240]", + "unsloth[flashattention]", +] +cu118-ampere-torch250 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch250]", + "unsloth[flashattention]", +] +cu121-ampere-torch250 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch250]", + "unsloth[flashattention]", +] +cu124-ampere-torch250 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch250]", + "unsloth[flashattention]", +] +cu118-ampere-torch251 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch251]", + "unsloth[flashattention]", +] +cu121-ampere-torch251 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu121onlytorch251]", + "unsloth[flashattention]", +] +cu124-ampere-torch251 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch251]", + "unsloth[flashattention]", +] +cu118-ampere-torch260 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu118onlytorch260]", + "unsloth[flashattention]", +] +cu124-ampere-torch260 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu124onlytorch260]", + "unsloth[flashattention]", +] +cu126-ampere-torch260 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch260]", + "unsloth[flashattention]", +] +cu126-ampere-torch270 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu126onlytorch270]", + "unsloth[flashattention]", +] +cu128-ampere-torch270 = [ + "unsloth[huggingface]", + "bitsandbytes>=0.45.5", + "unsloth[cu128onlytorch270]", + "unsloth[flashattention]", +] + +flashattentiontorch260abiFALSEcu12x = [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", +] +flashattentiontorch260abiTRUEcu12x = [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", +] +flashattentiontorch250abiFALSEcu12x = [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", +] +flashattentiontorch250abiTRUEcu12x = [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", +] +flashattentiontorch240abiFALSEcu12x = [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", +] +flashattentiontorch240abiTRUEcu12x = [ + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", + "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", +] +intel-gpu-torch260 = [ + "unsloth[huggingface]", + + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp39-cp39-linux_x86_64.whl#sha256=147607f190a7d7aa24ba454def5977fbbfec792fdae18e4ed278cfec29b69271 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp310-cp310-linux_x86_64.whl#sha256=23aa423fa1542afc34f67eb3ba8ef20060f6d1b3a4697eaeab22b11c92b30f2b ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp311-cp311-linux_x86_64.whl#sha256=bcfa995229bbfd9ffd8d6c8d9f6428d393e876fa6e23ee3c20e3c0d73ca75ca5 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp312-cp312-linux_x86_64.whl#sha256=bd340903d03470708df3442438acb8b7e08087ab9e61fbe349b2872bf9257ab0 ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp313-cp313-linux_x86_64.whl#sha256=814dccc8a07159e6eca74bed70091bc8fea2d9dd87b0d91845f9f38cde62f01c ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", + + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=6a8adf6dc4c089406e8b3a7e58ab57a463bddf9b07130d2576e76eced43e92af ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=ff4561cbf07c83bbccaa0f6e9bb0e6dcf721bacd53c9c43c4eb0e7331b4792f9 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=12005f66b810ddd3ab93f86c4522bcfdd412cbd27fc9d189b661ff7509bc5e8a ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c4c5c67625cdacf35765c2b94e61fe166e3c3f4a14521b1212a59ad1b3eb0f2e ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=e6864f7a60a5ecc43d5d38f59a16e5dd132384f73dfd3a697f74944026038f7b ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", +] +intel-gpu-torch270 = [ + "unsloth[huggingface]", + + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=749a7098492c6a27b356c97149a4a62973b953eae60bc1b6259260974f344913 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=44362e80abd752471a08341093321955b066daa2cfb4810e73b8e3b240850f93 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=faa6b8c945a837a080f641bc8ccc77a98fa66980dcd7e62e715fd853737343fd ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=40f6fb65b345dc9a61813abe7ac9a585f2c9808f414d140cc2a5f11f53ee063c ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=9821fe059de58e827ffc6aa10d69369b16c2f8c2a988b86bef9c2c6e396ab3aa ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", + + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=f8ee75e50fcbb37ed5b498299ca2264da99ab278a93fae2358e921e4a6e28273 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=d6fdc342961d98fdcd9d03dfd491a3208bb5f7fbb435841f8f72ce9fdcd2d026 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=74d07f9357df5cf2bf223ad3c84de16346bfaa0504f988fdd5590d3e177e5e86 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c806d44aa2ca5d225629f6fbc6c994d5deaac2d2cde449195bc8e3522ddd219a ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", + "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=25d8277b7f01d42e2e014ccbab57a2692b6ec4eff8dcf894eda1b297407cf97a ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", +] [project.urls] homepage = "http://www.unsloth.ai" diff --git a/requirements/build.txt b/requirements/build.txt deleted file mode 100644 index 1943dde2f9..0000000000 --- a/requirements/build.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake>=3.26 -ninja -packaging>=24.2 -setuptools>=77.0.3,<80.0.0 -setuptools-scm>=8.0 -wheel -jinja2 \ No newline at end of file diff --git a/requirements/rocm.txt b/requirements/rocm.txt deleted file mode 100644 index 10dde5052c..0000000000 --- a/requirements/rocm.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Common dependencies --r common.txt - ---extra-index-url https://download.pytorch.org/whl/rocm6.3 - -torch==2.7.0 -torchvision==0.21.0 -torchaudio==2.7.0 - -triton==3.2 -cmake>=3.26,<4 -packaging -setuptools>=77.0.3,<80.0.0 -setuptools-scm>=8 -wheel -jinja2>=3.1.6 -amdsmi==6.4.1 diff --git a/setup.py b/setup.py deleted file mode 100644 index 060e760dd9..0000000000 --- a/setup.py +++ /dev/null @@ -1,863 +0,0 @@ -# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Modified from https://github.com/vllm-project/vllm/blob/main/setup.py - -import importlib.util -import os -import subprocess -import sys -from pathlib import Path -from packaging.version import Version, parse -from setuptools import setup -from setuptools.command.install import install - -ROOT_DIR = Path(__file__).parent -IS_COLAB = "COLAB_" not in "".join(os.environ.keys()) - -output = subprocess.run(["python", "-c", "from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME; from torch.version import cuda, hip; print(CUDA_HOME); print(ROCM_HOME); print(cuda); print(hip);"], capture_output = True, text = True) -print(output) - -# Try importing torch -HAS_TORCH = False -HAS_CUDA = True -HAS_HIP = False -torch = None -if importlib.util.find_spec("torch") is not None: - try: - import torch - from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME - HAS_TORCH = True - HAS_CUDA = (torch.version.cuda is not None) - HAS_HIP = (torch.version. hip is not None) - print(f"Unsloth: Imported torch with CUDA_HOME = {str(CUDA_HOME)}.") - print(f"Unsloth: Imported torch with ROCM_HOME = {str(ROCM_HOME)}.") - except Exception as e: - print(f"Unsloth: Importing torch failed with error = {str(e)}.") - HAS_TORCH = False - CUDA_HOME = None - ROCM_HOME = None -else: - CUDA_HOME = None - ROCM_HOME = None -pass - -def load_module_from_path(module_name, path): - spec = importlib.util.spec_from_file_location(module_name, path) - module = importlib.util.module_from_spec(spec) - sys.modules[module_name] = module - spec.loader.exec_module(module) - return module -pass -ver = load_module_from_path('ver', os.path.join(ROOT_DIR, 'unsloth', 'version.py')) - - -def get_nvcc_cuda_version(): - """Get the CUDA version from nvcc. - - Adapted from https://github.com/NVIDIA/apex/blob/8b7a1ff183741dd8f9b87e7bafd04cfde99cea28/setup.py - """ - assert CUDA_HOME is not None, "CUDA_HOME is not set" - nvcc_output = subprocess.check_output([CUDA_HOME + "/bin/nvcc", "-V"], - universal_newlines=True) - output = nvcc_output.split() - release_idx = output.index("release") + 1 - nvcc_cuda_version = parse(output[release_idx].split(",")[0]) - return nvcc_cuda_version -pass - - -def get_rocm_version(): - # Get the Rocm version from the ROCM_HOME/bin/librocm-core.so - # see https://github.com/ROCm/rocm-core/blob/d11f5c20d500f729c393680a01fa902ebf92094b/rocm_version.cpp#L21 - import ctypes - try: - librocm_core_file = Path(ROCM_HOME) / "lib" / "librocm-core.so" - if not librocm_core_file.is_file(): - return None - librocm_core = ctypes.CDLL(librocm_core_file) - VerErrors = ctypes.c_uint32 - get_rocm_core_version = librocm_core.getROCmVersion - get_rocm_core_version.restype = VerErrors - get_rocm_core_version.argtypes = [ - ctypes.POINTER(ctypes.c_uint32), - ctypes.POINTER(ctypes.c_uint32), - ctypes.POINTER(ctypes.c_uint32), - ] - major = ctypes.c_uint32() - minor = ctypes.c_uint32() - patch = ctypes.c_uint32() - - if (get_rocm_core_version(ctypes.byref(major), ctypes.byref(minor), - ctypes.byref(patch)) == 0): - return f"{major.value}.{minor.value}.{patch.value}" - return None - except Exception: - return None -pass - - -def get_unsloth_version(): - version = ver.__version__ - - if version is None: - raise RuntimeError("unsloth version not found") - - sep = "+" if "+" not in version else "." # dev versions might contain + - - if HAS_CUDA: - cuda_version = str(get_nvcc_cuda_version()) - cuda_version_str = cuda_version.replace(".", "")[:3] - # skip this for source tarball, required for pypi - if "sdist" not in sys.argv: - version += f"{sep}cu{cuda_version_str}" - elif HAS_HIP: - # Get the Rocm Version - rocm_version = get_rocm_version() or torch.version.hip - if rocm_version: - version += f"{sep}rocm{rocm_version.replace('.', '')[:3]}" - else: - raise RuntimeError("Unknown runtime environment") - return version -pass - - -def get_requirements(): - """Get Python package dependencies from requirements.txt.""" - requirements_dir = ROOT_DIR / "requirements" - def _read_requirements(filename): - with open(requirements_dir / filename) as f: - requirements = f.read().strip().split("\n") - resolved_requirements = [] - for line in requirements: - if line.startswith("-r "): - resolved_requirements += _read_requirements(line.split()[1]) - elif not line.startswith("--") and not line.startswith( - "#") and line.strip() != "": - resolved_requirements.append(line) - return resolved_requirements - pass - if HAS_CUDA: - requirements = _read_requirements("cuda.txt") - elif HAS_HIP: - requirements = _read_requirements("rocm.txt") - else: - requirements = _read_requirements("common.txt") - raise ValueError( - "Unsupported platform, please use CUDA, ROCm, " - ) - return requirements -pass - - -package_data = { - "unsloth": [ - "py.typed", - ] -} - -extras_requires = { - "triton" : [ - "triton-windows ; platform_system == 'Windows'", - ], - - "huggingface" : [ - "unsloth_zoo>=2025.6.6", - "packaging", - "tyro", - "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", - "datasets>=3.4.1", - "sentencepiece>=0.2.0", - "tqdm", - "psutil", - "wheel>=0.42.0", - "numpy", - "accelerate>=0.34.1", - "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", - "peft>=0.7.1,!=0.11.0", - "protobuf", - "huggingface_hub", - "hf_transfer", - "unsloth[triton]", - ], - "windows" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5 ; platform_system == 'Windows'", - "xformers>=0.0.22.post7 ; platform_system == 'Windows'", - ], - "cu118only" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.22.post7%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu121only" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu118onlytorch211" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu121onlytorch211" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu118onlytorch212" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.23.post1%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu121onlytorch212" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu118onlytorch220" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.24%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu121onlytorch220" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - ], - "cu118onlytorch230" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu121onlytorch230" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu118onlytorch240" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu121onlytorch240" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu124onlytorch240" : [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu118onlytorch250" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu121onlytorch250" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu124onlytorch250" : [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu118onlytorch251" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu121onlytorch251" : [ - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu124onlytorch251" : [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu118onlytorch260" : [ - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - ], - "cu124onlytorch260" : [ - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu126onlytorch260" : [ - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.29.post3-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu126onlytorch270" : [ - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu126/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu128onlytorch270" : [ - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12' and platform_system == 'Linux'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "xformers @ https://download.pytorch.org/whl/cu128/xformers-0.0.30-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", - ], - "cu118" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118only]", - ], - "cu121" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121only]", - ], - "cu118-torch211" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu118onlytorch211]", - ], - "cu121-torch211" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", - ], - "cu118-torch212" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu118onlytorch212]", - ], - "cu121-torch212" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch212]", - ], - "cu118-torch220" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch220]", - ], - "cu121-torch220" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", - ], - "cu118-torch230" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch230]", - ], - "cu121-torch230" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch230]", - ], - "cu118-torch240" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch240]", - ], - "cu121-torch240" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch240]", - ], - "cu124-torch240" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch240]", - ], - "cu118-torch250" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch250]", - ], - "cu121-torch250" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch250]", - ], - "cu124-torch250" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch250]", - ], - "cu118-torch251" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch251]", - ], - "cu121-torch251" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch251]", - ], - "cu124-torch251" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch251]", - ], - "cu118-torch260" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch260]", - ], - "cu124-torch260" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch260]", - ], - "cu126-torch260" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch260]", - ], - "cu126-torch270" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch270]", - ], - "cu128-torch270" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu128onlytorch270]", - ], - "kaggle" : [ - "unsloth[huggingface]", - ], - "kaggle-new" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - ], - "conda" : [ - "unsloth[huggingface]", - ], - "colab-torch211" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", - ], - "colab-ampere-torch211" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", - "packaging", - "ninja", - "flash-attn>=2.6.3", - ], - "colab-torch220" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", - ], - "colab-ampere-torch220" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", - "packaging", - "ninja", - "flash-attn>=2.6.3", - ], - "colab-new" : [ - "unsloth_zoo>=2025.6.6", - "packaging", - "tyro", - "transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3", - "datasets>=3.4.1", - "sentencepiece>=0.2.0", - "tqdm", - "psutil", - "wheel>=0.42.0", - "numpy", - "protobuf", - "huggingface_hub", - "hf_transfer", - "bitsandbytes>=0.45.5", - "unsloth[triton]", - ], - "colab-no-deps" : [ - "accelerate>=0.34.1", - "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", - "peft>=0.7.1", - "xformers", - "bitsandbytes>=0.45.5", - "protobuf", - ], - "colab" : [ - "unsloth[cu121]", - ], - "flashattention" : [ - "packaging ; platform_system == 'Linux'", - "ninja ; platform_system == 'Linux'", - "flash-attn>=2.6.3 ; platform_system == 'Linux'", - ], - "colab-ampere" : [ - "unsloth[colab-ampere-torch220]", - "unsloth[flashattention]", - ], - "cu118-ampere" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118only]", - "unsloth[flashattention]", - ], - "cu121-ampere" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121only]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch211" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu118onlytorch211]", - "unsloth[flashattention]", - ], - "cu121-ampere-torch211" : [ - "unsloth[huggingface]", - "bitsandbytes==0.45.5", - "unsloth[cu121onlytorch211]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch220" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch220]", - "unsloth[flashattention]", - ], - "cu121-ampere-torch220" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch220]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch230" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch230]", - "unsloth[flashattention]", - ], - "cu121-ampere-torch230" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch230]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch240" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch240]", - "unsloth[flashattention]", - ], - "cu121-ampere-torch240" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch240]", - "unsloth[flashattention]", - ], - "cu124-ampere-torch240" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch240]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch250" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch250]", - "unsloth[flashattention]", - ], - "cu121-ampere-torch250" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch250]", - "unsloth[flashattention]", - ], - "cu124-ampere-torch250" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch250]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch251" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch251]", - "unsloth[flashattention]", - ], - "cu121-ampere-torch251" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu121onlytorch251]", - "unsloth[flashattention]", - ], - "cu124-ampere-torch251" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch251]", - "unsloth[flashattention]", - ], - "cu118-ampere-torch260" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu118onlytorch260]", - "unsloth[flashattention]", - ], - "cu124-ampere-torch260" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu124onlytorch260]", - "unsloth[flashattention]", - ], - "cu126-ampere-torch260" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch260]", - "unsloth[flashattention]", - ], - "cu126-ampere-torch270" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu126onlytorch270]", - "unsloth[flashattention]", - ], - "cu128-ampere-torch270" : [ - "unsloth[huggingface]", - "bitsandbytes>=0.45.5", - "unsloth[cu128onlytorch270]", - "unsloth[flashattention]", - ], - - "flashattentiontorch260abiFALSEcu12x" : [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", - ], - "flashattentiontorch260abiTRUEcu12x" : [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.6cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", - ], - "flashattentiontorch250abiFALSEcu12x" : [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", - ], - "flashattentiontorch250abiTRUEcu12x" : [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.5cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", - ], - "flashattentiontorch240abiFALSEcu12x" : [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiFALSE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", - ], - "flashattentiontorch240abiTRUEcu12x" : [ - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp39-cp39-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.9'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.10'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.11'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.12'", - "flash-attn @ https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.4.post1/flash_attn-2.7.4.post1+cu12torch2.4cxx11abiTRUE-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and python_version == '3.13'", - ], - "intel-gpu-torch260" : [ - "unsloth[huggingface]", - - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp39-cp39-linux_x86_64.whl#sha256=147607f190a7d7aa24ba454def5977fbbfec792fdae18e4ed278cfec29b69271 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp310-cp310-linux_x86_64.whl#sha256=23aa423fa1542afc34f67eb3ba8ef20060f6d1b3a4697eaeab22b11c92b30f2b ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp311-cp311-linux_x86_64.whl#sha256=bcfa995229bbfd9ffd8d6c8d9f6428d393e876fa6e23ee3c20e3c0d73ca75ca5 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp312-cp312-linux_x86_64.whl#sha256=bd340903d03470708df3442438acb8b7e08087ab9e61fbe349b2872bf9257ab0 ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.2.0-cp313-cp313-linux_x86_64.whl#sha256=814dccc8a07159e6eca74bed70091bc8fea2d9dd87b0d91845f9f38cde62f01c ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", - - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=6a8adf6dc4c089406e8b3a7e58ab57a463bddf9b07130d2576e76eced43e92af ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=ff4561cbf07c83bbccaa0f6e9bb0e6dcf721bacd53c9c43c4eb0e7331b4792f9 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=12005f66b810ddd3ab93f86c4522bcfdd412cbd27fc9d189b661ff7509bc5e8a ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c4c5c67625cdacf35765c2b94e61fe166e3c3f4a14521b1212a59ad1b3eb0f2e ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.6.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=e6864f7a60a5ecc43d5d38f59a16e5dd132384f73dfd3a697f74944026038f7b ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", - ], - "intel-gpu-torch270" : [ - "unsloth[huggingface]", - - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=749a7098492c6a27b356c97149a4a62973b953eae60bc1b6259260974f344913 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=44362e80abd752471a08341093321955b066daa2cfb4810e73b8e3b240850f93 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=faa6b8c945a837a080f641bc8ccc77a98fa66980dcd7e62e715fd853737343fd ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=40f6fb65b345dc9a61813abe7ac9a585f2c9808f414d140cc2a5f11f53ee063c ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "pytorch_triton_xpu @ https://download.pytorch.org/whl/pytorch_triton_xpu-3.3.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl#sha256=9821fe059de58e827ffc6aa10d69369b16c2f8c2a988b86bef9c2c6e396ab3aa ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", - - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp39-cp39-linux_x86_64.whl#sha256=f8ee75e50fcbb37ed5b498299ca2264da99ab278a93fae2358e921e4a6e28273 ; platform_system == 'Linux' and python_version == '3.9' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp310-cp310-linux_x86_64.whl#sha256=d6fdc342961d98fdcd9d03dfd491a3208bb5f7fbb435841f8f72ce9fdcd2d026 ; platform_system == 'Linux' and python_version == '3.10' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp311-cp311-linux_x86_64.whl#sha256=74d07f9357df5cf2bf223ad3c84de16346bfaa0504f988fdd5590d3e177e5e86 ; platform_system == 'Linux' and python_version == '3.11' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp312-cp312-linux_x86_64.whl#sha256=c806d44aa2ca5d225629f6fbc6c994d5deaac2d2cde449195bc8e3522ddd219a ; platform_system == 'Linux' and python_version == '3.12' and platform_machine == 'x86_64'", - "torch @ https://download.pytorch.org/whl/xpu/torch-2.7.0%2Bxpu-cp313-cp313-linux_x86_64.whl#sha256=25d8277b7f01d42e2e014ccbab57a2692b6ec4eff8dcf894eda1b297407cf97a ; platform_system == 'Linux' and python_version == '3.13' and platform_machine == 'x86_64'", - ] -} - -cmdclass = {} - -if HAS_HIP: - class RocmExtraInstallCommand(install): - def run(self): - import re - import shutil - INSTINCT_ARCH = ("gfx942", "gfx90a") - RADEON_ARCH = ("gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201") - - if os.path.exists('thirdparties'): - shutil.rmtree('thirdparties') - - os.mkdir('thirdparties') - os.chdir('thirdparties') - - # Cmake and ninja - subprocess.check_call(['pip', 'install', 'cmake>=3.26']) - subprocess.check_call(['pip', 'install', 'ninja']) - - # Extract ROCm GPU arch from environment variable. If unset, then detect ROCm arch from rocminfo - # Refer to https://github.com/bitsandbytes-foundation/bitsandbytes/blob/1abd5e781013a085f86586b30a248dc769909668/bitsandbytes/cuda_specs.py#L81 - # TODO(billishyahao): need to triage rocminfo unavailable observation from https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1444 - rocm_arch = os.environ.get('ROCM_ARCH', None) - if rocm_arch is None: - try: - result = subprocess.run(["rocminfo"], capture_output=True, text=True) - match = re.search(r"Name:\s+gfx([a-zA-Z\d]+)", result.stdout) - if match: - rocm_arch = f"gfx{match.group(1)}" - print(f"Automatically detected ROCm GPU architecture: {rocm_arch}") - else: - print("Skipping ROCm extra install, cannot detect ROCm arch automatically...") - install.run(self) - return - except Exception as e: - print("Could not detect ROCm GPU architecture: {e}") - if torch.cuda.is_available(): - print("ROCm GPU architecture detection failed despite ROCm being available...") - install.run(self) - return - - # flash-attention - # MI3xx has both CK backend and Triton backend. - if importlib.util.find_spec("flash_attn") is None: - print("Installing flash-attention...") - if rocm_arch in INSTINCT_ARCH: - subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) - os.chdir('flash-attention') - num_jobs = os.cpu_count() - 1 - subprocess.check_call(['pip', 'install', '-v', '.', f'MAX_JOBS={num_jobs}'], shell=True) - os.chdir('..') - # Only Triton backend supports Radeon GPUs - elif rocm_arch in RADEON_ARCH: - subprocess.check_call(['git', 'clone', '--recursive', 'https://github.com/ROCm/flash-attention.git']) - os.chdir('flash-attention') - subprocess.check_call(['git', 'checkout', 'main_perf']) - subprocess.check_call(['FLASH_ATTENTION_TRITON_AMD_ENABLE="TRUE"', 'python', 'setup.py', 'install', ], shell=True) - os.chdir('..') - - # Comment out the following if you need xformers installed. - # # only install xformers in Instinct GPUs - # if importlib.util.find_spec("xformers") is None: - # print("Installing xformers...") - # if rocm_arch in INSTINCT_ARCH: - # subprocess.check_call(['git', 'clone', 'https://github.com/ROCm/xformers.git']) - # os.chdir('xformers') - # subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive']) - # os.environ['PYTORCH_ROCM_ARCH'] = rocm_arch - # subprocess.check_call(['python', 'setup.py', 'install']) - # os.chdir('..') - - # bitsandbytes - if importlib.util.find_spec("bitsandbytes") is None: - print("Installing bitsandbytes...") - subprocess.check_call(['git', 'clone', '--recurse-submodules', 'https://github.com/ROCm/bitsandbytes']) - os.chdir('bitsandbytes') - subprocess.check_call(['git', 'checkout', 'rocm_enabled_multi_backend']) - subprocess.check_call(['pip', 'install', '-r', 'requirements-dev.txt']) - subprocess.check_call(['cmake', '-DCOMPUTE_BACKEND=hip', '-S', '.']) # Add -DBNB_ROCM_ARCH if needed - subprocess.check_call(['make']) - subprocess.check_call(['pip', 'install', '.']) - os.chdir('..') - - os.chdir('..') - - # Continue with regular install - install.run(self) - pass - pass - cmdclass = { - 'install': RocmExtraInstallCommand - } -pass - -setup( - version = get_unsloth_version(), - install_requires = get_requirements(), - extras_require = extras_requires, - cmdclass = cmdclass, - package_data = package_data, -) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 9f9a3a46a6..b0ae710445 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from unsloth.version import __version__ +__version__ = "2025.6.9" __all__ = [ "SUPPORTS_BFLOAT16", @@ -1310,22 +1310,26 @@ pass def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, model): from peft import LoraConfig + if loftq_config is None: loftq_config = {} signature = str(inspect.signature(LoraConfig)) SUPPORTS_LOFTQ = "loftq_config" in signature + if lora_dropout != 0: logger.warning_once( f"Unsloth: Dropout = 0 is supported for fast patching. You are using dropout = {lora_dropout}.\n"\ f"Unsloth will patch all other layers, except LoRA matrices, causing a performance hit." ) pass + if bias != "none": logger.warning_once( f"Unsloth: bias = `none` is supported for fast patching. You are using bias = {bias}.\n"\ f"Unsloth will patch all other layers, except LoRA matrices, causing a performance hit." ) pass + if not (type(init_lora_weights) is bool or \ init_lora_weights == "gaussian" or init_lora_weights == "loftq"): raise ValueError( @@ -1334,6 +1338,7 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m pass if init_lora_weights == "loftq": + if not SUPPORTS_LOFTQ: import peft raise RuntimeError( @@ -1342,6 +1347,7 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m "You can also install from source: `pip install git+https://github.com/huggingface/peft.git" ) pass + if loftq_config == {}: from peft import LoftQConfig logger.warning_once( @@ -1350,6 +1356,7 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m ) loftq_config = LoftQConfig(loftq_bits = 4, loftq_iter = 1) pass + if hasattr(model.config, "quantization_config"): raise ValueError( "Unsloth: You are using `loftq` init, yet `load_in_4bit = True` was set.\n"\ @@ -1357,5 +1364,5 @@ def validate_loftq_config(loftq_config, lora_dropout, bias, init_lora_weights, m ) pass pass - return loftq_config -pass + + return loftq_config \ No newline at end of file diff --git a/unsloth/version.py b/unsloth/version.py deleted file mode 100644 index 9878268554..0000000000 --- a/unsloth/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "2025.6.8" \ No newline at end of file From cdf82cb4fc1257a0ef2ddb2c2f426ba13efc4358 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 01:10:40 -0700 Subject: [PATCH 14/16] Move AMD to AMD branch --- requirements/common.txt | 21 --------------------- requirements/cuda.txt | 9 --------- 2 files changed, 30 deletions(-) delete mode 100644 requirements/common.txt delete mode 100644 requirements/cuda.txt diff --git a/requirements/common.txt b/requirements/common.txt deleted file mode 100644 index 6fa760103b..0000000000 --- a/requirements/common.txt +++ /dev/null @@ -1,21 +0,0 @@ -unsloth_zoo>=2025.6.7 -packaging>=24.2 -tyro -transformers>=4.51.3,!=4.47.0,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3 -datasets>=3.4.1 -sentencepiece>=0.2.0 -tqdm -tyro -psutil -wheel>=0.42.0 -numpy -accelerate>=0.34.1 -trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0 -peft>=0.7.1,!=0.11.0 -protobuf -huggingface_hub -hf_transfer -pillow -regex -msgspec -jinja2 diff --git a/requirements/cuda.txt b/requirements/cuda.txt deleted file mode 100644 index 5a1e343d74..0000000000 --- a/requirements/cuda.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Common dependencies --r common.txt - -torch<=2.7.0 -torchaudio -torchvision -xformers<=0.0.30 -triton ; platform_system == 'Linux' -triton_windows ; platform_system == 'Windows' From a5fe263e7f71a1f560f0701214ae7d8c26a6ea47 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 01:34:17 -0700 Subject: [PATCH 15/16] Update pyproject.toml --- pyproject.toml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2f82965077..46c7fc4602 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,5 @@ [build-system] -<<<<<<< HEAD -requires = [ - "packaging>=24.2", - "setuptools>=77.0.3,<80.0.0", - "setuptools-scm>=8.0", -] -======= requires = ["setuptools", "setuptools-scm"] ->>>>>>> parent of 06ca5c2 ([Feature] enable unsloth on amd gpu (#2520)) build-backend = "setuptools.build_meta" [project] @@ -15,14 +7,8 @@ name = "unsloth" dynamic = ["version"] description = "2-5X faster LLM finetuning" readme = "README.md" -<<<<<<< HEAD -requires-python = ">=3.9" -dynamic = ["version", "dependencies", "optional-dependencies"] -license = { file = "LICENSE" } -======= requires-python = ">=3.9,<3.13" license = {text = "Apache-2.0"} ->>>>>>> parent of 06ca5c2 ([Feature] enable unsloth on amd gpu (#2520)) keywords = ["ai", "llm",] authors = [ {email = "info@unsloth.ai"}, @@ -640,4 +626,4 @@ intel-gpu-torch270 = [ [project.urls] homepage = "http://www.unsloth.ai" documentation = "https://github.com/unslothai/unsloth" -repository = "https://github.com/unslothai/unsloth" +repository = "https://github.com/unslothai/unsloth" \ No newline at end of file From d594a2c4c78a55518fd2d1f92453d849ae99a2be Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 1 Jul 2025 02:36:54 -0700 Subject: [PATCH 16/16] Update _utils.py --- unsloth/models/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index b0ae710445..2e88f7675e 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.6.9" +__version__ = "2025.6.12" __all__ = [ "SUPPORTS_BFLOAT16",