unsloth:基于多平台的大模型训练与推理工具项目

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, Kimi K3, MiniMax-H3, Gemma 4, FLUX and more.

分支498Tags84
文件最后提交记录最后更新时间
14 小时前
4 天前
3 个月前
18 小时前
13 小时前
13 小时前
22 小时前
19 小时前
4 天前
4 天前
9 个月前
21 天前
9 个月前
7 天前
5 个月前
5 个月前
3 天前
19 天前
2 天前
23 小时前
3 天前
3 天前
30 天前

Unsloth logo

Unsloth 是首个可以运行和训练模型的桌面应用。

功能快速开始笔记本文档

unsloth desktop

⚡ 快速开始

下载适用于你操作系统的原生 Unsloth Desktop 应用:

平台 链接
Windows 下载
macOS 下载
Linux / Ubuntu (deb) 下载
Linux (AppImage) 下载

可从 UnslothGitHub Releases 下载。

或者,如果你更倾向于手动安装:

macOS, Linux, WSL:

curl -fsSL https://unsloth.ai/install.sh | sh

Windows:

irm https://unsloth.ai/install.ps1 | iex

社区:

⭐ 功能

Unsloth 支持 Windows、Linux、WSLmacOS。同时支持 多 GPU 配置、NVIDIA、AMD、Intel 显卡、CPU 以及 Vulkan 后端。

使用 AI 运行与构建

  • 运行并训练大语言模型、扩散模型、嵌入模型和音频模型:Qwen3.8, Kimi K3, MiniMax-H3, Muse Glimmer, DeepSeek-V4, Gemma 4
  • 智能体与工具: 使用本地模型配合 Claude CodeCodexMCP,支持工具调用和代码执行。
  • 搜索与 RAG: 使用私密且无限制的网页搜索、深度研究、自动压缩(滚动上下文窗口)和 RAG。
  • 图像与视频: 运行并训练 图像 和视频扩散模型或多模态模型
  • 远程与 LAN:LAN 中的任意设备访问本地模型,或通过安全的 Cloudflare HTTPS 远程访问。
  • 连接: 通过 OpenAI 兼容 API 提供模型服务。也可接入你的 ChatGPT/Codex 订阅和 云服务提供商

训练与部署

  • 微调: 训练大语言模型、扩散模型、TTS 和嵌入模型时,速度提升 2 倍,显存占用降低 70%,并且 无精度损失
  • 完整支持: 支持 强化学习、LoRA、QLoRA、全量微调、预训练、RL、GRPO、DPO 和 FP8。
  • 导出与部署:GGUF、NVFP4、FP8 等多种格式 导出 或部署模型。
  • 数据集: 使用 Data Recipes 从 PDF、CSV、DOCX 文件等构建数据集。

🚀 Unsloth Start

Unsloth Start 只需一条命令,即可将 Claude CodeCodex 及其他智能体接入本地模型。

unsloth start claude --model unsloth/Qwen3.8-27B-GGUF:UD-Q4_K_XL
智能体 命令
Claude Code unsloth start claude
OpenAI Codex unsloth start codex
Hermes Agent unsloth start hermes
OpenClaw unsloth start openclaw
OpenCode unsloth start opencode

📥 安装

Unsloth 可通过三种方式使用:Unsloth Desktop(桌面应用)、Unsloth Studio(Web UI)或 Unsloth Core(基于代码的版本)。

Unsloth Desktop(推荐)

平台 链接
Windows 下载
macOS 下载
Linux / Ubuntu (deb) 下载
Linux (AppImage) 下载

Unsloth Studio(Web UI)

macOS、Linux、WSL:

curl -fsSL https://unsloth.ai/install.sh | sh

Windows:

irm https://unsloth.ai/install.ps1 | iex

启动

unsloth studio

HTTP 安全部署

unsloth studio --secure

Docker

使用我们的 Docker 镜像 unsloth/unsloth 容器。运行:

docker run -d -e JUPYTER_PASSWORD="mypassword" \
  -p 8888:8888 -p 8000:8000 -p 2222:22 \
  -v $(pwd)/work:/workspace/work \
  --gpus all \
  unsloth/unsloth

远程 HTTPS 与局域网访问

服务端工具默认开启——请务必谨慎!妥善保管好密码,或在对外暴露 Unsloth 时使用 --disable-tools

公网 HTTPS 访问: 会创建一个免费的 Cloudflare 链接来提供 Unsloth 服务——你可以在全球范围内访问该链接(甚至可以直接在手机上访问!)

unsloth studio --secure

-H 0.0.0.0 以及不同的端口也可以正常工作:

unsloth studio -H 0.0.0.0 -p 8888

局域网访问(家庭网络)Settings > API keys > LAN access

密码管理与无头启动

无头启动:

UNSLOTH_STUDIO_PASSWORD='your-strong-password' unsloth studio --secure   # via env var

重置您的密码:

unsloth studio reset-password

开发、Nightly、卸载

如需查看开发、Nightly 及卸载等相关说明,请参阅高级安装

Unsloth Core(代码方式)

Linux、WSL:

curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv unsloth_env --python 3.13
source unsloth_env/bin/activate
uv pip install unsloth --torch-backend=auto

Windows:

winget install -e --id Python.Python.3.13
winget install --id=astral-sh.uv  -e
uv venv unsloth_env --python 3.13
.\unsloth_env\Scripts\activate
uv pip install unsloth --torch-backend=auto

AMD、Intel、DGX Spark、Blackwell:

请查阅我们的 Blackwell 指南DGX Spark 指南
若要在 AMDIntel GPU 上安装 Unsloth,请按照我们的 AMD 指南Intel 指南 操作。

📒 免费 Notebook

使用我们的 Notebook 即可免费训练。 阅读我们的 指南,添加数据集,运行后部署训练好的模型。

模型 免费 Notebook 性能 内存占用
Unsloth Studio ▶️ 免费开始
Gemma 4 (E2B) ▶️ 免费开始 快 1.5 倍 减少 50%
Qwen3.5 (4B) ▶️ 免费开始 快 1.5 倍 减少 60%
gpt-oss (20B) ▶️ 免费开始 快 2 倍 减少 70%
Qwen3.5 GSPO ▶️ 免费开始 快 2 倍 减少 70%
gpt-oss (20B): GRPO ▶️ 免费开始 快 2 倍 减少 80%
Qwen3: Advanced GRPO ▶️ 免费开始 快 2 倍 减少 70%
embeddinggemma (300M) ▶️ 免费开始 快 2 倍 减少 20%
Llama 3.1 (8B) Alpaca ▶️ 免费开始 快 2 倍 减少 70%
Llama 3.2 Conversational ▶️ 免费开始 快 2 倍 减少 70%
Orpheus-TTS (3B) ▶️ 免费开始 快 1.5 倍 减少 50%

🦥 Unsloth 资讯

  • AMD 训练:在 Windows、WSL 和 Linux 的 AMD GPU 上训练、运行 RL、对话和部署。 指南
  • 任意智能体可用的本地模型:使用 unsloth start,通过 Unsloth 兼容 OpenAI 与 Anthropic 的 API,连接 Claude Code、Codex、Hermes、OpenCode、OpenClaw 等。 指南
  • GLM-5.2:通过 Unsloth 动态 GGUF,在本地运行 Z.ai 的 744B 参数、1M 上下文开源模型。 指南
  • DeepSeek-V4:在本地运行 DeepSeek-V4-Flash,修正多轮对话与工具调用行为。 指南
  • Gemma 4:支持 QAT、MTP、GGUF 与 MLX,可运行并训练 Gemma 4 文本、图像与音频模型。 指南
  • MCP 服务器:通过 Model Context Protocol 将本地模型连接至文件、应用、数据库和外部工具。 指南
  • 新模型Qwen-AgentWorld, Ornith, Kimi K2.7 CodeMiniMax M3
更多资讯
  • 连接:在同一界面中混合使用本地模型与 API 提供商(OpenAI、Anthropic)或服务器(vLLM、Ollama)。 指南
    • 发布 Unsloth Studio:我们全新的 Web UI,用于运行与训练 LLM。 博客
    • DiffusionGemma:在 Unsloth Studio 中运行并微调 Google 的扩散语言模型,推理速度提升 1.8 倍。 指南
    • Qwen3.6:使用 MTP 运行并训练 Qwen3.6,推理速度提升 1.4-2.2 倍,并为支持的 GPU 提供 NVFP4 量化。 指南
    • 减少 35% VRAM,将 MoE LLM 训练提速 12 倍——支持 DeepSeek、GLM、Qwen 与 gpt-oss。 博客
    • Embedding 模型:Unsloth 现已支持约 1.8-3.3 倍更快的 Embedding 微调。 博客笔记本
    • 相比其他所有配置,借助全新的批处理算法,实现 上下文长度提升 7 倍的 RL博客
    • 全新 RoPE & MLP Triton KernelsPadding Free + Packing:训练速度提升 3 倍,VRAM 减少 30%。 博客
    • 500K 上下文:如今,在 80GB GPU 上即可训练具有 >500K 上下文的 20B 模型。 博客
    • FP8 与视觉 RL:现在可以在消费级 GPU 上执行 FP8 与 VLM GRPO。 FP8 博客视觉 RL

📥 高级安装

以下高级安装说明适用于 Unsloth Studio。如需 Unsloth Core 的高级安装,请查看我们的文档

开发者 / 夜间 / 实验版安装:macOS、Linux、WSL:

开发者版安装会从 main 分支构建,该分支为最新(夜间版)源代码。

git clone https://github.com/unslothai/unsloth
cd unsloth
./install.sh --local
unsloth studio -p 8888

要将其安装到独立位置,请设置 UNSLOTH_STUDIO_HOME

UNSLOTH_STUDIO_HOME="$PWD/.studio" ./install.sh --local
UNSLOTH_STUDIO_HOME="$PWD/.studio" unsloth studio -p 8888

然后更新:

cd unsloth && git pull
./install.sh --local
unsloth studio -p 8888

开发者 / 每日构建 / 实验性安装:Windows PowerShell:

开发者安装基于 main 分支构建,即最新的(每日构建)源代码。

git clone https://github.com/unslothai/unsloth.git
cd unsloth
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\install.ps1 --local
unsloth studio -p 8888

如需安装到独立目录,请设置 UNSLOTH_STUDIO_HOME

$env:UNSLOTH_STUDIO_HOME="$PWD\.studio"; .\install.ps1 --local
$env:UNSLOTH_STUDIO_HOME="$PWD\.studio"; unsloth studio -p 8888

接下来进行更新:

cd unsloth; git pull
.\install.ps1 --local
unsloth studio -p 8888

高级启动选项

跳过 PyTorch(仅 GGUF 模式):

curl -fsSL https://unsloth.ai/install.sh | UNSLOTH_NO_TORCH=1 sh
$env:UNSLOTH_NO_TORCH=1; irm https://unsloth.ai/install.ps1 | iex

跳过安装后启动 Unsloth 的提示(适用于自动化安装):

curl -fsSL https://unsloth.ai/install.sh | UNSLOTH_SKIP_AUTOSTART=1 sh
$env:UNSLOTH_SKIP_AUTOSTART=1; irm https://unsloth.ai/install.ps1 | iex

固定 Python 版本:

curl -fsSL https://unsloth.ai/install.sh | UNSLOTH_PYTHON=3.12 sh
$env:UNSLOTH_PYTHON='3.12'; irm https://unsloth.ai/install.ps1 | iex

使用 UNSLOTH_STUDIO_HOME 安装到自定义位置:

curl -fsSL https://unsloth.ai/install.sh | UNSLOTH_STUDIO_HOME=/abs/path sh
$env:UNSLOTH_STUDIO_HOME='C:\path'; irm https://unsloth.ai/install.ps1 | iex

使用 UNSLOTH_NPM_REGISTRY 将前端构建指向企业 npm 镜像/代理:

UNSLOTH_NPM_REGISTRY=https://artifactory.example.com/api/npm/npm/ ./install.sh --local
$env:UNSLOTH_NPM_REGISTRY='https://artifactory.example.com/api/npm/npm/'; .\install.ps1 --local

在高核主机上限制 Unsloth 的原生 CPU 线程池:UNSLOTH_CPU_THREADS=8 unsloth studio -p 8888

Vulkan、自定义 llama.cpp 后端:

可在安装时强制指定后端:

export UNSLOTH_LLAMA_CPP_BACKEND=vulkan   # or cpu, cuda, rocm, auto
curl -fsSL https://unsloth.ai/install.sh | sh
$env:UNSLOTH_LLAMA_CPP_BACKEND="vulkan"   # or cpu, cuda, rocm, auto
irm https://unsloth.ai/install.ps1 | iex

卸载

MacOS、WSL、Linux: curl -fsSL https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.sh | sh

Windows(PowerShell): irm https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.ps1 | iex

如需了解更多信息,请参阅我们的文档

删除模型文件

你可以从模型搜索中的垃圾桶图标删除旧模型文件,也可以从默认 Hugging Face 缓存目录中移除相应的已缓存模型文件夹。默认情况下,HF 使用:

MacOS、Linux、WSL: ~/.cache/huggingface/hub/

Windows: %USERPROFILE%\.cache\huggingface\hub\

💚 社区与链接

类型 链接
Discord 加入 Discord 服务器
r/unsloth Reddit 加入 Reddit 社区
📚 文档与维基 阅读我们的文档
Twitter (aka X) 在 X 上关注我们
🔮 我们的模型 Unsloth 目录
✍️ 博客 阅读我们的博客

引用

你可以按以下方式引用 Unsloth 仓库:

@software{unsloth,
  author = {Daniel Han, Michael Han and Unsloth team},
  title = {Unsloth},
  url = {https://github.com/unslothai/unsloth},
  year = {2023}
}

如果你使用 🦥Unsloth 训练过模型,不妨使用这张超酷贴纸!

许可证

Unsloth 采用 Apache 2.0 与 AGPL-3.0 的双重许可模式。Unsloth 核心包继续采用 Apache 2.0,而某些可选组件,例如 Unsloth Studio UI,则采用开源许可 AGPL-3.0

这一结构有助于支持 Unsloth 的持续开发,同时保持项目开源,并推动更广泛的生态不断发展。

致谢

  • 感谢 llama.cpp 库,让用户能够使用 Unsloth 运行并保存模型
  • 感谢 Hugging Face 团队及其 transformersTRL
  • 感谢 Pytorch 与 Torch AO 团队的贡献
  • 感谢 NVIDIA 的 NeMo DataDesigner 库及其贡献
  • 当然,也要感谢每一位为 Unsloth 作出贡献或使用过 Unsloth 的人!