# Unsloth 需求

Unsloth 可以通过两种方式使用：通过 [Unsloth Studio](https://unsloth.ai/docs/zh/xin/studio/install)，Web UI，或通过 [Unsloth Core](#unsloth-core-requirements)，原始的基于代码版本。每种都有不同的要求。

## **Unsloth Studio 要求**

* **Mac：** 类似 CPU - [聊天](https://unsloth.ai/docs/zh/xin/studio/chat#using-unsloth-studio-chat) + [数据食谱](https://unsloth.ai/docs/zh/xin/studio/data-recipe) 目前可用。 **MLX** 训练很快就会推出。
* **CPU：Unsloth 在没有 GPU 的情况下仍可运行**，用于聊天 + 数据食谱。
* **训练：** 可在以下设备上运行 **NVIDIA**：RTX 30、40、50、Blackwell、DGX Spark/Station 等 + **Intel** GPU
* **即将推出：** 支持 **Apple MLX** 和 **AMD**.

### <i class="fa-windows">:windows:</i> Window**s**

Unsloth Studio 可直接在 Windows 上运行，无需 WSL。要训练模型，请确保你的系统满足以下要求：

**要求**

* Windows 10 或 Windows 11（64 位）
* 已安装驱动程序的 NVIDIA GPU
* **App Installer** （包括 `winget`): [这里](https://learn.microsoft.com/en-us/windows/msix/app-installer/install-update-app-installer)
* **Git**: `winget install --id Git.Git -e --source winget`
* **Python**：版本 3.11 到 3.14 之前（不含 3.14）
* 在 Python 环境中工作，例如 **uv**, **venv**，或 **conda/mamba**

### <i class="fa-apple">:apple:</i> MacOS

Unsloth Studio 可在 Mac 设备上用于 [聊天](#run-models-locally) 用于 GGUF 模型和 [数据食谱](https://unsloth.ai/docs/zh/xin/studio/data-recipe) ([导出](https://unsloth.ai/docs/zh/xin/studio/export) 即将推出）。 **MLX 训练即将推出！**

* macOS 12 Monterey 或更新版本（Intel 或 Apple Silicon）
* 安装 Homebrew： [这里](https://brew.sh/)
* Git： `brew install git`&#x20;
* cmake： `brew install cmake`&#x20;
* openssl： `brew install openssl`
* Python：版本 3.11 到 3.14 之前（不含 3.14）
* 在 Python 环境中工作，例如 **uv**, **venv**，或 **conda/mamba**

### <i class="fa-linux">:linux:</i> Linux 和 WSL

* Ubuntu 20.04+ 或类似发行版（64 位）
* 已安装驱动程序的 NVIDIA GPU
* CUDA 工具包（推荐 12.4+，blackwell 需 12.8+）
* Git： `sudo apt install git`
* Python：版本 3.11 到 3.14 之前（不含 3.14）
* 在 Python 环境中工作，例如 **uv**, **venv**，或 **conda/mamba**

### <i class="fa-microchip">:microchip:</i> 仅 CPU

Unsloth Studio 支持 CPU 设备用于 [聊天](#run-models-locally) 用于 GGUF 模型和 [数据食谱](https://unsloth.ai/docs/zh/xin/studio/data-recipe) ([导出](https://unsloth.ai/docs/zh/xin/studio/export) 即将推出）

* 与上面提到的 Linux 要求相同（不包括 NVIDIA GPU 驱动）以及 MacOS。

### **训练**

Unsloth Studio 训练目前可在 NVIDIA GPU 上运行，AMD、MLX、Intel 支持即将推出。你仍然可以使用 [原始的 Unsloth Core](#unsloth-requirements) 在 AMD 和 Intel 设备上训练。 **需要 Python 3.11–3.13** 。

| 要求           | Linux / WSL                   | Windows                        |
| ------------ | ----------------------------- | ------------------------------ |
| **Git**      | 通常已预装                         | 由设置脚本安装（`winget`)              |
| **CMake**    | 已预装或 `sudo apt install cmake` | 由设置脚本安装（`winget`)              |
| **C++ 编译器**  | `build-essential`             | Visual Studio Build Tools 2022 |
| **CUDA 工具包** | 可选； `nvcc` 自动检测               | 由设置脚本安装（与驱动程序匹配）               |

## Unsloth Core 要求

* **操作系统**：可在 Linux 和 [Windows](https://docs.unsloth.ai/get-started/install-and-update/windows-installation)
* 自 2018+ 起支持 NVIDIA GPU，包括 [Blackwell RTX 50](https://unsloth.ai/docs/zh/bo-ke/fine-tuning-llms-with-blackwell-rtx-50-series-and-unsloth) 和 [DGX Spark](https://unsloth.ai/docs/zh/bo-ke/fine-tuning-llms-with-nvidia-dgx-spark-and-unsloth)
* 最低 CUDA 能力 7.0（V100、T4、Titan V、RTX 20 和 50、A100、H100、L40 等） [检查你的 GPU！](https://developer.nvidia.com/cuda-gpus) GTX 1070、1080 可以运行，但速度较慢。
* 官方 [Unsloth Docker 镜像](https://hub.docker.com/r/unsloth/unsloth) `unsloth/unsloth` 可在 Docker Hub 上获取
  * [docker](https://unsloth.ai/docs/zh/kai-shi-shi-yong/install/docker "mention")
* Unsloth 可在 [AMD](https://unsloth.ai/docs/zh/kai-shi-shi-yong/install/amd) 和 [Intel](https://unsloth.ai/docs/zh/kai-shi-shi-yong/install/intel) GPU 上运行（请参考我们的 [特定指南](https://unsloth.ai/docs/zh/kai-shi-shi-yong/install)）。Apple/Silicon/MLX 正在开发中
* 你的设备应具备 `xformers`, `torch`, `BitsandBytes` 和 `triton` 支持。
* 如果你有不同版本的 torch、transformers 等， `pip install unsloth` 将自动安装这些库的所有最新版本，因此你无需担心版本兼容性。

{% hint style="info" %}
支持 Python 3.13！
{% endhint %}

### 微调 VRAM 要求：

使用 Unsloth 进行 LLM 微调需要多少 GPU 内存？

{% hint style="info" %}
一个常见的问题是当你 OOM 或内存不足时，往往是因为把 batch size 设得太高。将其设为 1、2 或 3 可使用更少的 VRAM。

**有关上下文长度基准，请参见** [**这里**](https://unsloth.ai/docs/zh/ji-chu/unsloth-benchmarks#context-length-benchmarks)**.**
{% endhint %}

请查看此表，其中按模型参数和微调方法列出了 VRAM 要求。QLoRA 使用 4 位，LoRA 使用 16 位。请注意，有时根据模型可能需要更多 VRAM，因此这些数字是绝对最低值：

| 模型参数 | QLoRA（4 位）VRAM | LoRA（16 位）VRAM |
| ---- | -------------- | -------------- |
| 3B   | 3.5 GB         | 8 GB           |
| 7B   | 5 GB           | 19 GB          |
| 8B   | 6 GB           | 22 GB          |
| 9B   | 6.5 GB         | 24 GB          |
| 11B  | 7.5 GB         | 29 GB          |
| 14B  | 8.5 GB         | 33 GB          |
| 27B  | 22GB           | 64GB           |
| 32B  | 26 GB          | 76 GB          |
| 40B  | 30GB           | 96GB           |
| 70B  | 41 GB          | 164 GB         |
| 81B  | 48GB           | 192GB          |
| 90B  | 53GB           | 212GB          |
| 405B | 237 GB         | 950 GB         |
