> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/zh/ji-chu-zhi-shi/amd.md).

# 使用 Unsloth 在 AMD GPU 上训练和运行模型

Unsloth 现在正式支持 AMD 硬件，可轻松在 AMD GPU 上本地运行、训练、微调、进行 RL 以及部署模型。完全开源， [Unsloth](/docs/zh/desktop.md) 可在 Windows、WSL 和 Linux 上运行，支持 RDNA 1–4、Radeon RX 9000 和 7000 系列 GPU、Instinct MI350 和 MI300 数据中心 GPU、Vulkan、由 Strix Halo 驱动的 Ryzen AI Max 系统等。

我们与 [AMD](https://www.amd.com/en/developer/resources/technical-articles/2026/train-and-run-models-on-amd-gpus-with-unsloth.html) 以及我们的社区合作，实现了所有模型最多 2 倍更快、VRAM 使用减少 70% 的训练，而且没有精度损失。如果你没有 GPU，Unsloth 仍支持原生 AMD 推理，用于 [Qwen3.6](/docs/zh/mo-xing/qwen3.6.md), [Gemma 4](/docs/zh/mo-xing/gemma-4.md)、DeepSeek-V4、GLM 5.2、DiffusionGemma、Kimi K2.7 以及其他模型。

<a href="/docs/zh/ji-chu-zhi-shi/amd.md#installing-unsloth-on-amd" class="button primary" data-icon="bolt">快速开始</a><a href="/docs/zh/ji-chu-zhi-shi/amd.md#id-2x-faster-training-and-50-more-accurate-tool-calls" class="button secondary" data-icon="star">功能</a><a href="https://github.com/unslothai/unsloth" class="button secondary" data-icon="github">Github</a>

{% hint style="success" %}
**9月18日更新：** 新增 **RDNA 1、2、Gorgon Halo、Vulkan 支持** + 修复了在 AMD GPU 上无法检测到 GPU 的问题。\
更好地自动修复和捕获 RDNA4、HIP / ROCm 失败。
{% endhint %}

要在 AMD 上安装 Unsloth，最简单的方法是下载我们的 [桌面应用](/docs/zh/desktop.md).

<a href="https://unsloth.ai/download/windows" class="button secondary" data-icon="windows">下载 Windows 版</a><a href="https://unsloth.ai/download/linux" class="button secondary" data-icon="linux">下载 Linux 版</a>\
\
手动安装：

**MacOS、Linux、WSL：**

{% code overflow="wrap" expandable="true" %}

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

{% endcode %}

**Windows Powershell：**

<pre class="language-powershell" data-overflow="wrap"><code class="lang-powershell"><strong>irm https://unsloth.ai/install.ps1 | iex 
</strong></code></pre>

### ⭐ 功能

Unsloth 同时支持 AMD 的推理和训练，所以如果你没有 GPU 只有 CPU，仍然可以使用 Unsloth 运行模型。使用 Unsloth 时，你将获得：

* [**工具调用修复**](/docs/zh/xin/studio/chat.md#auto-healing-tool-calling) **用于推理，可将准确率提升 50%**，无限免费 [网页搜索](/docs/zh/xin/studio/chat.md#advanced-web-search)、HTML 画布、 [**通过 Cloudflare 进行安全 HTTPS 部署**](#unsloth-on-phones-and-remote-https-tunneling) 以及 [代码执行](/docs/zh/xin/studio.md#execute-code--heal-tool-calling) 全部工作。
* **在 8GB VRAM 中训练 Gemma 4 模型** 或在 3GB VRAM 中训练 Qwen3.5。Triton 内核、数学算法和内存技巧使 AMD 的 VRAM 使用减少 70%，且没有精度损失。
* 最多 **为以下场景减少 80% 的 VRAM 使用：** [**强化学习**](/docs/zh/kuai-su-kai-shi/reinforcement-learning-rl-guide/grpo-long-context.md) ，例如 GRPO。并通过与 vLLM 共享权重来节省 50% 的内存使用。
* 为以下内容提供优化支持： **RDNA 3** 及更新的 GPU 和数据中心级 GPU。Strix Halo 也已针对 Linux、WSL 和 Windows 进行优化。

{% columns %}
{% column %}

* [**将**](/docs/zh/ji-cheng/unsloth-start.md) **你的本地模型连接到任何 agent 运行框架**: [Claude Code](/docs/zh/ji-chu-zhi-shi/claude-code.md), [Codex](/docs/zh/ji-chu-zhi-shi/codex.md), [Hermes](/docs/zh/ji-cheng/hermes-agent.md), [OpenClaw](/docs/zh/ji-cheng/openclaw.md) 等。
* 支持几乎 **所有模型**的推理和训练，包括最新的 [DeepSeek-V4](/docs/zh/mo-xing/deepseek-v4.md), [GLM-5.2](/docs/zh/mo-xing/glm-5.2.md), [Kimi-K2.7](/docs/zh/mo-xing/kimi-k2.7-code.md), [MiniMax M3](/docs/zh/mo-xing/minimax-m3.md), [DiffusionGemma](/docs/zh/mo-xing/diffusiongemma.md), [Inkling](/docs/zh/mo-xing/inkling.md) 等等！
* AMD 多 GPU 支持 + VRAM/RAM 跟踪。 `llama.cpp` 每天都会提供 ROCm 预编译版本，所以你始终能获得最新的模型更新！
  {% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fszoidwwj70dLm5vBjpmL%2Fdiffusiongemma.gif?alt=media&amp;token=8ce359fd-f92c-4cf8-a491-06b04c505cb7" alt="" width="375"><figcaption><p>在 AMD GPU 上运行的 DiffusionGemma</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

### ⚡快速开始

Unsloth 会自动安装最适合的 ROCm 构建版本，包括 PyTorch、llama.cpp 预编译版、bitsandbytes、ROCm 优化内核和 Triton。我们也会一并提供 AMD 优化和修复。你可以阅读我们更 [详细指南这里](#guide-to-using-unsloth-on-amd) 了解更多细节。

我们已让 Windows 和 WSL 用户的 Unsloth 安装变得无缝——但通常我们仍建议直接使用 Linux，因为它支持最全面。Unsloth 支持 MacOS、Linux、 [Windows](/docs/zh/kuai-su-kai-shi/install/windows-installation.md), [NVIDIA](/docs/zh/kuai-su-kai-shi/install/pip-install.md)、Intel 和 CPU 配置。参见： [Unsloth 要求](/docs/zh/kuai-su-kai-shi/fine-tuning-for-beginners/unsloth-requirements.md)。更新使用相同的命令！

**MacOS、Linux、WSL：**

{% code overflow="wrap" %}

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

{% endcode %}

**Windows PowerShell：**

{% code overflow="wrap" %}

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

{% endcode %}

{% columns %}
{% column %}
Unsloth 会自动安装 ROCm、PyTorch、自定义 llama.cpp 预编译版等！

#### 远程访问 Unsloth

我们还启用了 [Cloudflare HTTPS 隧道](#unsloth-on-phones-and-remote-https-tunneling) ，完全免费——因此你可以通过 HTTPS 安全地远程访问 Unsloth。
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FsnKMaYneotmsSaEvA2mU%2Finstall%201.png?alt=media&amp;token=bbfba550-a47e-4273-80f5-a21bfc44717c" alt=""><figcaption><p>在 AMD Windows 机器上安装 Unsloth</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

#### :inbox\_tray: 安装 Unsloth Notebooks 和 pip install

如果你只想使用普通的 Unsloth notebooks，请查看通用 [AMD](/docs/zh/kuai-su-kai-shi/install/amd.md) 安装指南。务必阅读[AMD](/docs/zh/kuai-su-kai-shi/install/amd.md) 安装指南！在完成 PyTorch 和 ROCm 的安装后，请执行：

{% code overflow="wrap" %}

```bash
uv pip freeze | grep -E '^(torch|torchvision|torchaudio)==' > torch-pins.txt
echo "triton ; sys_platform == 'never'" >> torch-pins.txt
echo "xformers ; sys_platform == 'never'" >> torch-pins.txt
uv pip install "unsloth[amd]" --overrides torch-pins.txt
```

{% endcode %}

#### :play\_pause:Unsloth Start

{% columns %}
{% column width="58.333333333333336%" %}
[Unsloth Start](/docs/zh/ji-cheng/unsloth-start.md) 让你连接 [Claude Code](/docs/zh/ji-chu-zhi-shi/claude-code.md), [Codex](/docs/zh/ji-chu-zhi-shi/codex.md) 以及其他代理到本地模型，通过 `unsloth start` 命令。

启动 Unsloth，打开你的项目文件夹，然后运行：

{% code overflow="wrap" %}

```bash
unsloth start claude --model \
    unsloth/gemma-4-E2B-it-GGUF:UD-Q4_K_XL
```

{% endcode %}

替换 `claude` 为下面任意一个代理：
{% endcolumn %}

{% column width="41.666666666666664%" %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FpXE6kCHjh8qOEaggf94M%2FScreenshot_20260718_122426.png?alt=media&amp;token=a59e4c8c-efdb-451b-b1f8-621955564f6d" alt="" width="563"><figcaption><p>Claude Code 在本地运行 Qwen3.5。</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

| 代理                                                                 | 命令                       |
| ------------------------------------------------------------------ | ------------------------ |
| <i class="fa-claude">:claude:</i> Claude Code                      | `unsloth start claude`   |
| <i class="fa-openai">:openai:</i> OpenAI Codex                     | `unsloth start codex`    |
| <i class="fa-caduceus">:caduceus:</i> Hermes Agent                 | `unsloth start hermes`   |
| <i class="fa-lobster">:lobster:</i> OpenClaw                       | `unsloth start openclaw` |
| <i class="fa-rectangle-vertical">:rectangle-vertical:</i> OpenCode | `unsloth start opencode` |

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fs6AKlSRUrfdwYDIZpcjN%2Fimage(6).png?alt=media&amp;token=d8042094-2df1-4737-b806-08a77e45e105" alt=""><figcaption><p>Claude 实例彼此完全隔离</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FahmAqUZMFFI3VouqwIYf%2Fimage(5).png?alt=media&amp;token=0dd84f49-16cf-4799-a1d3-e6cbbe105115" alt=""><figcaption><p>运行 unsloth/gemma-4-E2B-it dynamic 4bit 的 Codex</p></figcaption></figure></div>

### :bar\_chart: AMD 分析

我们将为非 AMD GPU 所做的许多优化移植过来，让 AMD GPU 发挥更出色！让 AMD 训练在 Windows 设备上正常工作，并确保几乎所有 AMD 设备都能兼容，这花了很多工作，但我们对当前状态感到满意。我们仍在积极让 AMD GPU 变得更好！下面是我们在 AMD MI300X 上进行的一些分析/基准测试。

#### 强化学习：更准确的 LoRA 和 QLoRA

在 AMD 上进行 RL 时，Unsloth 支持 **权重共享** ，与 vLLM 一起，如 [内存高效的 RL](/docs/zh/kuai-su-kai-shi/reinforcement-learning-rl-guide/memory-efficient-rl.md). 我们 **将内存使用减半** ，方法是直接访问 vLLM 对模型的分配。

在 LoRA 和 QLoRA 过程中，我们也不会像下面这样对 LoRA 权重进行合并和拆分：

$$
W = W + sAB \\
\text{inference} = XW \\
W = W - sAB
$$

上面的做法会引发问题，因为 **由于舍入，IEEE 浮点数不满足结合律**。当 W 处于 BF16 时，这会在像其他 RL 引擎那样做减法时引入细微差异。这意味着在 IEEE 的世界里：

$$
W \ne(W + sAB) - (sAB)
$$

而当 W 处于只有少量尾数位的 bfloat16 中时，它会 **将小数四舍五入为零**。由于在 LoRA 期间 A 和 B 都是 float32，这意味着在合并和拆分后，W 会随着时间推移发生漂移。Unsloth 直接使用 vLLM 的 LoRA 路径，因此我们避免了这一点。基础权重从不被编辑，也永远不会漂移。

#### 更快的强化学习

{% columns %}
{% column %}
我们对其他使用 FA2 和 vLLM 同地部署的设置进行了基准测试。二者都使用 vLLM 进行生成，Unsloth 将更多步骤推进到生成阶段，同时使训练大约快 2 倍。

这三个基准测试都可复现：相同的随机种子、相同的 token 预算，而且两个栈之间的损失曲线一致。
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F31TQsJ8fBG7Vts7u37J8%2Fchart_grpo_combined.png?alt=media&amp;token=719e2729-839e-4287-aa00-5e3b77e1ad7b" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

#### 更快且更节省内存的训练

在 Llama-3.1-8B LoRA SFT（batch 2 x grad-accum 4 x 2048 = 16,384 tokens/step，已打包）上，Unsloth 的训练速度为 2.07 s/step，而 TRL + FA2 为 2.87 s/step，并且峰值为 18.3 GB，而后者为 24.3 GB。这意味着速度快 1.39 倍，内存使用少 1.33 倍，而且准确率没有变化。我们计划把它做得更好！

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F1YySU2nLYyKoSyXh8lsi%2Fchart_llama8b_vram_over_time.png?alt=media&amp;token=526b2488-315e-487b-8baa-ee71d5e1408a" alt=""><figcaption></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FJQH7QTamM7zuK45NNnZY%2Fchart_llama8b_sft_efficiency.png?alt=media&amp;token=81388e0a-e9ca-433d-9cca-1b32f406043b" alt=""><figcaption></figcaption></figure></div>

内存节省不只是峰值更低，而是在整个运行过程中都能保持。每 0.1 秒采样一次已分配的 VRAM，Unsloth 在整个过程中都保持平稳且较低，而其他设置 + FA2 几乎每一步都会飙升到 22.8 GB，并且完成所需时间更长（同样 25 步时为 75 秒，而 Unsloth 为 56 秒）。

### :sparkles:受支持的 AMD 硬件

Unsloth 对 AMD 的支持主要面向常见的消费级、工作站和数据中心 GPU。训练、Unsloth Studio 以及 GGUF/llama.cpp 推理支持会因架构而异，因此下表将优化支持与兼容路径分开列出。

<table><thead><tr><th>架构</th><th>系列</th><th width="159">gfx</th><th>支持</th><th>平台</th></tr></thead><tbody><tr><td>RDNA 4</td><td>Radeon™ RX 9000 系列</td><td>gfx1200, gfx1201</td><td>完整</td><td>Windows + WSL + Linux</td></tr><tr><td>RDNA 3.5</td><td>Ryzen AI 300 / Ryzen AI MAX（Strix Halo）</td><td>gfx1150, gfx1151, gfx1152</td><td>完整</td><td>Windows + WSL + Linux</td></tr><tr><td>RDNA 3</td><td>Radeon™ RX 7000 系列</td><td>gfx1100, gfx1101, gfx1102</td><td>完整</td><td>Windows + WSL + Linux</td></tr><tr><td>RDNA 2</td><td>Radeon™ RX 6000 系列</td><td>gfx1030, gfx1031, gfx1032, gfx1034</td><td>完整</td><td>Windows + WSL + Linux</td></tr><tr><td>RDNA 1</td><td>Radeon™ RX 5000 系列</td><td>gfx1010, gfx1012</td><td>完整</td><td>Windows + WSL + Linux</td></tr><tr><td>CDNA 4</td><td>Instinct™ MI350 系列 GPU</td><td>gfx950</td><td>完整</td><td>仅限 Linux</td></tr><tr><td>CDNA 3</td><td>Instinct™ MI300 系列 GPU</td><td>gfx940, gfx941, gfx942</td><td>完整</td><td>仅限 Linux</td></tr><tr><td>CDNA 2</td><td>Instinct™ MI200 系列 GPU</td><td>gfx90a</td><td>完整</td><td>仅限 Linux</td></tr><tr><td>CDNA 1</td><td>Instinct™ MI100 系列 GPU</td><td>gfx908</td><td>完整</td><td>仅限 Linux</td></tr></tbody></table>

### :desktop: 在 AMD 上使用 Unsloth 指南

安装后，你可以在浏览器中打开 Unsloth Studio。从那里，你可以在 AMD 硬件上自动运行和微调本地 LLM。详细安装说明见下文：

{% columns %}
{% column width="50%" %} <a href="/docs/zh/kuai-su-kai-shi/install/amd.md" class="button primary">AMD 安装指南</a><a href="/docs/zh/xin/studio/install.md" class="button primary">安装 Unsloth Studio</a>

选择你的模型、数据集和训练设置即可开始。例如，你可以在 Gemma 4 12B 上进行 QLoRA 4-bit 微调，使用约 16k 的上下文长度、LoRA rank 16、学习率 0.0002，以及最多 30 步。
{% endcolumn %}

{% column width="50%" %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F2GbvLBqN03qsvh5N9Uq1%2Fft%20studio.png?alt=media&amp;token=71fd643b-32f1-4f7f-8183-1e1fa97e80c0" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
Unsloth Studio 的微调界面完全可自定义，让你配置模型、数据集和训练参数。在训练期间，Unsloth 会实时跟踪进度，包括 loss、RAM 和 VRAM 使用情况，以及多 GPU 支持。一旦训练开始，你就会看到实时绘制的进度图。

训练完成后，你可以访问历史记录查看过去和正在进行的训练会话。从任何已微调模型中选择，以查看过去的训练日志：
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhATsVSzX50cDHFtnfRAN%2Fimage.png?alt=media&amp;token=ce89695a-1579-4ae5-8423-e3ddace69f8e" alt="" width="563"><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

<div align="left"><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fxm20hpZ7TK1y3xrzN6vp%2Fimage.png?alt=media&amp;token=77d9959c-4415-4f49-9413-684e83a3f4b8" alt="" width="563"><figcaption></figcaption></figure></div>

{% columns %}
{% column %}
训练完成后，你可以将模型导出为 GGUF、合并后的模型 safetensors，或 LoRA Adapter，以便在 Hugging Face、llama.cpp、vLLM 或 Unsloth 上部署。对于 GGUF 导出，Unsloth 会使用与 AMD 适配的 llama.cpp ROCm 预编译版本，并与你的 gfx 架构匹配；如果没有可用的预编译版本，则回退为源代码编译。导出完成后，你会看到导出成功完成。你也可以直接将模型推送到 Hugging Face Hub。
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FDVdUSCq0apPcx5mU2AYq%2Fimage.png?alt=media&amp;token=481db1ed-bae7-44c5-976e-2f5e85f886b6" alt="" width="563"><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
将你的模型导出为你偏好的格式，并将其部署到任意位置。导出后，可从 New Chat 或 Recents 中模型下拉框的 Fine-tuned 部分加载你的微调模型。

从下拉菜单中选择你的微调模型，并在 Unsloth 中直接与它对话。你现在可以在 New Chat、Recents 或 Projects 中使用你训练或下载的模型。开启 think、code 和 search 开关以获得最佳体验，并查看 [Unsloth Studio Chat](https://unsloth.ai/docs/new/studio/chat) 文档了解更多细节。
{% endcolumn %}

{% column %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FRcgOQ8zbfLAYhypopa0V%2Fimage.png?alt=media&amp;token=393d9bb3-1eb7-4171-9dd3-ef0377a176d5" alt="" width="407"><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

最后，你还可以在 Unsloth 中直接与新微调的模型对话！

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FCGaDuaOaNNzd6NrtpnD5%2Funsloth%20studio%20chat%20screenshot.png?alt=media&amp;token=d179749f-f027-4ab4-8082-f1c87b8a59be" alt=""><figcaption></figcaption></figure>

你还可以像 vLLM 日志一样在终端中监控吞吐量和生成 token/s。你将看到 `"gen_tok_s"` 它表示 tokens/s，以及 `"prompt_tok_s"` 它表示提示处理。

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F0wOZYG4Y72hZInt9BBjk%2Fthroughput.png?alt=media&amp;token=102dcc3a-75e6-4b7e-9631-4cd3115f7df9" alt=""><figcaption></figcaption></figure>

### :mobile\_phone:手机上的 Unsloth 和远程 HTTPS 隧道

我们添加了 **免费** 的 Cloudflare HTTPS 隧道用于 Unsloth（类似 LM Link），因此你可以通过链接或任何其他电脑，在手机上（iPhone、Android——任何手机！）远程聊天/训练模型！这适用于 Mac、Linux、WSL 和 Windows 设备。

* 从手机上训练和微调 / **远程进行，并带有实时训练损失日志** - 可以取消或重新训练！
* 随时随地在浏览器中聊天，支持工具调用和实时流式传输。
* 真实的 **可交互 HTML 画布** 直接在手机上输出——玩由 LLM 制作的游戏！

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FfuLfgQ7m7gB5IK8fZdDo%2Fphone%20inference.png?alt=media&amp;token=a7aec44c-02b8-483d-ab5b-7268f802a3e9" alt="" width="188"><figcaption><p>远程聊天！</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FlmeAQLZAFGGy21rDmBUn%2Fphone%20thinking.png?alt=media&amp;token=6f0fe9a6-c849-4ff0-bd7d-dea8dbffd222" alt="" width="188"><figcaption><p>实时推理 + 工具调用</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FEQWneGD6ncfYTe6NugtO%2Fphone%20training%20logs.png?alt=media&amp;token=1c830286-f6bc-472c-8915-3f45daadb0a9" alt="" width="188"><figcaption><p>远程训练日志！</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fz1JnnGZmO5aWy57dK1w1%2Fphone%20flappy%20bird.png?alt=media&amp;token=b31fd81d-eb97-4c55-a93c-1e5f5742557a" alt="" width="188"><figcaption><p>在手机上运行实时 HTML</p></figcaption></figure></div>

要进行设置，首先在安装 Unsloth 后的终端中输入 `unsloth studio --secure` 。请设置密码，这样未经授权的人就无法访问 HTTPS 链接！

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FQfRsJGUWXMCGYczt1G0K%2Fsecure%20login%20password.png?alt=media&amp;token=23f3976b-4e23-49da-a95c-e32fb53952f0" alt=""><figcaption></figcaption></figure>

然后在日志中 - 使用 <mark style="color:$success;">**绿色的 Cloudflare 链接**</mark> 并在你的手机或任何远程设备上输入这个！

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F5UifJGPRo0GfSbm8UeAG%2Fsecure%20terminal%20link.png?alt=media&amp;token=8da77481-a380-4f26-af9f-c31342992d41" alt=""><figcaption></figcaption></figure>

然后你就进来了！你始终可以通过在启动 Unsloth Studio 的终端中按 CTRL+C 来监控/取消实时 HTTPS 服务链接！

<div><figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FDYsI12Qy2lN1TuNu8HrJ%2Fphone%20model%20select.png?alt=media&amp;token=05891101-47cd-430b-9a76-698ccca60246" alt="" width="188"><figcaption><p>编辑推理设置</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fi9RMJOuSJCZ0eTGr4iIJ%2Fphone%20extra%20optios.png?alt=media&amp;token=5fa1d410-9d5d-4964-8d51-c1f3e82ac213" alt="" width="188"><figcaption><p>编辑温度、top_p、上下文长度</p></figcaption></figure> <figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FgNBUBdVsZ08XfJtDv5Ux%2Fphone%20canvas.png?alt=media&amp;token=207ff0e7-9653-4181-9344-6fab86bc2b9a" alt="" width="188"><figcaption><p>画布会自动渲染 HTML！</p></figcaption></figure></div>

### :question:AMD 支持是如何为 Unsloth 构建的

Unsloth 的自定义内核在与 AMD 团队的密切合作下移植到了 AMD。这需要在安装器、硬件检测、运行时路由、监控以及预编译资产选择等方面进行修改。

* **ROCm 内核：** 针对 RDNA 和 CDNA 调优的 HIP/Triton 移植版本，并带有架构特定的精度、性能和稳定性修复。([#2520](https://github.com/unslothai/unsloth/pull/2520))
* **4-bit 训练：** 基于 bitsandbytes 的 Radeon 和 CDNA GPU QLoRA 支持。([#3748](https://github.com/unslothai/unsloth/pull/3748))
* **自动设置：** 稳健的 AMD GPU 检测和正确的 ROCm PyTorch wheel 安装，包括修复和平台保护措施。([#4770](https://github.com/unslothai/unsloth/pull/4770))
* **Windows 和 Strix Halo：** 原生 Windows ROCm 安装、运行时兼容性补丁、统一内存报告以及 WSL 支持。([#5301](https://github.com/unslothai/unsloth/pull/5301), [#6227](https://github.com/unslothai/unsloth/pull/6227))
* **ROCm 推理：** 针对架构特定的 llama.cpp 预编译版本、源代码构建回退、AMD VRAM 检测以及监控。([#5172](https://github.com/unslothai/unsloth/pull/5172))

### :clock1: 未来工作

非常感谢 AMD 团队与我们合作，让 AMD 运行良好！接下来的重点包括：

* 持续与 AMD 团队开展开发和协作。
* 使用 AMD Strix Halo 和 Radeon 实验室硬件扩展硬件后端的 CI/CD。
* 随着新 AMD GPU 卡和架构发布，提供支持。
* 更清晰的多 GPU 指南：AMD 分布式训练目前仅限 Linux。在 Linux 上，ROCm 使用 RCCL，因此分布式训练可正常工作。在 Windows 上，AMD ROCm 目前还不提供 GPU 集合后端，截至 [TheRock #5694](https://github.com/ROCm/TheRock/pull/5694)，如果你计划进行 AMD 多 GPU 训练，请使用 Linux。
* 进一步针对 ROCm 栈进行速度优化。

### :love\_letter: 感谢 AMD 的合作！

非常感谢 AMD 团队以及我们出色的 Unsloth 社区与我们一起合作完成此次发布。我们感谢 Strahinja Stamenkovic、Filip Jankovic、Iswarya Alex、Yue Yuan、Bill He、Eda Zhou、Mahdi Ghodsi、Guruprasad 以及整个 AMD 团队在让 AMD 支持与 Unsloth 良好协作方面的合作！还要特别感谢社区成员：Nate、UBER6、AiwendilOfMirk...、Gene、Jimster480、VELICAN、Vintheboy、archmaker、BichonFriseMax、Calandracas、Chigoma333、Edd、electroglyph、jslowbell、mk 27B UD-、Satyam、snapcast3r、TotoMC 与我们一起测试和调试。

在 AMD 上使用 Unsloth 的一种简单方法是通过 [AMD Developer Cloud](https://www.amd.com/en/developer/resources/cloud-access/amd-developer-cloud.html)，它提供由 MI300X GPU 驱动、具有 192GB VRAM 的一键式 notebooks。AMD 还通过 [AMD AI Developer Program](https://www.amd.com/en/developer/ai-dev-program.html)提供免费额度。要运行 Unsloth notebook，请使用来自 [unslothai/notebooks](https://github.com/unslothai/notebooks) 的任意 AMD notebook，并将 GitHub 域名替换为 AMD Developer Cloud URL，因为 notebook 路径是相同的。

需要帮助或想分享反馈？你可以加入我们的 [Discord](https://discord.com/invite/unsloth)、阅读 [AMD 文档](https://unsloth.ai/docs/get-started/install/amd)、在 [GitHub](https://github.com/unslothai/unsloth/issues)上提交 issue 或 PR，或者在我们的 [Reddit r/unsloth](https://www.reddit.com/r/unsloth/).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/zh/ji-chu-zhi-shi/amd.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
