Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Torch 2.5
Daniel Hane7ede2f7dbf7
diff --git a/README.md b/README.mdindex d0e5a97999b..0a3c83f3fa5 100644--- a/README.md+++ b/README.md@@ -137,7 +137,7 @@ pip install --no-deps trl peft accelerate bitsandbytes### Pip Installation`⚠️Do **NOT** use this if you have Conda.` Pip is a bit more complex since there are dependency issues. The pip command is different for `torch 2.2,2.3,2.4,2.5` and CUDA versions.-For other torch versions, we support `torch211`, `torch212`, `torch220`, `torch230`, `torch240` and for CUDA versions, we support `cu118` and `cu121`. For Ampere devices (A100, H100, RTX3090) and above, use `cu118-ampere` or `cu121-ampere`.+For other torch versions, we support `torch211`, `torch212`, `torch220`, `torch230`, `torch240` and for CUDA versions, we support `cu118` and `cu121` and `cu124`. For Ampere devices (A100, H100, RTX3090) and above, use `cu118-ampere` or `cu121-ampere` or `cu124-ampere`.For example, if you have `torch 2.4` and `CUDA 12.1`, use:```bash@@ -145,6 +145,12 @@ pip install --upgrade pippip install "unsloth[cu121-torch240] @ git+https://github.com/unslothai/unsloth.git"```+Another example, if you have `torch 2.5` and `CUDA 12.4`, use:+```bash+pip install --upgrade pip+pip install "unsloth[cu124-torch250] @ git+https://github.com/unslothai/unsloth.git"+```+And other examples:```bashpip install "unsloth[cu121-ampere-torch240] @ git+https://github.com/unslothai/unsloth.git"@@ -154,6 +160,9 @@ pip install "unsloth[cu118-torch240] @ git+https://github.com/unslothai/unsloth.pip install "unsloth[cu121-torch230] @ git+https://github.com/unslothai/unsloth.git"pip install "unsloth[cu121-ampere-torch230] @ git+https://github.com/unslothai/unsloth.git"++pip install "unsloth[cu121-torch250] @ git+https://github.com/unslothai/unsloth.git"+pip install "unsloth[cu124-ampere-torch250] @ git+https://github.com/unslothai/unsloth.git"```Or, run the below in a terminal to get the **optimal** pip installation command:@@ -164,18 +173,19 @@ wget -qO- https://raw.githubusercontent.com/unslothai/unsloth/main/unsloth/_autoOr, run the below manually in a Python REPL:```pythontry: import torch-except: raise ImportError("Install torch via `pip install torch`")+except: raise ImportError('Install torch via `pip install torch`')from packaging.version import Version as Vv = V(torch.__version__)cuda = str(torch.version.cuda)is_ampere = torch.cuda.get_device_capability()[0] >= 8-if cuda != "12.1" and cuda != "11.8": raise RuntimeError(f"CUDA = {cuda} not supported!")+if cuda != "12.1" and cuda != "11.8" and cuda != "12.4": raise RuntimeError(f"CUDA = {cuda} not supported!")if v <= V('2.1.0'): raise RuntimeError(f"Torch = {v} too old!")elif v <= V('2.1.1'): x = 'cu{}{}-torch211'elif v <= V('2.1.2'): x = 'cu{}{}-torch212'elif v < V('2.3.0'): x = 'cu{}{}-torch220'elif v < V('2.4.0'): x = 'cu{}{}-torch230'elif v < V('2.5.0'): x = 'cu{}{}-torch240'+elif v < V('2.6.0'): x = 'cu{}{}-torch250'else: raise RuntimeError(f"Torch = {v} too new!")x = x.format(cuda.replace(".", ""), "-ampere" if is_ampere else "")print(f'pip install --upgrade pip && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git"')diff --git a/pyproject.toml b/pyproject.tomlindex a2a9c2c9394..498fc35da63 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -109,10 +109,28 @@ cu118onlytorch240 = ["xformers @ https://download.pytorch.org/whl/cu118/xformers-0.0.27.post2%2Bcu118-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12'",]cu121onlytorch240 = [- "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27.post2-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9'",- "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27.post2-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10'",- "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27.post2-cp311-cp311-manylinux2014_x86_64.whl ; python_version=='3.11'",- "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.27.post2-cp312-cp312-manylinux2014_x86_64.whl ; python_version=='3.12'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp39-cp39-manylinux_2_28_x86_64.whl ; python_version=='3.9'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12'",+]+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'",+ "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10'",+ "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11'",+ "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post1-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12'",+]+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'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11'",+ "xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12'",+]+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'",+ "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp310-cp310-manylinux_2_28_x86_64.whl ; python_version=='3.10'",+ "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp311-cp311-manylinux_2_28_x86_64.whl ; python_version=='3.11'",+ "xformers @ https://download.pytorch.org/whl/cu124/xformers-0.0.28.post2-cp312-cp312-manylinux_2_28_x86_64.whl ; python_version=='3.12'",]cu118 = ["unsloth[huggingface]",@@ -174,6 +192,21 @@ cu121-torch240 = ["bitsandbytes>=0.43.3","unsloth[cu121onlytorch240]",]+cu121-torch250 = [+ "unsloth[huggingface]",+ "bitsandbytes>=0.43.3",+ "unsloth[cu121onlytorch250]",+]+cu124-torch240 = [+ "unsloth[huggingface]",+ "bitsandbytes>=0.43.3",+ "unsloth[cu124onlytorch240]",+]+cu124-torch250 = [+ "unsloth[huggingface]",+ "bitsandbytes>=0.43.3",+ "unsloth[cu124onlytorch250]",+]kaggle = ["unsloth[huggingface]",]@@ -322,6 +355,30 @@ cu121-ampere-torch240 = ["ninja","flash-attn>=2.6.3",]+cu121-ampere-torch250 = [+ "unsloth[huggingface]",+ "bitsandbytes>=0.43.3",+ "unsloth[cu121onlytorch250]",+ "packaging",+ "ninja",+ "flash-attn>=2.6.3",+]+cu124-ampere-torch240 = [+ "unsloth[huggingface]",+ "bitsandbytes>=0.43.3",+ "unsloth[cu124onlytorch240]",+ "packaging",+ "ninja",+ "flash-attn>=2.6.3",+]+cu124-ampere-torch250 = [+ "unsloth[huggingface]",+ "bitsandbytes>=0.43.3",+ "unsloth[cu124onlytorch250]",+ "packaging",+ "ninja",+ "flash-attn>=2.6.3",+][project.urls]homepage = "http://www.unsloth.ai"diff --git a/unsloth/_auto_install.py b/unsloth/_auto_install.pyindex 2e6351b8d9d..c3b94c67066 100644--- a/unsloth/_auto_install.py+++ b/unsloth/_auto_install.py@@ -18,13 +18,14 @@ from packaging.version import Version as Vv = V(torch.__version__)cuda = str(torch.version.cuda)is_ampere = torch.cuda.get_device_capability()[0] >= 8-if cuda != "12.1" and cuda != "11.8": raise RuntimeError(f"CUDA = {cuda} not supported!")+if cuda != "12.1" and cuda != "11.8" and cuda != "12.4": raise RuntimeError(f"CUDA = {cuda} not supported!")if v <= V('2.1.0'): raise RuntimeError(f"Torch = {v} too old!")elif v <= V('2.1.1'): x = 'cu{}{}-torch211'elif v <= V('2.1.2'): x = 'cu{}{}-torch212'elif v < V('2.3.0'): x = 'cu{}{}-torch220'elif v < V('2.4.0'): x = 'cu{}{}-torch230'elif v < V('2.5.0'): x = 'cu{}{}-torch240'+elif v < V('2.6.0'): x = 'cu{}{}-torch250'else: raise RuntimeError(f"Torch = {v} too new!")x = x.format(cuda.replace(".", ""), "-ampere" if is_ampere else "")-print(f'pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git"')\ No newline at end of file+print(f'pip install --upgrade pip && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git"')\ No newline at end of file