> 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/xin/studio/chat.md).

# 如何使用 Unsloth Studio 运行模型

[Unsloth Studio](/docs/zh/xin/studio.md) 让你可以在电脑上 100% 离线运行 AI 模型。可运行来自 Hugging Face 或本地文件中的 GGUF、safetensors 等模型格式。

* **适用于所有 MacOS、CPU、Windows、Linux、WSL 环境！无需 GPU**
* [**自我修复式工具调用**](#auto-healing-tool-calling)**,** 高级 [**网页搜索**](#advanced-web-search), [**代码执行**](#code-execution)
* 将 Unsloth 用作兼容 OpenAI 的推理 [**API 端点**](/docs/zh/ji-chu/api.md) 或连接一个 [提供商](/docs/zh/ji-cheng/connections.md)
* 搜索 + 下载 + 运行 + [比较](#model-arena) 任何模型，如 GGUF、LoRA 适配器、safetensors 等。
* [**自动推理参数**](#auto-parameter-tuning) 调优（temp、top-p 等）并编辑聊天模板
* 上传图片、音频、PDF、代码、DOCX 及更多文件类型来进行聊天。

<div data-with-frame="true"><figure><img src="/files/be63ebd6ad22556ef537bfbb2c0e645494e31f32" alt="" width="563"><figcaption></figcaption></figure></div>

### 使用 Unsloth Studio Chat

{% hint style="success" %}
Unsloth Studio Chat 可自动支持 **多 GPU 配置** 进行推理。
{% endhint %}

{% columns %}
{% column %}

#### 代码执行

Unsloth Studio 让 LLM 运行 Bash 和 Python，而不仅仅是 JavaScript。它还会像 Claude Artifacts 一样对程序进行沙箱隔离，因此模型可以测试代码、生成文件，并通过真实计算验证答案。

这使得模型给出的答案更可靠、更准确。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/544692734145fd8e91d1b820de94b57274f65071" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 自动修复式工具调用

Unsloth Studio 不仅支持 [工具调用](#id-50-tool-calling-accuracy)，还会将格式错误或损坏的工具调用自动修复 50%。

这意味着你始终能获得推理输出 **而不会出现** 损坏的工具调用。&#x20;

例如，Qwen3.5-4B 搜索了 20 多个网站并引用了来源，网页搜索发生在其思维轨迹内部。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/6273055e6bbde016134838582519f00de2201635" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 高级网页搜索

Unsloth 的网页搜索会直接访问页面来收集相关信息和数据，而不只是扫描网站摘要。这提供了更准确、更深入的信息和上下文。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/be63ebd6ad22556ef537bfbb2c0e645494e31f32" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 将 Unsloth 用作 API 端点

你现在可以通过以下工具使用本地 LLM： [Claude Code](/docs/zh/ji-chu/claude-code.md) 和 [Codex](/docs/zh/ji-chu/codex.md) ，方法是将它连接到 Unsloth 的 [API 端点](#use-unsloth-as-an-api-endpoint)。这意味着你可以在这些工具中直接运行 Qwen 和 Gemma 模型，并使用 Unsloth 的推理能力，其中包括自我修复式工具调用、网页搜索等功能。
{% endcolumn %}

{% column %}

<figure><img src="/files/c633f6e5a61522d2d7fa76b1c6c3376b956d223d" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 自动推理设置

推理参数如 **temperature**, **top-p**, **top-k**, [**MTP**](/docs/zh/mo-xing/qwen3.6.md#mtp-guide) 会为 Qwen3.5 等新模型自动预设，让你无需担心设置即可获得最佳输出。你也可以手动调整参数并编辑系统提示词。

借助 llama.cpp 的智能自动上下文，不再需要调整上下文长度；它只会使用你需要的上下文，而不会加载额外内容。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/992ae1a4d9dd04ba28a674a9c6243d48f7dbc5f0" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 连接提供商

[Unsloth 连接](/docs/zh/ji-cheng/connections.md) 到 OpenAI、Anthropic、Ollama、llama.cpp、vLLM 等。

添加 API 密钥或模型服务器 URL，然后在同一聊天界面中使用外部模型，以及本地 + 云端模型。运行时支持 [提示缓存](/docs/zh/ji-cheng/connections.md#prompt-caching)、工具调用、思考，以及 OpenAI 等提供商原生功能。 [网页搜索](#web-search-and-thinking) 和 [代码执行](#code-execution).
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/992ae1a4d9dd04ba28a674a9c6243d48f7dbc5f0" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 搜索并运行模型

你可以通过 Hugging Face 搜索并下载任何模型，或者使用本地文件。

Studio 支持广泛的模型类型，包括 **GGUF**、视觉语言模型和文本转语音模型。运行最新模型，例如 [Qwen3.5](/docs/zh/mo-xing/qwen3.5.md) 或 NVIDIA 的 [Nemotron 3](/docs/zh/mo-xing/nemotron-3.md).

上传图片、音频、PDF、代码、DOCX 及更多文件类型来进行聊天。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/015702cfc7baea6bf531e5323e639b3f72f9bdd1" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}

#### 聊天工作区

输入提示，附加任何文档、图片（webp、png）、代码文件、txt 或音频作为额外上下文，并实时查看模型的响应。

可切换开启或关闭：思考 + 网页搜索。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/bb53bfef3ca9bfd57da1a07e6be3f9f0f59b725f" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

### **+50% 工具调用准确率**

Unsloth 提供了若干独特功能来改进工具调用，包括：

* Unsloth 中所有模型的工具调用 **准确率提升 30% 到 80%**.
* 网页搜索获取的是实际网页内容，而不仅仅是摘要。
* 允许的最大工具调用次数为 **超过 25 次。**
* 工具调用终止更可靠，减少了循环和重复调用。
* 改进的工具调用修复和去重逻辑有助于防止 XML 泄漏到输出中。

查看测试结果： `unsloth/Qwen3.5-4B-GGUF (UD-Q4_K_XL)` 启用网页搜索、代码执行和思考：

| 指标           | 普通工具调用 | Unsloth 工具调用 |
| ------------ | ------ | ------------ |
| 响应中的 XML 泄漏  | 10/10  | 0/10         |
| 使用的 URL 抓取次数 | 0      | 4/10 次运行     |
| 歌名正确的运行次数    | 0/10   | 2/10         |
| 平均工具调用次数     | 5.5    | 3.8          |
| 平均响应时间       | 12.3 秒 | 9.8 秒        |

### 模型竞技场

Studio Chat 让你使用相同提示并排比较任意两个模型。例如，比较基础模型和 LoRa 适配器。推理会先加载第一个模型，然后再加载第二个（并行推理正在开发中）。

<div data-with-frame="true"><figure><img src="/files/fb4305056f29675b39029a32cbb351f3887e2b9f" alt="" width="563"><figcaption></figcaption></figure></div>

{% columns %}
{% column %}
训练后，你可以使用相同提示并排比较基础模型和微调模型，以查看发生了哪些变化以及结果是否有所改善。

这种工作流可以轻松看出你的微调如何改变了模型的响应，以及它是否改善了你的使用场景结果。
{% endcolumn %}

{% column %}

<div align="center" data-with-frame="true"><figure><img src="/files/8c7b2f00c739a7786f502122730f81d86c763ba5" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% hint style="success" %}
Unsloth Studio Chat 可自动支持 **多 GPU 配置** 进行推理。
{% endhint %}

### 使用旧的 / 现有的 GGUF 模型

{% columns %}
{% column %}
**4 月 1 日更新：** 你现在可以选择一个现有文件夹供 Unsloth 检测。

**3 月 27 日更新：** Unsloth Studio 现在 **会自动检测较旧 / 预先存在的模型** 这些模型下载自 Hugging Face、LM Studio 等。
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="/files/cec2e46a923f32a71170420c00c39d7df4a8dbf4" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

**手动说明：** Unsloth Studio 会检测你下载到 Hugging Face Hub 缓存中的模型 `(C:\Users{your_username}.cache\huggingface\hub)`。如果你通过 LM Studio 下载了 GGUF 模型，请注意这些模型存储在 `C:\Users\{your_username}.cache\lm-studio\models` ***或*** `C:\Users{your_username}\lm-studio\models` 中，且默认情况下 llama.cpp 不可见——你需要将这些 .gguf 文件移动或复制到你的 Hugging Face Hub 缓存目录（或其他 llama.cpp 可访问的路径）中，Unsloth Studio 才能加载它们。

在 Studio 中微调模型或适配器后，你可以将其导出为 GGUF，并在 Studio Chat 中使用 **llama.cpp** 直接运行本地推理。Unsloth Studio 由 llama.cpp 和 Hugging Face 提供支持。

### 将文件作为上下文添加

Studio Chat 支持在对话中直接使用多模态输入。你可以附加文档、图片或音频作为提示的额外上下文。

<div data-with-frame="true"><figure><img src="/files/8b06290522ed0294587d816df0f65203680fade2" alt="" width="563"><figcaption></figcaption></figure></div>

这使得测试模型如何处理 PDF、截图或参考资料等真实输入变得非常容易。文件会在本地处理，并作为模型的上下文包含在内。

### **删除模型文件**

你可以通过模型搜索中的垃圾桶图标删除旧模型文件，或者从默认的 Hugging Face 缓存目录中移除相关的缓存模型文件夹。默认情况下，Hugging Face 使用 `~/.cache/huggingface/hub/` 在 macOS/Linux/WSL 上，以及 `C:\Users\<username>\.cache\huggingface\hub\` 在 Windows 上。

* **MacOS、Linux、WSL：** `~/.cache/huggingface/hub/`
* **Windows：** `%USERPROFILE%\.cache\huggingface\hub\`

如果 `HF_HUB_CACHE` 或 `HF_HOME` 已设置，则使用该位置。 在 Linux 和 WSL 上， `XDG_CACHE_HOME` 也可以更改默认缓存根目录。

### **Unsloth 没有检测到或使用我的 GPU**

如果模型没有专门在 Docker 中使用你的 GPU，请尝试：

手动拉取最新镜像：

```bash
 docker pull unsloth/unsloth:latest
```

* 使用 GPU 访问权限启动容器：
  * `docker run`: `--gpus all`
  * Docker Compose： `capabilities: [gpu]`
* 在 Linux 上，请确保已安装 NVIDIA Container Toolkit。
* 在 Windows 上：
  * 检查 `nvcc --version` 是否与 `nvidia-smi`
  * 中显示的 CUDA 版本匹配。 [参见： https://docs.docker.com/desktop/features/gpu/](https://docs.docker.com/desktop/features/gpu/)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://unsloth.ai/docs/zh/xin/studio/chat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
