Cozzy23 commited on
Commit
b0dffcc
·
verified ·
1 Parent(s): 3ac4285

Upload 66 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. docs/Makefile +20 -0
  3. docs/README.md +50 -0
  4. docs/locales/zh_CN/LC_MESSAGES/deployment/dstack.po +169 -0
  5. docs/locales/zh_CN/LC_MESSAGES/deployment/openllm.po +112 -0
  6. docs/locales/zh_CN/LC_MESSAGES/deployment/sglang.po +198 -0
  7. docs/locales/zh_CN/LC_MESSAGES/deployment/skypilot.po +191 -0
  8. docs/locales/zh_CN/LC_MESSAGES/deployment/tgi.po +181 -0
  9. docs/locales/zh_CN/LC_MESSAGES/deployment/vllm.po +245 -0
  10. docs/locales/zh_CN/LC_MESSAGES/framework/Langchain.po +57 -0
  11. docs/locales/zh_CN/LC_MESSAGES/framework/LlamaIndex.po +95 -0
  12. docs/locales/zh_CN/LC_MESSAGES/framework/function_call.po +415 -0
  13. docs/locales/zh_CN/LC_MESSAGES/framework/qwen_agent.po +68 -0
  14. docs/locales/zh_CN/LC_MESSAGES/getting_started/concepts.po +497 -0
  15. docs/locales/zh_CN/LC_MESSAGES/getting_started/quantization_benchmark.po +440 -0
  16. docs/locales/zh_CN/LC_MESSAGES/getting_started/quickstart.po +205 -0
  17. docs/locales/zh_CN/LC_MESSAGES/getting_started/speed_benchmark.po +1579 -0
  18. docs/locales/zh_CN/LC_MESSAGES/getting_started/thinking_budget.po +71 -0
  19. docs/locales/zh_CN/LC_MESSAGES/index.po +144 -0
  20. docs/locales/zh_CN/LC_MESSAGES/inference/transformers.po +205 -0
  21. docs/locales/zh_CN/LC_MESSAGES/quantization/awq.po +107 -0
  22. docs/locales/zh_CN/LC_MESSAGES/quantization/gptq.po +229 -0
  23. docs/locales/zh_CN/LC_MESSAGES/quantization/llama.cpp.po +183 -0
  24. docs/locales/zh_CN/LC_MESSAGES/run_locally/llama.cpp.po +671 -0
  25. docs/locales/zh_CN/LC_MESSAGES/run_locally/mlx-lm.po +90 -0
  26. docs/locales/zh_CN/LC_MESSAGES/run_locally/ollama.po +102 -0
  27. docs/locales/zh_CN/LC_MESSAGES/training/axolotl.po +196 -0
  28. docs/locales/zh_CN/LC_MESSAGES/training/llama_factory.po +120 -0
  29. docs/locales/zh_CN/LC_MESSAGES/training/ms_swift.po +271 -0
  30. docs/locales/zh_CN/LC_MESSAGES/training/unsloth.po +200 -0
  31. docs/locales/zh_CN/LC_MESSAGES/training/verl.po +117 -0
  32. docs/make.bat +35 -0
  33. docs/requirements-docs.txt +5 -0
  34. docs/source/_static/css/custom.css +87 -0
  35. docs/source/_static/design-tabs.js +107 -0
  36. docs/source/assets/qwen-openllm-ui-demo.png +3 -0
  37. docs/source/assets/qwen3_nonthinking.jinja +86 -0
  38. docs/source/conf.py +120 -0
  39. docs/source/deployment/dstack.rst +161 -0
  40. docs/source/deployment/openllm.rst +125 -0
  41. docs/source/deployment/sglang.md +244 -0
  42. docs/source/deployment/skypilot.rst +209 -0
  43. docs/source/deployment/tgi.rst +190 -0
  44. docs/source/deployment/vllm.md +364 -0
  45. docs/source/framework/Langchain.rst +278 -0
  46. docs/source/framework/LlamaIndex.rst +141 -0
  47. docs/source/framework/function_call.md +606 -0
  48. docs/source/framework/qwen_agent.rst +113 -0
  49. docs/source/getting_started/concepts.md +208 -0
  50. docs/source/getting_started/quantization_benchmark.rst +52 -0
.gitattributes CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  eval/output/ARCAGI-Qwen3-235B-A22B-Instruct-2507_details.jsonl filter=lfs diff=lfs merge=lfs -text
37
  eval/output/ARCAGI-Qwen3-235B-A22B-Instruct-2507.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  eval/output/ARCAGI-Qwen3-235B-A22B-Instruct-2507_details.jsonl filter=lfs diff=lfs merge=lfs -text
37
  eval/output/ARCAGI-Qwen3-235B-A22B-Instruct-2507.jsonl filter=lfs diff=lfs merge=lfs -text
38
+ docs/source/assets/qwen-openllm-ui-demo.png filter=lfs diff=lfs merge=lfs -text
docs/Makefile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
docs/README.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Qwen Documentation
2
+
3
+ This is the source of the documentation at <https://qwen.readthedocs.io>.
4
+
5
+ ## Quick Start
6
+
7
+ We use `sphinx` to manage the documentation and use the `furo` theme.
8
+ To get started, simply run
9
+ ```bash
10
+ pip install -r requirements-docs.txt
11
+ ```
12
+
13
+ Then run `make html` or `sphinx-build -M html source build` and it will compile the docs and put it under the `build/html` directory.
14
+
15
+
16
+ ## Translation
17
+
18
+ The documentation is available in both English and Simplified Chinese. We use
19
+ `sphinx-intl` to work with Sphinx translation flow, following [this article](https://www.sphinx-doc.org/en/master/usage/advanced/intl.html).
20
+
21
+ You need to install the Python package `sphinx-intl` before starting.
22
+
23
+ 1. After updating the English documentation, run `make gettext`, and the pot files will be placed in the `build/gettext` directory. `make gettext` can be slow if the doc is long.
24
+
25
+ 2. Use the generated pot files to update the po files:
26
+ ```bash
27
+ sphinx-intl update -p build/gettext -l zh_CN -w 0
28
+ ```
29
+
30
+ 3. Translate po files at `locales\zh_CN\LC_MESSAGES`. Pay attention to fuzzy matches (messages after `#, fuzzy`). Please be careful not to break reST notation.
31
+
32
+ 4. Build translated document: `make -e SPHINXOPTS="-D language='zh_CN'" html` or `sphinx-build -M html source build -D language=zh_CN`
33
+
34
+ ## Auto Build
35
+
36
+ ```bash
37
+ pip install sphinx-autobuild
38
+ ```
39
+
40
+ To autobuild the default version:
41
+ ```bash
42
+ sphinx-autobuild source build/html
43
+ ```
44
+
45
+ To autobuild the translated version:
46
+ ```bash
47
+ sphinx-autobuild source build/html -D language=zh_CN --watch locales/zh_CN
48
+ ```
49
+
50
+ By default, the doc is at `http://127.0.0.1:8000`
docs/locales/zh_CN/LC_MESSAGES/deployment/dstack.po ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-07-28 10:50+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.17.0\n"
21
+
22
+ #: ../../source/deployment/dstack.rst:2 dfac4ff2e6e7425290c3cd12a2de701c
23
+ msgid "dstack"
24
+ msgstr ""
25
+
26
+ #: ../../source/deployment/dstack.rst:4 2438a502621e4637bac3fa19171a5e53
27
+ msgid "`dstack <https://github.com/dstackai/dstack>`__ is an open-source alternative to Kubernetes and Slurm, designed to simplify GPU allocation and AI workload orchestration for ML teams across top clouds, on-prem clusters, and accelerators."
28
+ msgstr ""
29
+
30
+ #: ../../source/deployment/dstack.rst:7 1ff23a34c6ec4236b5b9d73e7d1d6241
31
+ msgid "Prerequisites"
32
+ msgstr ""
33
+
34
+ #: ../../source/deployment/dstack.rst:8 5f95e757ef4f4cba85ce773801be340d
35
+ msgid "Before you start, install dstack by following the `installation instructions <https://dstack.ai/docs/installation/>`__. Once dstack server is up, you can initialize your workspace as shown below:"
36
+ msgstr ""
37
+
38
+ #: ../../source/deployment/dstack.rst:17 ccf222149a8d43d2bf716c2a39956d77
39
+ msgid "Deploy Qwen3-30B-A3B"
40
+ msgstr ""
41
+
42
+ #: ../../source/deployment/dstack.rst:19 45b4f1af973546ab9651757fcb13b9e9
43
+ msgid "Deploy ``Qwen3-30B-A3B`` on instances available with cloud providers configured in your ``~/.dstack/server/config.yml`` file."
44
+ msgstr ""
45
+
46
+ #: ../../source/deployment/dstack.rst:21 8565ac9fdb394e32b10269087dfc18c7
47
+ msgid "You can use ``SgLang``, ``TGI`` or ``vLLM`` to serve the model. Here we use ``SgLang`` as an example."
48
+ msgstr ""
49
+
50
+ #: ../../source/deployment/dstack.rst:23 9ed2f6fbcd3f408fa0d34a3199709122
51
+ msgid "Create a `service <https://dstack.ai/docs/concepts/services/>`__ configuration file named ``serve-30b.dstack.yml`` with the following content:"
52
+ msgstr ""
53
+
54
+ #: ../../source/deployment/dstack.rst:49 0973beefd01b4c8081a5d4d2113dc7c4
55
+ msgid "For other inference backends such as vLLM or TGI, visit the `dstack Inference Examples <https://dstack.ai/examples/#inference>`__ documentation."
56
+ msgstr ""
57
+
58
+ #: ../../source/deployment/dstack.rst:51 826cb0f7e041443db0a8382fd918e3b7
59
+ msgid "Go ahead and apply the service configuration:"
60
+ msgstr ""
61
+
62
+ #: ../../source/deployment/dstack.rst:58 d16702dc64694eeaba319277a3ab4a03
63
+ msgid "Access the Service"
64
+ msgstr ""
65
+
66
+ #: ../../source/deployment/dstack.rst:60 7edacaff1d53424190978e77cd557190
67
+ msgid "After the service is successfully deployed, you can access the service's endpoint in the following ways:"
68
+ msgstr ""
69
+
70
+ #: ../../source/deployment/dstack.rst e83ef74bbe7e4e5eaf5f7a10773c9d46
71
+ msgid "CURL"
72
+ msgstr ""
73
+
74
+ #: ../../source/deployment/dstack.rst:66 9f51986795d3414f96dd65790157e723
75
+ msgid "Access through service endpoint at ``<dstack server URL>/proxy/services/<project name>/<run name>/``"
76
+ msgstr ""
77
+
78
+ #: ../../source/deployment/dstack.rst:84 9a8130ecf20c4e42ac9994e2145bfcec
79
+ msgid "When starting the dstack server, an admin token is automatically generated:"
80
+ msgstr ""
81
+
82
+ #: ../../source/deployment/dstack.rst 94c7a3424a19432ebfc0a98eb0725d42
83
+ msgid "Chat UI"
84
+ msgstr ""
85
+
86
+ #: ../../source/deployment/dstack.rst:93 5c7bb346537b456da005af909a333b09
87
+ msgid "Access through dstack's Chat UI at ``<dstack server URL>/projects/<project name>/models/<run name>/``"
88
+ msgstr ""
89
+
90
+ #: ../../source/deployment/dstack.rst 11cd02dcfb214277988135c49b839775
91
+ msgid "Gateway"
92
+ msgstr ""
93
+
94
+ #: ../../source/deployment/dstack.rst:102 e1e19487dd6f4ae8b12f728b39bef5d6
95
+ msgid "Running services for development purposes doesn't require setting up a gateway."
96
+ msgstr ""
97
+
98
+ #: ../../source/deployment/dstack.rst:104 bf94ccabbeaa491c9827e983e7f9950a
99
+ msgid "However, you'll need a gateway in the following cases:"
100
+ msgstr ""
101
+
102
+ #: ../../source/deployment/dstack.rst:106 15278aaab8214461b9fa17c95549f1cc
103
+ msgid "To use auto-scaling or rate limits"
104
+ msgstr ""
105
+
106
+ #: ../../source/deployment/dstack.rst:107 5cf53dda95e24cfda6c3a62e32632461
107
+ msgid "To enable HTTPS for the endpoint and map it to your domain"
108
+ msgstr ""
109
+
110
+ #: ../../source/deployment/dstack.rst:108 b91006984e1b42298a79360df47c942e
111
+ msgid "If your service requires WebSockets"
112
+ msgstr ""
113
+
114
+ #: ../../source/deployment/dstack.rst:109 a0ecebb158d048b7bb366e166509ab31
115
+ msgid "If your service cannot work with a path prefix"
116
+ msgstr ""
117
+
118
+ #: ../../source/deployment/dstack.rst:111 df78b814ee044508979d32d16c6fa418
119
+ msgid "For detailed information about gateway configuration and usage, refer to the `dstack documentation on gateways <https://dstack.ai/docs/concepts/gateways/>`__."
120
+ msgstr ""
121
+
122
+ #: ../../source/deployment/dstack.rst:114 da366f09f068481898788356a2720d00
123
+ msgid "Replicas and Auto Scaling"
124
+ msgstr ""
125
+
126
+ #: ../../source/deployment/dstack.rst:116 1814b084b9344951b8fda9bc315ff652
127
+ msgid "You can auto scale the service by specifying additional configurations in the ``serve-30b.dstack.yml``."
128
+ msgstr ""
129
+
130
+ #: ../../source/deployment/dstack.rst:118 a2ca8abfc03b4008a679e44ed42a6224
131
+ msgid "Set ``replicas: min..max`` to define the minimum and maximum number of replicas"
132
+ msgstr ""
133
+
134
+ #: ../../source/deployment/dstack.rst:119 8cfabedabf1f4d64bb6708f07852e3f8
135
+ msgid "Configure ``scaling`` rules to determine when to scale up or down"
136
+ msgstr ""
137
+
138
+ #: ../../source/deployment/dstack.rst:121 fcd56774d834404fa6561d65b46afe74
139
+ msgid "Below is a complete configuration example with auto-scaling enabled:"
140
+ msgstr ""
141
+
142
+ #: ../../source/deployment/dstack.rst:153 dd2ed9086cf5424ab14b641044da1279
143
+ msgid "The scaling property requires a gateway to be set up."
144
+ msgstr ""
145
+
146
+ #: ../../source/deployment/dstack.rst:156 3986bd1e05de49048a64cdf4d6782f8a
147
+ msgid "See also"
148
+ msgstr ""
149
+
150
+ #: ../../source/deployment/dstack.rst:157 7dc365aeac714fa5ba2989f0cb1c7e9c
151
+ msgid "**Fleets**: Create cloud and on-prem clusters using `Fleets <https://dstack.ai/docs/concepts/fleets/>`__."
152
+ msgstr ""
153
+
154
+ #: ../../source/deployment/dstack.rst:158 5e647ecf87164fccbe9589e3d9c540b9
155
+ msgid "**Dev Environments**: Experiment and test before deploying to production using `Dev Environments <https://dstack.ai/docs/concepts/dev-environments/>`__."
156
+ msgstr ""
157
+
158
+ #: ../../source/deployment/dstack.rst:159 36774ccbc7e6446a9bfcdf029e13fe58
159
+ msgid "**Tasks**: Schedule single node or distributed training using `Tasks <https://dstack.ai/docs/concepts/tasks/>`__."
160
+ msgstr ""
161
+
162
+ #: ../../source/deployment/dstack.rst:160 72cc0103fb1e4c82ae284fa1e3633bc4
163
+ msgid "**Services**: Deploy models as secure, auto-scaling OpenAI-compatible endpoints using `Services <https://dstack.ai/docs/concepts/services/>`__."
164
+ msgstr ""
165
+
166
+ #: ../../source/deployment/dstack.rst:161 ba9f121d4831485e84c3cf922edc3982
167
+ msgid "**Metrics**: Monitor performance with automatically tracked metrics via CLI or UI using `Metrics <https://dstack.ai/docs/guides/metrics/>`__."
168
+ msgstr ""
169
+
docs/locales/zh_CN/LC_MESSAGES/deployment/openllm.po ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.17.0\n"
21
+
22
+ #: ../../Qwen/source/deployment/openllm.rst:2 986ea00cb5af4a0d82f974ed79a82430
23
+ msgid "OpenLLM"
24
+ msgstr "OpenLLM"
25
+
26
+ #: ../../Qwen/source/deployment/openllm.rst:5 78be03fbdccb429892b03bf84596411b
27
+ msgid "To be updated for Qwen3."
28
+ msgstr "仍需为Qwen3更新。"
29
+
30
+ #: ../../Qwen/source/deployment/openllm.rst:7 a001f11d1c5440188121d20b3baf59db
31
+ msgid "OpenLLM allows developers to run Qwen2.5 models of different sizes as OpenAI-compatible APIs with a single command. It features a built-in chat UI, state-of-the-art inference backends, and a simplified workflow for creating enterprise-grade cloud deployment with Qwen2.5. Visit `the OpenLLM repository <https://github.com/bentoml/OpenLLM/>`_ to learn more."
32
+ msgstr "OpenLLM 允许开发者通过一个命令运行不同大小的 Qwen2.5 模型,提供 OpenAI 兼容的 API。它具有内置的聊天 UI,先进的推理后端,以及简化的工作流程来使用 Qwen2.5 创建企业级云部署。访问 `OpenLLM 仓库 <https://github.com/bentoml/OpenLLM/>`_ 了解更多信息。"
33
+
34
+ #: ../../Qwen/source/deployment/openllm.rst:10 229f89c3be65442bbe15905d75a0d13d
35
+ msgid "Installation"
36
+ msgstr "安装"
37
+
38
+ #: ../../Qwen/source/deployment/openllm.rst:12 79421f700fbc426cb6ce9841aff67503
39
+ msgid "Install OpenLLM using ``pip``."
40
+ msgstr "使用 ``pip`` 安装 OpenLLM。"
41
+
42
+ #: ../../Qwen/source/deployment/openllm.rst:18 69cfd6fe2e274173ad4065be91b71472
43
+ msgid "Verify the installation and display the help information:"
44
+ msgstr "验证安装并显示帮助信息:"
45
+
46
+ #: ../../Qwen/source/deployment/openllm.rst:25 503cae99b14c4ef4b322b8ec0bd2d32d
47
+ msgid "Quickstart"
48
+ msgstr "快速开始"
49
+
50
+ #: ../../Qwen/source/deployment/openllm.rst:27 0ea788c801404d8780404611c87644b0
51
+ msgid "Before you run any Qwen2.5 model, ensure your model repository is up to date by syncing it with OpenLLM's latest official repository."
52
+ msgstr "在运行任何 Qwen2.5 模型之前,确保您的模型仓库与 OpenLLM 的最新官方仓库同步。"
53
+
54
+ #: ../../Qwen/source/deployment/openllm.rst:33 8852ff46ecdb45b2bfc9885bbfaacb02
55
+ msgid "List the supported Qwen2.5 models:"
56
+ msgstr "列出支持的 Qwen2.5 模型:"
57
+
58
+ #: ../../Qwen/source/deployment/openllm.rst:39 3e4f6c11396844adb30d4e5812339484
59
+ msgid "The results also display the required GPU resources and supported platforms:"
60
+ msgstr "结果还会显示所需的 GPU 资源和支持的平台:"
61
+
62
+ #: ../../Qwen/source/deployment/openllm.rst:57 ac4c0db02f5249d5882940820779db9a
63
+ msgid "To start a server with one of the models, use ``openllm serve`` like this:"
64
+ msgstr "要使用其中一个模型来启动服务器,请使用 ``openllm serve`` 命令,例如:"
65
+
66
+ #: ../../Qwen/source/deployment/openllm.rst:63 0a1d3ec35c684e3bb3e971c916aa9be7
67
+ msgid "By default, the server starts at ``http://localhost:3000/``."
68
+ msgstr "默认情况下,服务器启动在 http://localhost:3000/。"
69
+
70
+ #: ../../Qwen/source/deployment/openllm.rst:66 2e787de9a62f4342bdf8f88ee0df5379
71
+ msgid "Interact with the model server"
72
+ msgstr "与模型服务器交互"
73
+
74
+ #: ../../Qwen/source/deployment/openllm.rst:68 b22802ad9027458bb30ea0da665fea36
75
+ msgid "With the model server up and running, you can call its APIs in the following ways:"
76
+ msgstr "服务器运行后,可以通过以下方式调用其 API:"
77
+
78
+ #: ../../Qwen/source/deployment/openllm.rst 76214ea690094930899d6f2eddcc1454
79
+ msgid "CURL"
80
+ msgstr "CURL"
81
+
82
+ #: ../../Qwen/source/deployment/openllm.rst:74 42775a3df58f474782d29f2f82707bd9
83
+ msgid "Send an HTTP request to its ``/generate`` endpoint via CURL:"
84
+ msgstr "通过 CURL 向其 ``/generate`` 端点发送 HTTP 请求:"
85
+
86
+ #: ../../Qwen/source/deployment/openllm.rst 4f0ff3eee2ab49dda5a72bd611a9d45e
87
+ msgid "Python client"
88
+ msgstr "Python 客户端"
89
+
90
+ #: ../../Qwen/source/deployment/openllm.rst:91 ce2e11a46e434798947b1e74ce82a19c
91
+ msgid "Call the OpenAI-compatible endpoints with frameworks and tools that support the OpenAI API protocol. Here is an example:"
92
+ msgstr "使用支持 OpenAI API 协议的框架和工具来调用。例如:"
93
+
94
+ #: ../../Qwen/source/deployment/openllm.rst 107921d1a855430ca70c8c163d37c7f2
95
+ msgid "Chat UI"
96
+ msgstr "聊天 UI"
97
+
98
+ #: ../../Qwen/source/deployment/openllm.rst:118
99
+ #: b92df2759cd54c2b8316e2a160ede656
100
+ msgid "OpenLLM provides a chat UI at the ``/chat`` endpoint for the LLM server at http://localhost:3000/chat."
101
+ msgstr "OpenLLM 为 LLM 服务器提供的聊天 UI 位于 ``/chat`` 端点���地址为 http://localhost:3000/chat。"
102
+
103
+ #: ../../Qwen/source/deployment/openllm.rst:123
104
+ #: 0d3fa679178f443caf9c87623001be1f
105
+ msgid "Model repository"
106
+ msgstr "模型仓库"
107
+
108
+ #: ../../Qwen/source/deployment/openllm.rst:125
109
+ #: 54d6a9bdcc064aeb95a23b60d3d575ab
110
+ msgid "A model repository in OpenLLM represents a catalog of available LLMs. You can add your own repository to OpenLLM with custom Qwen2.5 variants for your specific needs. See our `documentation to learn details <https://github.com/bentoml/OpenLLM?tab=readme-ov-file#model-repository>`_."
111
+ msgstr "OpenLLM 中的模型仓库表示可用的 LLM 目录。您可以为 OpenLLM 添加自定义的 Qwen2.5 模型仓库,以满足您的特定需求。请参阅 `我们的文档 <https://github.com/bentoml/OpenLLM?tab=readme-ov-file#model-repository>`_ 了解详细信息。"
112
+
docs/locales/zh_CN/LC_MESSAGES/deployment/sglang.po ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-05-07 19:51+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.17.0\n"
21
+
22
+ #: ../../source/deployment/sglang.md:1 e05607ecb34c453aa8f805ea62edf34f
23
+ msgid "SGLang"
24
+ msgstr ""
25
+
26
+ #: ../../source/deployment/sglang.md:3 54dde79baa664197a2f3a5bb52383b70
27
+ msgid "[SGLang](https://github.com/sgl-project/sglang) is a fast serving framework for large language models and vision language models."
28
+ msgstr "[SGLang](https://github.com/sgl-project/sglang) 是一个用于大型语言模型和视觉语言模型的快速推理框架。"
29
+
30
+ #: ../../source/deployment/sglang.md:5 1ae08e7b1ffc4f0290eefb616eac1b63
31
+ msgid "To learn more about SGLang, please refer to the [documentation](https://docs.sglang.ai/)."
32
+ msgstr "要了解更多关于 SGLang 的信息,请参阅[官方文档](https://docs.sglang.ai/)。"
33
+
34
+ #: ../../source/deployment/sglang.md:7 927f96387c844f79a7cfa592e64fc1b2
35
+ msgid "Environment Setup"
36
+ msgstr "环境配置"
37
+
38
+ #: ../../source/deployment/sglang.md:9 e04e805b59364e96a366fa088fae04e4
39
+ msgid "By default, you can install `sglang` with pip in a clean environment:"
40
+ msgstr "默认情况下,你可以通过 pip 在新环境中安装 `sglang` : "
41
+
42
+ #: ../../source/deployment/sglang.md:15 fcb185985f1b4c1589200ac4af2a6aee
43
+ msgid "If you have encountered issues in installation, please feel free to check the official document for installation ([link](https://docs.sglang.ai/start/install.html))."
44
+ msgstr "如果在安装过程中遇到问题,请随时查阅官方安装文档([链接](https://docs.sglang.ai/start/install.html))"
45
+
46
+ #: ../../source/deployment/sglang.md:17 a0f36bc7b4e24d598d381e2705f73eb1
47
+ msgid "API Service"
48
+ msgstr "API 服务"
49
+
50
+ #: ../../source/deployment/sglang.md:19 4d7006fa87884605b48700b05f602bb1
51
+ msgid "It is easy to build an OpenAI-compatible API service with SGLang, which can be deployed as a server that implements OpenAI API protocol. By default, it starts the server at `http://localhost:30000`. You can specify the address with `--host` and `--port` arguments. Run the command as shown below:"
52
+ msgstr "借助 SGLang ,构建一个与OpenAI API兼容的API服务十分简便,该服务可以作为实现OpenAI API协议的服务器进行部署。默认情况下,它将在 `http://localhost:30000` 启动服务器。您可以通过 `--host` 和 `--port` 参数来自定义地址。请按照以下所示运行命令:"
53
+
54
+ #: ../../source/deployment/sglang.md:27 6d10b2003b9b4dd0b9dca0a2e8d33fd6
55
+ msgid "By default, if the `--model-path` does not point to a valid local directory, it will download the model files from the Hugging Face Hub. To download model from ModelScope, set the following before running the above command:"
56
+ msgstr "默认情况下,如果模型未指向有效的本地目录,它将从 Hugging Face Hub 下载模型文件。要从 ModelScope 下载模型,请在运行上述命令之前设置以下内容:"
57
+
58
+ #: ../../source/deployment/sglang.md:33 d3cee58928964c5dba7720884d6c5189
59
+ msgid "For distributed inference with tensor parallelism, it is as simple as"
60
+ msgstr "对于使用张量并行的分布式推理,操作非常简单:"
61
+
62
+ #: ../../source/deployment/sglang.md:37 4c8600c0f3ac4d0e803af9c089d73dae
63
+ msgid "The above command will use tensor parallelism on 4 GPUs. You should change the number of GPUs according to your demand."
64
+ msgstr "上述命令将在 4 块 GPU 上使用张量并行。您应根据需求调整 GPU 的数量。"
65
+
66
+ #: ../../source/deployment/sglang.md:40 4ca7c9376bd84c65a877134047aeee37
67
+ msgid "Basic Usage"
68
+ msgstr "基本用法"
69
+
70
+ #: ../../source/deployment/sglang.md:42 bd805ae178b6401c925a959334b64b88
71
+ msgid "Then, you can use the [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) to communicate with Qwen:"
72
+ msgstr "然后,您可以利用 [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) 来与Qwen进行对话:"
73
+
74
+ #: ../../source/deployment/sglang.md 2f867c83bdce4a4286842da69aa68640
75
+ #: 418b07dd6a574642bfa89052103763e9
76
+ msgid "curl"
77
+ msgstr ""
78
+
79
+ #: ../../source/deployment/sglang.md 14df52980bfe41689ac8dc8699be2134
80
+ #: 7a50af3d10534acfbf980ac0d2ee92e5
81
+ msgid "Python"
82
+ msgstr ""
83
+
84
+ #: ../../source/deployment/sglang.md:62 ../../source/deployment/sglang.md:126
85
+ #: 669de086434740279e9cf7c54fb42e56 a3f9e92506374567a4660de9071567e8
86
+ msgid "You can use the API client with the `openai` Python SDK as shown below:"
87
+ msgstr "或者您可以如下面所示使用 `openai` Python SDK中的 API 客��端:"
88
+
89
+ #: ../../source/deployment/sglang.md:92 d8321f81e9624419b5e0fdb7012816e4
90
+ msgid "While the default sampling parameters would work most of the time for thinking mode, it is recommended to adjust the sampling parameters according to your application, and always pass the sampling parameters to the API."
91
+ msgstr "虽然默认的采样参数在大多数情况下适用于思考模式,但建议根据您的应用调整采样参数,并始终将采样参数传递给 API。"
92
+
93
+ #: ../../source/deployment/sglang.md:98 d6379b9f885748ca89bd3fe6c3362376
94
+ msgid "Thinking & Non-Thinking Modes"
95
+ msgstr "思考与非思考模式"
96
+
97
+ #: ../../source/deployment/sglang.md:100 f82eb1dfcc934667ac5aee0600140794
98
+ msgid "Qwen3 models will think before respond. This behavior could be controlled by either the hard switch, which could disable thinking completely, or the soft switch, where the model follows the instruction of the user on whether it should think."
99
+ msgstr "Qwen3 模型会在回复前进行思考。这种行为可以通过硬开关(完全禁用思考)或软开关(模型遵循用户关于是否应该思考的指令)来控制。"
100
+
101
+ #: ../../source/deployment/sglang.md:103 bac5d71126f04d149c0d674b7b2f7ec8
102
+ msgid "The hard switch is available in SGLang through the following configuration to the API call. To disable thinking, use"
103
+ msgstr "硬开关在 SGLang 中可以通过以下 API 调用配置使用。要禁用思考,请使用"
104
+
105
+ #: ../../source/deployment/sglang.md:158 09ccfb31c140452399460ed1357afc28
106
+ msgid "Please note that passing `enable_thinking` is not OpenAI API compatible. The exact method may differ among frameworks."
107
+ msgstr "请注意,`enable_thinking`并非OpenAI API定义的参数,具体传入方式可能因推理框架不同而不同。"
108
+
109
+ #: ../../source/deployment/sglang.md:163 650e618e24044303b48b6bc9d4ccc239
110
+ msgid "To completely disable thinking, you could use [a custom chat template](../../source/assets/qwen3_nonthinking.jinja) when starting the model:"
111
+ msgstr "要完全禁用思考,您可以在启动模型时使用[自定义聊天模板](../../source/assets/qwen3_nonthinking.jinja):"
112
+
113
+ #: ../../source/deployment/sglang.md:169 9c0dc646158541a991045064cfa5b258
114
+ msgid "The chat template prevents the model from generating thinking content, even if the user instructs the model to do so with `/think`."
115
+ msgstr "该聊天模板会阻止模型生成思考内容,即使用户通过 `/think` 指示模型这样做。"
116
+
117
+ #: ../../source/deployment/sglang.md:174 c23b692035b14b1099c8a148956457a5
118
+ msgid "It is recommended to set sampling parameters differently for thinking and non-thinking modes."
119
+ msgstr "建议为思考模式和非思考模式分别设置不同的采样参数。"
120
+
121
+ #: ../../source/deployment/sglang.md:177 c5c258baa5fa46ccbadb58573699a0f1
122
+ msgid "Parsing Thinking Content"
123
+ msgstr "解析思考内容"
124
+
125
+ #: ../../source/deployment/sglang.md:179 02d90ad41ecb4d51ae9f55458670843e
126
+ msgid "SGLang supports parsing the thinking content from the model generation into structured messages:"
127
+ msgstr "SGLang 支持将模型生成的思考内容解析为结构化消息:"
128
+
129
+ #: ../../source/deployment/sglang.md:184 854a73931a9e404b9942a10dd2702023
130
+ msgid "The response message will have a field named `reasoning_content` in addition to `content`, containing the thinking content generated by the model."
131
+ msgstr "响应消息除了包含 `content` 字段外,还会有一个名为 `reasoning_content` 的字段,其中包含模型生成的思考内容。"
132
+
133
+ #: ../../source/deployment/sglang.md:187 0bae083925f64ec7984c1b7c86d00ac1
134
+ msgid "Please note that this feature is not OpenAI API compatible."
135
+ msgstr "请注意,此功能与 OpenAI API 规范不一致。"
136
+
137
+ #: ../../source/deployment/sglang.md:191 f23a3deb557a4d808cef5bdaad6dcf16
138
+ msgid "`enable_thinking=False` may not be compatible with this feature. If you need to pass `enable_thinking=False` to the API, please consider disabling parsing thinking content."
139
+ msgstr "`enable_thinking=False` 可能与思考内容解析不兼容。如果需要向 API 传递 `enable_thinking=False`,请考虑禁用该功能。"
140
+
141
+ #: ../../source/deployment/sglang.md:195 930b8e7391204fc68d6473fec1d2e4e0
142
+ msgid "Parsing Tool Calls"
143
+ msgstr "解析工具调用"
144
+
145
+ #: ../../source/deployment/sglang.md:197 8fb5272b079543219b125e70da4f89d3
146
+ msgid "SGLang supports parsing the tool calling content from the model generation into structured messages:"
147
+ msgstr "SGLang 支持将模型生成的工具调用内容解析为结构化消息:"
148
+
149
+ #: ../../source/deployment/sglang.md:202 28ca5e5fc8694b839b91cb3f7f38a0cb
150
+ msgid "For more information, please refer to [our guide on Function Calling](../framework/function_call.md)."
151
+ msgstr "详细信息,请参阅[函数调用的指南](../framework/function_call.md#vllm)。"
152
+
153
+ #: ../../source/deployment/sglang.md:204 59cd747bac244c57afc56b7f3d041df8
154
+ msgid "Structured/JSON Output"
155
+ msgstr "结构化/JSON输出"
156
+
157
+ #: ../../source/deployment/sglang.md:206 4534e68747c041d5addd24c36fbc8250
158
+ msgid "SGLang supports structured/JSON output. Please refer to [SGLang's documentation](https://docs.sglang.ai/backend/structured_outputs.html#OpenAI-Compatible-API). Besides, it is also recommended to instruct the model to generate the specific format in the system message or in your prompt."
159
+ msgstr "SGLang 支持结构化/JSON 输出。请参阅[SGLan文档](https://docs.sglang.ai/backend/structured_outputs.html#OpenAI-Compatible-API)。此外,还建议在系统消息或您的提示中指示模型生成特定格式。"
160
+
161
+ #: ../../source/deployment/sglang.md:210 734cfd6d921e4706a07e112237b09b38
162
+ msgid "Serving Quantized models"
163
+ msgstr "部署量化模型"
164
+
165
+ #: ../../source/deployment/sglang.md:212 e7b0890292ad44278e910b6ee97f6d2d
166
+ msgid "Qwen3 comes with two types of pre-quantized models, FP8 and AWQ."
167
+ msgstr "Qwen3 提供了两种类型的预量化模型:FP8 和 AWQ。"
168
+
169
+ #: ../../source/deployment/sglang.md:214 0bb52b4e43504cb8ac143e594247a0e0
170
+ msgid "The command serving those models are the same as the original models except for the name change:"
171
+ msgstr "部署这些模型的命令与原始模型相同,只是名称有所更改:"
172
+
173
+ #: ../../source/deployment/sglang.md:223 714f8f196af24271b6967dd038614f88
174
+ msgid "Context Length"
175
+ msgstr "上下文长度"
176
+
177
+ #: ../../source/deployment/sglang.md:225 ad211116852345b8bfb9bb9e58027486
178
+ msgid "The context length for Qwen3 models in pretraining is up to 32,768 tokens. To handle context length substantially exceeding 32,768 tokens, RoPE scaling techniques should be applied. We have validated the performance of [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts."
179
+ msgstr "Qwen3 模型在预训练中的上下文长度最长为 32,768 个 token。为了处理显著超过 32,768 个 token 的上下文长度,应应用 RoPE 缩放技术。我们已经验证了 [YaRN](https://arxiv.org/abs/2309.00071) 的性能,这是一种增强模型长度外推的技术,可确保在长文本上的最佳性能。"
180
+
181
+ #: ../../source/deployment/sglang.md:229 d243e7a41b214c289be782db495e82f4
182
+ msgid "SGLang supports YaRN, which can be configured as"
183
+ msgstr "SGLang 支持 YaRN,可以配置为"
184
+
185
+ #: ../../source/deployment/sglang.md:235 c15ed6a15a714884ab3024654203ec06
186
+ msgid "SGLang implements static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.** We advise adding the `rope_scaling` configuration only when processing long contexts is required. It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0."
187
+ msgstr "SGLang 实现了静态 YaRN,这意味着无论输入长度如何,缩放因子都保持不变,**这可能会对较短文本的性能产生影响。** 我们建议仅在需要处理长上下文时添加 `rope_scaling` 配置。还建议根据需要调整 `factor`。例如,如果您的应用程序的典型上下文长度为 65,536 个 token,则最好将 `factor` 设置为 2.0。"
188
+
189
+ #: ../../source/deployment/sglang.md:241 e0528eb23e2a454585b46ef178d28a79
190
+ msgid "The default `max_position_embeddings` in `config.json` is set to 40,960, which is used by SGLang. This allocation includes reserving 32,768 tokens for outputs and 8,192 tokens for typical prompts, which is sufficient for most scenarios involving short text processing and leave adequate room for model thinking. If the average context length does not exceed 32,768 tokens, we do not recommend enabling YaRN in this scenario, as it may potentially degrade model performance."
191
+ msgstr "`config.json` 中的默认 `max_position_embeddings` 被设置为 40,960,SGLang 将使用该值。此分配包括为输出保留 32,768 个 token,为典型提示保留 8,192 个 token,这足以应对大多数涉及短文本处理的场景,并为模型思考留出充足空间。如果平均上下文长度不超过 32,768 个 token,我们不建议在此场景中启用 YaRN,因为这可能会降低模型性能。"
192
+
193
+ #~ msgid "Please note that `sglang` relies on `flashinfer-python` and has strict dependencies on `torch` and its CUDA versions. Check the note in the official document for installation ([link](https://docs.sglang.ai/start/install.html)) for more help."
194
+ #~ msgstr "请留意预构建的 `sglang` 依赖 `flashinfer-python`,并对`torch`和其CUDA版本有强依赖。请查看[官方文档](https://docs.sglang.ai/start/install.html)中的注意事项以获取有关安装的帮助。"
195
+
196
+ #~ msgid "This feature has not been released. For more information, please see this [pull request](https://github.com/sgl-project/sglang/pull/5551)."
197
+ #~ msgstr "此功能尚未发布。更多信息,请参阅此[pull request](https://github.com/sgl-project/sglang/pull/5551)。"
198
+
docs/locales/zh_CN/LC_MESSAGES/deployment/skypilot.po ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.17.0\n"
18
+
19
+ #: ../../Qwen/source/deployment/skypilot.rst:2 795ad4f30e27494d93675f71bb1a5cc4
20
+ msgid "SkyPilot"
21
+ msgstr ""
22
+
23
+ #: ../../Qwen/source/deployment/skypilot.rst:5 aad807db94a24d868c9c1b364b47e152
24
+ msgid "To be updated for Qwen3."
25
+ msgstr "仍需为Qwen3更新。"
26
+
27
+ #: ../../Qwen/source/deployment/skypilot.rst:8 d6bbf736584f4bbfa9c300d50a2ed669
28
+ msgid "What is SkyPilot"
29
+ msgstr "SkyPilot 是什么"
30
+
31
+ #: ../../Qwen/source/deployment/skypilot.rst:10
32
+ #: b66facae41bf493880e43044e2915a45
33
+ msgid "SkyPilot is a framework for running LLMs, AI, and batch jobs on any cloud, offering maximum cost savings, the highest GPU availability, and managed execution. Its features include:"
34
+ msgstr "SkyPilot 是一个可以在任何云上运行 LLM 、 AI 应用以及批量任务的框架,旨在实现最大程度的成本节省、最高的 GPU 可用性以及受管理的执行过程。其特性包括:"
35
+
36
+ #: ../../Qwen/source/deployment/skypilot.rst:14
37
+ #: 621f021163c549d0aadb1c911a3a3ef5
38
+ msgid "Get the best GPU availability by utilizing multiple resources pools across multiple regions and clouds."
39
+ msgstr "通过跨区域和跨云充分利用多个资源池,以获得最佳的 GPU 可用性。"
40
+
41
+ #: ../../Qwen/source/deployment/skypilot.rst:16
42
+ #: ea1723c3b5be454cad3219836f4386d8
43
+ msgid "Pay absolute minimum — SkyPilot picks the cheapest resources across regions and clouds. No managed solution markups."
44
+ msgstr "把费用降到最低—— SkyPilot 在各区域和云平台中为您挑选最便宜的资源。无需任何托管解决方案的额外加价。"
45
+
46
+ #: ../../Qwen/source/deployment/skypilot.rst:18
47
+ #: e479693ecf08411ca35d8d0727c8f441
48
+ msgid "Scale up to multiple replicas across different locations and accelerators, all served with a single endpoint"
49
+ msgstr "将服务扩展到多个副本上,所有副本通过单一 endpoint 对外提供服务"
50
+
51
+ #: ../../Qwen/source/deployment/skypilot.rst:20
52
+ #: 1f9cdd2ae2544d1faa8a4c463ee0e42c
53
+ msgid "Everything stays in your cloud account (your VMs & buckets)"
54
+ msgstr "所有内容均保存在您的云账户中(包括您的虚拟机和 bucket )"
55
+
56
+ #: ../../Qwen/source/deployment/skypilot.rst:21
57
+ #: 5bb9b617764942d989e5093463a359f0
58
+ msgid "Completely private - no one else sees your chat history"
59
+ msgstr "完全私密 - 没有其他人能看到您的聊天记录"
60
+
61
+ #: ../../Qwen/source/deployment/skypilot.rst:24
62
+ #: cf0c456ac72f40ac98790c11dc243317
63
+ msgid "Install SkyPilot"
64
+ msgstr "安装 SkyPilot"
65
+
66
+ #: ../../Qwen/source/deployment/skypilot.rst:26
67
+ #: 78d86c1fa8104b138b01aed640b262fc
68
+ msgid "We advise you to follow the `instruction <https://skypilot.readthedocs.io/en/latest/getting-started/installation.html>`__ to install SkyPilot. Here we provide a simple example of using ``pip`` for the installation as shown below."
69
+ msgstr "我们建议您按照 `指示 <https://skypilot.readthedocs.io/en/latest/getting-started/installation.html>`__ 安装 SkyPilot 。以下为您提供了一个使用 ``pip`` 进行安装的简单示例:"
70
+
71
+ #: ../../Qwen/source/deployment/skypilot.rst:38
72
+ #: a7c88265bf404f55b85388c81a240199
73
+ msgid "After that, you need to verify cloud access with a command like:"
74
+ msgstr "随后,您需要用如下命令确认是否能使用云:"
75
+
76
+ #: ../../Qwen/source/deployment/skypilot.rst:44
77
+ #: 72025dfba0144f63a720f6da0dd39bfa
78
+ msgid "For more information, check the `official document <https://skypilot.readthedocs.io/en/latest/getting-started/installation.html>`__ and see if you have set up your cloud accounts correctly."
79
+ msgstr "若需更多信息,请查阅官方文档,确认您的云账户设置是否正确无误。"
80
+
81
+ #: ../../Qwen/source/deployment/skypilot.rst:47
82
+ #: 61be006061554e5ea40d55497e11e192
83
+ msgid "Alternatively, you can also use the official docker image with SkyPilot master branch automatically cloned by running:"
84
+ msgstr "或者,您也可以使用官方提供的 docker 镜像,可以自动克隆 SkyPilot 的主分支:"
85
+
86
+ #: ../../Qwen/source/deployment/skypilot.rst:63
87
+ #: 4ae89fb44c6643a3a82fca5cee622af4
88
+ msgid "Running Qwen2.5-72B-Instruct with SkyPilot"
89
+ msgstr "使用 SkyPilot 运行 Qwen2.5-72B-Instruct "
90
+
91
+ #: ../../Qwen/source/deployment/skypilot.rst:65
92
+ #: 1bc4973c2eb745689ded0af54ba33e0e
93
+ msgid "Start serving Qwen2.5-72B-Instruct on a single instance with any available GPU in the list specified in `serve-72b.yaml <https://github.com/skypilot-org/skypilot/blob/master/llm/qwen/serve-72b.yaml>`__ with a vLLM-powered OpenAI-compatible endpoint:"
94
+ msgstr "`serve-72b.yaml <https://github.com/skypilot-org/skypilot/blob/master/llm/qwen/serve-72b.yaml>`__ 中列出了支持的 GPU 。您可使用配备这类 GPU 的单个运算实例来部署 Qwen2.5-72B-Instruct 服务。该服务由 vLLM 搭建,并与 OpenAI API 兼容。以下为部署方法:"
95
+
96
+ #: ../../Qwen/source/deployment/skypilot.rst:74
97
+ #: ../../Qwen/source/deployment/skypilot.rst:123
98
+ #: ac3692ed16974facbd58b6886cd111af b325de015e7b4bb0a91491d3f7418792
99
+ msgid "**Before launching, make sure you have changed Qwen/Qwen2-72B-Instruct to Qwen/Qwen2.5-72B-Instruct in the YAML file.**"
100
+ msgstr "**在启动之前,请先将 YAML 文件中的 Qwen/Qwen2-72B-Instruct 修改为 Qwen/Qwen2.5-72B-Instruct。**"
101
+
102
+ #: ../../Qwen/source/deployment/skypilot.rst:76
103
+ #: 6046b3c86fae4a43878fbadbeb33fbd8
104
+ msgid "Send a request to the endpoint for completion:"
105
+ msgstr "向该 endpoint 发送续写请求:"
106
+
107
+ #: ../../Qwen/source/deployment/skypilot.rst:90
108
+ #: 2ec56c2028a94f568fd2c1a65063d25a
109
+ msgid "Send a request for chat completion:"
110
+ msgstr "向该 endpoint 发送对话续写请求"
111
+
112
+ #: ../../Qwen/source/deployment/skypilot.rst:112
113
+ #: c8e140ddfd914ff5a460621a7ca1891e
114
+ msgid "Scale up the service with SkyPilot Serve"
115
+ msgstr "使用 SkyPilot Serve 扩展服务规模"
116
+
117
+ #: ../../Qwen/source/deployment/skypilot.rst:114
118
+ #: 0db304ab396d45adb6017d78cd1ee4a2
119
+ msgid "With `SkyPilot Serve <https://skypilot.readthedocs.io/en/latest/serving/sky-serve.html>`__, a serving library built on top of SkyPilot, scaling up the Qwen service is as simple as running:"
120
+ msgstr "使用 `SkyPilot Serve <https://skypilot.readthedocs.io/en/latest/serving/sky-serve.html>`__ 扩展 Qwen 的服务规模非常容易,只需运行:"
121
+
122
+ #: ../../Qwen/source/deployment/skypilot.rst:125
123
+ #: 25bbbf9e49be44d3899074ff97202d71
124
+ msgid "This will start the service with multiple replicas on the cheapest available locations and accelerators. SkyServe will automatically manage the replicas, monitor their health, autoscale based on load, and restart them when needed."
125
+ msgstr "这将启动服务,使用多个副本部署在最经济的可用位置和加速器上。 SkyServe 将自动管理这些副本,监控其健康状况,根据负载进行自动伸缩,并在必要时重启它们。"
126
+
127
+ #: ../../Qwen/source/deployment/skypilot.rst:130
128
+ #: bda628bab7ef41a0918dc4b80a9b3cfe
129
+ msgid "A single endpoint will be returned and any request sent to the endpoint will be routed to the ready replicas."
130
+ msgstr "将返回一个 endpoint ,所有发送至该endpoint的请求都将被路由至就绪状态的副本。"
131
+
132
+ #: ../../Qwen/source/deployment/skypilot.rst:133
133
+ #: b232dbbdcf674d56bcf9c0331c020864
134
+ msgid "To check the status of the service, run:"
135
+ msgstr "运行如下命令检查服务的状态:"
136
+
137
+ #: ../../Qwen/source/deployment/skypilot.rst:139
138
+ #: 556b854caf7243fb93f253ebe2dc9033
139
+ msgid "After a while, you will see the following output:"
140
+ msgstr "很快,您将看到如下输出:"
141
+
142
+ #: ../../Qwen/source/deployment/skypilot.rst:152
143
+ #: 5a6055c5a42c4b2db6693c1095688de8
144
+ msgid "As shown, the service is now backed by 2 replicas, one on Azure and one on GCP, and the accelerator type is chosen to be **the cheapest available one** on the clouds. That said, it maximizes the availability of the service while minimizing the cost."
145
+ msgstr "如下所示:该服务现由两个副本提供支持,一个位于 Azure 平台,另一个位于 GCP 平台。同时,已为服务选择云服务商提供的 **最经济实惠** 的加速器类型。这样既最大限度地提升了服务的可用性,又尽可能降低了成本。"
146
+
147
+ #: ../../Qwen/source/deployment/skypilot.rst:157
148
+ #: a18533d33dc54a1091ded0b4bba0a1eb
149
+ msgid "To access the model, we use a ``curl -L`` command (``-L`` to follow redirect) to send the request to the endpoint:"
150
+ msgstr "要访问模型,我们使用带有 ``curl -L`` (用于跟随重定向),将请求发送到 endpoint :"
151
+
152
+ #: ../../Qwen/source/deployment/skypilot.rst:182
153
+ #: 34cd50fd79e24d8895075f7841b025e4
154
+ msgid "Accessing Qwen2.5 with Chat GUI"
155
+ msgstr "使用 Chat GUI 调用 Qwen2.5"
156
+
157
+ #: ../../Qwen/source/deployment/skypilot.rst:184
158
+ #: ca6994cda1cb469e83ce8c026bb67e42
159
+ msgid "It is also possible to access the Qwen2.5 service with GUI by connecting a `FastChat GUI server <https://github.com/lm-sys/FastChat>`__ to the endpoint launched above (see `gui.yaml <https://github.com/skypilot-org/skypilot/blob/master/llm/qwen/gui.yaml>`__)."
160
+ msgstr "可以通过 `FastChat <https://github.com/lm-sys/FastChat>`__ 来使用 GUI 调用 Qwen2.5 的服务:"
161
+
162
+ #: ../../Qwen/source/deployment/skypilot.rst:188
163
+ #: 99a63e55ab5c46258c20ab89cdfa39dc
164
+ msgid "Start the Chat Web UI:"
165
+ msgstr "开启一个 Chat Web UI"
166
+
167
+ #: ../../Qwen/source/deployment/skypilot.rst:194
168
+ #: e61593a092c146f8a06af896d6af17f2
169
+ msgid "**Before launching, make sure you have changed Qwen/Qwen1.5-72B-Chat to Qwen/Qwen2.5-72B-Instruct in the YAML file.**"
170
+ msgstr "**在启动之前,请先将 YAML 文件中的 Qwen/Qwen1.5-72B-Chat 修改为 Qwen/Qwen2.5-72B-Instruct。**"
171
+
172
+ #: ../../Qwen/source/deployment/skypilot.rst:196
173
+ #: 9631068a8b424aa8af6dc6911daac7a9
174
+ msgid "Then, we can access the GUI at the returned gradio link:"
175
+ msgstr "随后,我们可以通过返回的 gradio 链接来访问 GUI :"
176
+
177
+ #: ../../Qwen/source/deployment/skypilot.rst:202
178
+ #: 1464a56dcd06404aafbe6d7d2c72212b
179
+ msgid "Note that you may get better results by using a different temperature and top_p value."
180
+ msgstr "你可以通过使用不同的温度和 top_p 值来尝试取得更好的结果。"
181
+
182
+ #: ../../Qwen/source/deployment/skypilot.rst:205
183
+ #: d257f49d835e4c12b28bc680bb78a9cb
184
+ msgid "Summary"
185
+ msgstr "总结"
186
+
187
+ #: ../../Qwen/source/deployment/skypilot.rst:207
188
+ #: 06b9684a19774eaba4f69862332c5166
189
+ msgid "With SkyPilot, it is easy for you to deploy Qwen2.5 on any cloud. We advise you to read the official doc for more usages and updates. Check `this <https://skypilot.readthedocs.io/>`__ out!"
190
+ msgstr "通过 SkyPilot ,你可以轻松地在任何云上部署 Qwen2.5 。我们建议您阅读 `官方文档 <https://skypilot.readthedocs.io/>`__ 了解更多用法和最新进展。"
191
+
docs/locales/zh_CN/LC_MESSAGES/deployment/tgi.po ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
+
21
+ #: ../../Qwen/source/deployment/tgi.rst:2 2abcc96f9deb4b9187ac9d88fc69e929
22
+ msgid "TGI"
23
+ msgstr ""
24
+
25
+ #: ../../Qwen/source/deployment/tgi.rst:5 2d124d7cb95f47388aa48c662932ef9b
26
+ msgid "To be updated for Qwen3."
27
+ msgstr "仍需为Qwen3更新。"
28
+
29
+ #: ../../Qwen/source/deployment/tgi.rst:7 4e5d299c4fdd46d5aba38c9af5765792
30
+ msgid "Hugging Face's Text Generation Inference (TGI) is a production-ready framework specifically designed for deploying and serving large language models (LLMs) for text generation tasks. It offers a seamless deployment experience, powered by a robust set of features:"
31
+ msgstr "Hugging Face 的 Text Generation Inference (TGI) 是一个专为部署大规模语言模型 (Large Language Models, LLMs) 而设计的生产级框架。TGI提供了流畅的部署体验,并稳定支持如下特性:"
32
+
33
+ #: ../../Qwen/source/deployment/tgi.rst:9 ecd4fc11a95140959915d062791ceba1
34
+ msgid "`Speculative Decoding <Speculative Decoding_>`_: Accelerates generation speeds."
35
+ msgstr "`推测解码 (Speculative Decoding) <Speculative Decoding_>`_ :提升生成速度。"
36
+
37
+ #: ../../Qwen/source/deployment/tgi.rst:10 84590a56416348bf85b3f296cf57e257
38
+ msgid "`Tensor Parallelism`_: Enables efficient deployment across multiple GPUs."
39
+ msgstr "张量并行 (`Tensor Parallelism`_) :高效多卡部署。"
40
+
41
+ #: ../../Qwen/source/deployment/tgi.rst:11 a996d6ecd7b94c5cb9752d370f29a9b1
42
+ msgid "`Token Streaming`_: Allows for the continuous generation of text."
43
+ msgstr "流式生成 (`Token Streaming`_) :支持持续性生成文本。"
44
+
45
+ #: ../../Qwen/source/deployment/tgi.rst:12 8f591c045ba34f4581bb19652db9f9b3
46
+ msgid "Versatile Device Support: Works seamlessly with `AMD`_, `Gaudi`_ and `AWS Inferentia`_."
47
+ msgstr "灵活的硬件支持:与 `AMD`_ , `Gaudi`_ 和 `AWS Inferentia`_ 无缝衔接。"
48
+
49
+ #: ../../Qwen/source/deployment/tgi.rst:21 5e8a98b91fc146e0b581422faa683a18
50
+ msgid "Installation"
51
+ msgstr "安装"
52
+
53
+ #: ../../Qwen/source/deployment/tgi.rst:23 684ef25bfb0e460999d6dcccce41b85f
54
+ msgid "The easiest way to use TGI is via the TGI docker image. In this guide, we show how to use TGI with docker."
55
+ msgstr "通过 TGI docker 镜像使用 TGI 轻而易举。本文将主要介绍 TGI 的 docker 用法。"
56
+
57
+ #: ../../Qwen/source/deployment/tgi.rst:25 c563fa3eccb04d00a477c1d2e8b15c38
58
+ msgid "It's possible to run it locally via Conda or build locally. Please refer to `Installation Guide <https://huggingface.co/docs/text-generation-inference/installation>`_ and `CLI tool <https://huggingface.co/docs/text-generation-inference/en/basic_tutorials/using_cli>`_ for detailed instructions."
59
+ msgstr "也可通过 Conda 实机安装或搭建服务。请参考 `Installation Guide <https://huggingface.co/docs/text-generation-inference/installation>`_ 与 `CLI tool <https://huggingface.co/docs/text-generation-inference/en/basic_tutorials/using_cli>`_ 以了解详细说明。"
60
+
61
+ #: ../../Qwen/source/deployment/tgi.rst:28 b55fc58ff4cb472abca08296409c7837
62
+ msgid "Deploy Qwen2.5 with TGI"
63
+ msgstr "通过 TGI 部署 Qwen2.5"
64
+
65
+ #: ../../Qwen/source/deployment/tgi.rst:30 586a8425ec5d413592fd7daf579c7e87
66
+ msgid "**Find a Qwen2.5 Model:** Choose a model from `the Qwen2.5 collection <https://huggingface.co/collections/Qwen/qwen25-66e81a666513e518adb90d9e>`_."
67
+ msgstr "**选定 Qwen2.5 模型:** 从 `the Qwen2.5 collection <https://huggingface.co/collections/Qwen/qwen25-66e81a666513e518adb90d9e>`_ 中挑选模型。"
68
+
69
+ #: ../../Qwen/source/deployment/tgi.rst:31 50fcab8da35941eca308786979dbaf38
70
+ msgid "**Deployment Command:** Run the following command in your terminal, replacing ``model`` with your chosen Qwen2.5 model ID and ``volume`` with the path to your local data directory:"
71
+ msgstr "**部署TGI服务:** 在终端中运行以下命令,注意替换 ``model`` 为选定的 Qwen2.5 模型 ID 、 ``volume`` 为本地的数据路径: "
72
+
73
+ #: ../../Qwen/source/deployment/tgi.rst:42 2a800533a7d84bdeab1da0976b0cab53
74
+ msgid "Using TGI API"
75
+ msgstr "使用 TGI API"
76
+
77
+ #: ../../Qwen/source/deployment/tgi.rst:44 f05d1ec08140452782d0659543fad7d1
78
+ msgid "Once deployed, the model will be available on the mapped port (8080)."
79
+ msgstr "一旦成功部署,API 将于选定的映射端口 (8080) 提供服务。"
80
+
81
+ #: ../../Qwen/source/deployment/tgi.rst:46 f265dc1522b049c98ba31fd5d255c50f
82
+ msgid "TGI comes with a handy API for streaming response:"
83
+ msgstr "TGI 提供了简单直接的 API 支持流式生成:"
84
+
85
+ #: ../../Qwen/source/deployment/tgi.rst:54 e9cc4c0571b74bd08b2a59347503e653
86
+ msgid "It's also available on OpenAI style API:"
87
+ msgstr "也可使用 OpenAI 风格的 API 使用 TGI :"
88
+
89
+ #: ../../Qwen/source/deployment/tgi.rst:73 5dc7e9c74fc04483ba8e5dcdd7052020
90
+ msgid "The model field in the JSON is not used by TGI, you can put anything."
91
+ msgstr "JSON 中的 model 字段不会被 TGI 识别,您可传入任意值。"
92
+
93
+ #: ../../Qwen/source/deployment/tgi.rst:75 d60f837152014cda8baebc90d65d1cc0
94
+ #, python-format
95
+ msgid "Refer to the `TGI Swagger UI <https://huggingface.github.io/text-generation-inference/#/Text%20Generation%20Inference/completions>`_ for a complete API reference."
96
+ msgstr "完整 API 文档,请查阅 `TGI Swagger UI <https://huggingface.github.io/text-generation-inference/#/Text%20Generation%20Inference/completions>`_ 。"
97
+
98
+ #: ../../Qwen/source/deployment/tgi.rst:77 b59564031e5548088aef828f9753e337
99
+ msgid "You can also use Python API:"
100
+ msgstr "你也可以使用 Python 访问 API :"
101
+
102
+ #: ../../Qwen/source/deployment/tgi.rst:106 62646cecb024479ebfeca5f3063e7322
103
+ msgid "Quantization for Performance"
104
+ msgstr "量化"
105
+
106
+ #: ../../Qwen/source/deployment/tgi.rst:108 4a8d39bf37be4820afb230f9a977b431
107
+ msgid "Data-dependent quantization (GPTQ and AWQ)"
108
+ msgstr "依赖数据的量化方案( GPTQ 与 AWQ )"
109
+
110
+ #: ../../Qwen/source/deployment/tgi.rst:110 ef2b18f47e4f4f7ebb017be628cb0be9
111
+ msgid "Both GPTQ and AWQ models are data-dependent. The official quantized models can be found from `the Qwen2.5 collection`_ and you can also quantize models with your own dataset to make it perform better on your use case."
112
+ msgstr "GPTQ 与 AWQ 均依赖数据进行量化。我们提供了预先量化好的模型,请于 `the Qwen2.5 collection`_ 查找。你也可以使用自己的数据集自行量化,以在你的场景中取得更好效果。"
113
+
114
+ #: ../../Qwen/source/deployment/tgi.rst:112 53d94278a2e3409abb9980ebc7c96c24
115
+ msgid "The following shows the command to start TGI with Qwen2.5-7B-Instruct-GPTQ-Int4:"
116
+ msgstr "以下是通过 TGI 部署 Qwen2.5-7B-Instruct-GPTQ-Int4 的指令:"
117
+
118
+ #: ../../Qwen/source/deployment/tgi.rst:122 68ff8a07d0eb40cfa67d79e01adea070
119
+ msgid "If the model is quantized with AWQ, e.g. Qwen/Qwen2.5-7B-Instruct-AWQ, please use ``--quantize awq``."
120
+ msgstr "如果模型是 AWQ 量化的,如 Qwen/Qwen2.5-7B-Instruct-AWQ ,请使用 ``--quantize awq`` 。"
121
+
122
+ #: ../../Qwen/source/deployment/tgi.rst:124 b4c3b82b1f2a43a8a02383fd0afbda5f
123
+ msgid "Data-agnostic quantization"
124
+ msgstr "不依赖数据的量化方案"
125
+
126
+ #: ../../Qwen/source/deployment/tgi.rst:126 7a6b89c94b72407482b96790f5bbd272
127
+ msgid "EETQ on the other side is not data dependent and can be used with any model. Note that we're passing in the original model (instead of a quantized model) with the ``--quantize eetq`` flag."
128
+ msgstr "EETQ 是一种不依赖数据的量化方案,可直接用于任意模型。请注意,我们需要传入原始模型,并使用 ``--quantize eetq`` 标志。"
129
+
130
+ #: ../../Qwen/source/deployment/tgi.rst:138 763166da65924887b3bba99ea4d2baab
131
+ msgid "Multi-Accelerators Deployment"
132
+ msgstr "多卡部署"
133
+
134
+ #: ../../Qwen/source/deployment/tgi.rst:140 ddcfcff947894f168c7945ae9c42a579
135
+ msgid "Use the ``--num-shard`` flag to specify the number of accelerators. Please also use ``--shm-size 1g`` to enable shared memory for optimal NCCL performance (`reference <https://github.com/huggingface/text-generation-inference?tab=readme-ov-file#a-note-on-shared-memory-shm>`__):"
136
+ msgstr "使用 ``--num-shard`` 指定卡书数量。 请务必传入 ``--shm-size 1g`` 让 NCCL 发挥最好性能 (`说明 <https://github.com/huggingface/text-generation-inference?tab=readme-ov-file#a-note-on-shared-memory-shm>`__) :"
137
+
138
+ #: ../../Qwen/source/deployment/tgi.rst:151 520c46fb404c4ec9bf89280e4a71f1e8
139
+ msgid "Speculative Decoding"
140
+ msgstr "推测性解码 (Speculative Decoding)"
141
+
142
+ #: ../../Qwen/source/deployment/tgi.rst:153 74c6b65f76b74d56ad109af9da11f66e
143
+ msgid "Speculative decoding can reduce the time per token by speculating on the next token. Use the ``--speculative-decoding`` flag, setting the value to the number of tokens to speculate on (default: 0 for no speculation):"
144
+ msgstr "推测性解码 (Speculative Decoding) 通过预先推测下一 token 来节约每 token 需要的时间。使用 ``--speculative-decoding`` 设定预先推测 token 的数量 (默认为0,表示不预先推测):"
145
+
146
+ #: ../../Qwen/source/deployment/tgi.rst:164 dee05ee0fb1a4f2da42b250192d943f5
147
+ msgid "The overall performance of speculative decoding highly depends on the type of task. It works best for code or highly repetitive text."
148
+ msgstr "推测性解码的加速效果依赖于任务类型,对于代码或重复性较高的文本生成任务,提速更明显。"
149
+
150
+ #: ../../Qwen/source/deployment/tgi.rst:166 731f300bc1174589901dd5feb26e8b2f
151
+ msgid "More context on speculative decoding can be found `here <https://huggingface.co/docs/text-generation-inference/conceptual/speculation>`__."
152
+ msgstr "更多说明可查阅 `此文档 <https://huggingface.co/docs/text-generation-inference/conceptual/speculation>`__ 。"
153
+
154
+ #: ../../Qwen/source/deployment/tgi.rst:170 65a7d5553dd145398f9705c1ee6c28f0
155
+ msgid "Zero-Code Deployment with HF Inference Endpoints"
156
+ msgstr "使用 HF Inference Endpoints 零代码部署"
157
+
158
+ #: ../../Qwen/source/deployment/tgi.rst:172 721c3a7578f846ae8e21e595923e17e7
159
+ msgid "For effortless deployment, leverage Hugging Face Inference Endpoints:"
160
+ msgstr "使用 Hugging Face Inference Endpoints 不费吹灰之力:"
161
+
162
+ #: ../../Qwen/source/deployment/tgi.rst:174 7741607488d94a9f8be2ffcb6a5322fb
163
+ msgid "**GUI interface:** `<https://huggingface.co/inference-endpoints/dedicated>`__"
164
+ msgstr ""
165
+
166
+ #: ../../Qwen/source/deployment/tgi.rst:175 02ff4520e66f4a42828483da7d25445f
167
+ msgid "**Coding interface:** `<https://huggingface.co/blog/tgi-messages-api>`__"
168
+ msgstr ""
169
+
170
+ #: ../../Qwen/source/deployment/tgi.rst:177 d35f9dd4bc96400cb6c7584012d2df49
171
+ msgid "Once deployed, the endpoint can be used as usual."
172
+ msgstr "一旦部署成功,服务使用与本地无异。"
173
+
174
+ #: ../../Qwen/source/deployment/tgi.rst:181 61c1b825bbf24be2aaaeb99de3f0660e
175
+ msgid "Common Issues"
176
+ msgstr "常见问题"
177
+
178
+ #: ../../Qwen/source/deployment/tgi.rst:183 b55a2d286fc24dbe92b79ab5c010c7af
179
+ msgid "Qwen2.5 supports long context lengths, so carefully choose the values for ``--max-batch-prefill-tokens``, ``--max-total-tokens``, and ``--max-input-tokens`` to avoid potential out-of-memory (OOM) issues. If an OOM occurs, you'll receive an error message upon startup. The following shows an example to modify those parameters:"
180
+ msgstr "Qwen2.5 支持长上下文,谨慎设定 ``--max-batch-prefill-tokens`` , ``--max-total-tokens`` 和 ``--max-input-tokens`` 以避免 out-of-memory (OOM) 。如 OOM ,你将在启动 TGI 时收到错误提示。以下为修改这些参数的示例:"
181
+
docs/locales/zh_CN/LC_MESSAGES/deployment/vllm.po ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-06-13 16:50+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.16.0\n"
18
+
19
+ #: ../../source/deployment/vllm.md:1 d5c0a6a59a4e4efdba77515c0c05f04a
20
+ msgid "vLLM"
21
+ msgstr ""
22
+
23
+ #: ../../source/deployment/vllm.md:3 56317e0cd3104065a8496366f9bdcb67
24
+ msgid "We recommend you trying [vLLM](https://github.com/vllm-project/vllm) for your deployment of Qwen. It is simple to use, and it is fast with state-of-the-art serving throughput, efficient management of attention key value memory with PagedAttention, continuous batching of input requests, optimized CUDA kernels, etc. To learn more about vLLM, please refer to the [paper](https://arxiv.org/abs/2309.06180) and [documentation](https://docs.vllm.ai/)."
25
+ msgstr "我们建议您在部署 Qwen 时尝试使用 [vLLM](https://github.com/vllm-project/vllm)。它易于使用,且具有最先进的服务吞吐量、高效的注意力键值内存管理(通过PagedAttention实现)、连续批处理输入请求、优化的CUDA内核等功能。要了解更多关于vLLM的信息,请参阅 [论文](https://arxiv.org/abs/2309.06180) 和 [文档](https://docs.vllm.ai/)。"
26
+
27
+ #: ../../source/deployment/vllm.md:7 81077ec6d7594b85b64857ee22883693
28
+ msgid "Environment Setup"
29
+ msgstr "环境配置"
30
+
31
+ #: ../../source/deployment/vllm.md:9 f80ee07832674dbfb3c547d0bd003720
32
+ msgid "By default, you can install `vllm` with pip in a clean environment:"
33
+ msgstr "默认情况下,你可以通过 pip 在新环境中安装 `vllm` : "
34
+
35
+ #: ../../source/deployment/vllm.md:15 7c0520bacc8941108def669c821603a9
36
+ msgid "Please note that the prebuilt `vllm` has strict dependencies on `torch` and its CUDA versions. Check the note in the official document for installation ([link](https://docs.vllm.ai/en/latest/getting_started/installation.html)) for more help."
37
+ msgstr "请留意预构建的`vllm`对`torch`和其CUDA版本有强依赖。请查看[vLLM官方文档](https://docs.vllm.ai/en/latest/getting_started/installation.html)中的注意事项以获取有关安装的帮助。"
38
+
39
+ #: ../../source/deployment/vllm.md:18 ab785eb82e7f40a08269510d1cb5610d
40
+ msgid "API Service"
41
+ msgstr "API 服务"
42
+
43
+ #: ../../source/deployment/vllm.md:20 fa0b4510d60d489c94435c334100e413
44
+ msgid "It is easy to build an OpenAI-compatible API service with vLLM, which can be deployed as a server that implements OpenAI API protocol. By default, it starts the server at `http://localhost:8000`. You can specify the address with `--host` and `--port` arguments. Run the command as shown below:"
45
+ msgstr "借助vLLM,构建一个与OpenAI API兼容的API服务十分简便,该服务可以作为实现OpenAI API协议的服务器进行部署。默认情况下,它将在 `http://localhost:8000` 启动服务器。您可以通过 `--host` 和 `--port` 参数来自定义地址。请按照以下所示运行命令:"
46
+
47
+ #: ../../source/deployment/vllm.md:28 66e317eb19424af7a54eb52093e7945b
48
+ msgid "By default, if the model does not point to a valid local directory, it will download the model files from the Hugging Face Hub. To download model from ModelScope, set the following before running the above command:"
49
+ msgstr "默认情况下,如果模型未指向有效的本地目录,它将从 Hugging Face Hub 下载模型文件。要从 ModelScope 下载模型,请在运行上述命令之前设置以下内容:"
50
+
51
+ #: ../../source/deployment/vllm.md:34 4d9631b6922c4f08b9be1ec85a956309
52
+ msgid "For distributed inference with tensor parallelism, it is as simple as"
53
+ msgstr "对于使用张量并行的分布式推理,操作非常简单:"
54
+
55
+ #: ../../source/deployment/vllm.md:38 33cc8d44a1434af2af200659add2e57f
56
+ msgid "The above command will use tensor parallelism on 4 GPUs. You should change the number of GPUs according to your demand."
57
+ msgstr "上述命令将在 4 块 GPU 上使用张量并行。您应根据需求调整 GPU 的数量。"
58
+
59
+ #: ../../source/deployment/vllm.md:41 605a634a44e3401ab46c77933aa2817e
60
+ msgid "Basic Usage"
61
+ msgstr "基本用法"
62
+
63
+ #: ../../source/deployment/vllm.md:43 58fb05b376b545e4892584539004c4c8
64
+ msgid "Then, you can use the [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) to communicate with Qwen:"
65
+ msgstr "然后,您可以利用 [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) 来与Qwen进行对话:"
66
+
67
+ #: ../../source/deployment/vllm.md b9a21dd5fe924a36ae4d655aa7c2d127
68
+ #: f95affb6c52340bd8623c319fa8a159f
69
+ msgid "curl"
70
+ msgstr ""
71
+
72
+ #: ../../source/deployment/vllm.md 3c6242c05b90435dbf1c971ce061e127
73
+ #: 92e58b5637bd4af1bc4df269071a3df5
74
+ msgid "Python"
75
+ msgstr ""
76
+
77
+ #: ../../source/deployment/vllm.md:63 ../../source/deployment/vllm.md:129
78
+ #: 12be4f0cf2b9495faee25799b266a799 855aea8cb2fa48f7a63c6a511cb03fd5
79
+ msgid "You can use the API client with the `openai` Python SDK as shown below:"
80
+ msgstr "或者您可以如下面所示使用 `openai` Python SDK中的 API 客户端:"
81
+
82
+ #: ../../source/deployment/vllm.md:93 85d6fac1e7e24de1983be918b3e0ea3e
83
+ msgid "`vllm` will use the sampling parameters from the `generation_config.json` in the model files."
84
+ msgstr "`vllm` 将使用模型文件中 `generation_config.json` 的采样参数。"
85
+
86
+ #: ../../source/deployment/vllm.md:95 1323928e307d4ed9bcd1e538e61f0d2d
87
+ msgid "While the default sampling parameters would work most of the time for thinking mode, it is recommended to adjust the sampling parameters according to your application, and always pass the sampling parameters to the API."
88
+ msgstr "虽然默认的采样参数在大多数情况下适用于思考模式,但建议根据您的应用调整采样参数,并始终将采样参数传递给 API。"
89
+
90
+ #: ../../source/deployment/vllm.md:101 84e3b8ae27ab4242973d411876f79250
91
+ msgid "Thinking & Non-Thinking Modes"
92
+ msgstr "思考与非思考模式"
93
+
94
+ #: ../../source/deployment/vllm.md:103 80dddb284cb8439399ad0e3c2227cc0e
95
+ msgid "Qwen3 models will think before respond. This behavior could be controlled by either the hard switch, which could disable thinking completely, or the soft switch, where the model follows the instruction of the user on whether it should think."
96
+ msgstr "Qwen3 模型会在回复前进行思考。这种行为可以通过硬开关(完全禁用思考)或软开关(模型遵循用户关于是否应该思考的指令)来控制。"
97
+
98
+ #: ../../source/deployment/vllm.md:106 88d3ca0f6faf4b8b80012f0a1b3a53ea
99
+ msgid "The hard switch is available in vLLM through the following configuration to the API call. To disable thinking, use"
100
+ msgstr "硬开关在 vLLM 中可以通过以下 API 调用配置使用。要禁用思考,请使用"
101
+
102
+ #: ../../source/deployment/vllm.md:162 bfc88862f9e5470e8d8e213003c310bc
103
+ msgid "Please note that passing `enable_thinking` is not OpenAI API compatible. The exact method may differ among frameworks."
104
+ msgstr "请注意,`enable_thinking`并非OpenAI API定义的参数,具体传入方式可能因推理框架不同而不同。"
105
+
106
+ #: ../../source/deployment/vllm.md:167 1d3ab8c3e2d24c0d9961b38686661005
107
+ msgid "To completely disable thinking, you could use [a custom chat template](../../source/assets/qwen3_nonthinking.jinja) when starting the model:"
108
+ msgstr "要完全禁用思考,您可以在启动模型时使用[自定义聊天模板](../../source/assets/qwen3_nonthinking.jinja):"
109
+
110
+ #: ../../source/deployment/vllm.md:173 495c3e31b2614dd8bad7f0eba0d48236
111
+ msgid "The chat template prevents the model from generating thinking content, even if the user instructs the model to do so with `/think`."
112
+ msgstr "该聊天模板会阻止模型生成思考内容,即使用户通过 `/think` 指示模型这样做。"
113
+
114
+ #: ../../source/deployment/vllm.md:178 02a8fc8d1024402ebc4f9449aa2500f3
115
+ msgid "It is recommended to set sampling parameters differently for thinking and non-thinking modes."
116
+ msgstr "建议为思考模式和非思考模式分别设置不同的采样参数。"
117
+
118
+ #: ../../source/deployment/vllm.md:182 35e320018c0646cb82ad0d2f9fc54ea8
119
+ msgid "Parsing Thinking Content"
120
+ msgstr "解析思考内容"
121
+
122
+ #: ../../source/deployment/vllm.md:184 efeeeb8ff56e4f37af53bd7a6e440d65
123
+ msgid "vLLM supports parsing the thinking content from the model generation into structured messages:"
124
+ msgstr "vLLM 支持将模型生成的思考内容解析为结构化消息:"
125
+
126
+ #: ../../source/deployment/vllm.md:189 a79e5778da03462199a629ed038526a8
127
+ msgid "Since vLLM 0.9.0, one can also use"
128
+ msgstr "自 vLLM 0.9.0 版本,也可以使用"
129
+
130
+ #: ../../source/deployment/vllm.md:194 7fdb9af5391b402280be7aeaa514dcd3
131
+ msgid "The response message will have a field named `reasoning_content` in addition to `content`, containing the thinking content generated by the model."
132
+ msgstr "响应消息除了包含 `content` 字段外,还会有一个名为 `reasoning_content` 的字段,其中包含模型生成的思考内容。"
133
+
134
+ #: ../../source/deployment/vllm.md:197 7036cf771a4e4fddbcbf92cc52de59d0
135
+ msgid "Please note that this feature is not OpenAI API compatible."
136
+ msgstr "请注意,此功能与 OpenAI API 规范不一致。"
137
+
138
+ #: ../../source/deployment/vllm.md:201 5e0250bbffa94e7dac6c9278e0d87ab6
139
+ msgid "As of vLLM 0.8.5, `enable_thinking=False` is not compatible with this feature. If you need to pass `enable_thinking=False` to the API, you should disable parsing thinking content. This is resolved in vLLM 0.9.0 with the `qwen3` reasoning parser."
140
+ msgstr "在 vLLM 0.8.5 版本中,`enable_thinking=False` 与此功能不兼容。如果需要向 API 传递 `enable_thinking=False`,则应禁用解析思考内容。此问题已在 vLLM 0.9.0 中通过 `qwen3` 思考解析器得到解决。"
141
+
142
+ #: ../../source/deployment/vllm.md:206 aa45c227d5d040dea6522bf2a45576b0
143
+ msgid "Parsing Tool Calls"
144
+ msgstr "解析工具调用"
145
+
146
+ #: ../../source/deployment/vllm.md:208 56c12209324f41fcbed13409de6d0aa5
147
+ msgid "vLLM supports parsing the tool calling content from the model generation into structured messages:"
148
+ msgstr "vLLM 支持将模型生成的工具调用内容解析为结构化消息:"
149
+
150
+ #: ../../source/deployment/vllm.md:213 7a12c4073d874bff81f012d7da241e9c
151
+ msgid "For more information, please refer to [our guide on Function Calling](../framework/function_call.md#vllm)."
152
+ msgstr "详细信息,请参阅[函数调用的指南](../framework/function_call.md#vllm)。"
153
+
154
+ #: ../../source/deployment/vllm.md:215 827710cca0954bfaaeaa8a67fef1efa6
155
+ msgid "Structured/JSON Output"
156
+ msgstr "结构化/JSON输出"
157
+
158
+ #: ../../source/deployment/vllm.md:217 ac630e8cc3b04ad8af427e677896b7ee
159
+ msgid "vLLM supports structured/JSON output. Please refer to [vLLM's documentation](https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#extra-parameters-for-chat-api) for the `guided_json` parameters. Besides, it is also recommended to instruct the model to generate the specific format in the system message or in your prompt."
160
+ msgstr "vLLM 支持结构化/JSON 输出。请参照[vLLM文档](https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#extra-parameters-for-chat-api)了解 `guided_json` 参数。此外,也建议在系统消息或用户提示中指示模型生成特定格式,避免仅依赖于推理参数配置。"
161
+
162
+ #: ../../source/deployment/vllm.md:222 5534e3b2ef2242c69964016b526e1a01
163
+ msgid "Serving Quantized models"
164
+ msgstr "部署量化模型"
165
+
166
+ #: ../../source/deployment/vllm.md:224 dbd8323a4bc6415da9fde179b23dac78
167
+ msgid "Qwen3 comes with two types of pre-quantized models, FP8 and AWQ."
168
+ msgstr "Qwen3 提供了两种类型的预量化模型:FP8 和 AWQ。"
169
+
170
+ #: ../../source/deployment/vllm.md:226 1aedffe7b0874ac289badc829e035300
171
+ msgid "The command serving those models are the same as the original models except for the name change:"
172
+ msgstr "部署这些模型的命令与原始模型相同,只是名称有所更改:"
173
+
174
+ #: ../../source/deployment/vllm.md:236 6d91506e31194076857d992f51d3f336
175
+ msgid "The FP8 models of Qwen3 are block-wise quant, which is supported on NVIDIA GPUs with compute capability > 8.9, that is, Ada Lovelace, Hopper, and later GPUs and runs as w8a8."
176
+ msgstr "Qwen3 的 FP8 模型采用分块 (block-wise) 量化,该功能支持在 compute capability > 8.9 的 NVIDIA GPU 上运行,即 Ada Lovelace、Hopper 及更新的 GPU,并以 w8a8 方式运行。"
177
+
178
+ #: ../../source/deployment/vllm.md:238 f26fbf5e37134274b435efaeada7af6b
179
+ msgid "Since vLLM v0.9.0, FP8 Marlin has supported block-wise quants (running as w8a16) and you can also run Qwen3 FP8 models on Ampere cards."
180
+ msgstr "从 vLLM v0.9.0 开始,FP8 Marlin 已支持分块量化(以 w8a16 方式运行),您还可以在 Ampere 显卡上运行 Qwen3 FP8 模型。"
181
+
182
+ #: ../../source/deployment/vllm.md:242 dca096f25d794f88bb446eb2f39f3570
183
+ msgid "If you encountered the following error when deploying the FP8 models, it indicates that the tensor parallel size does not agree with the model weights:"
184
+ msgstr "如果在部署 FP8 模型时遇到以下错误,这表明张量并行大小与模型权重不匹配:"
185
+
186
+ #: ../../source/deployment/vllm.md:249 609be8d8c32f48c5ade0f1a32873bbf8
187
+ msgid "We recommend lowering the degree of tensor parallel, e.g., `--tensor-parallel-size 4` or enabling expert parallel, e.g., `--tensor-parallel-size 8 --enable-expert-parallel`."
188
+ msgstr "目前,我们建议降低张量并行的程度,例如使用 `--tensor-parallel-size 4`,或者启用专家并行,例如使用 `--tensor-parallel-size 8 --enable-expert-parallel`。"
189
+
190
+ #: ../../source/deployment/vllm.md:252 027c1c2d8d6a46a78c69451e96b6544a
191
+ msgid "Context Length"
192
+ msgstr "上下文长度"
193
+
194
+ #: ../../source/deployment/vllm.md:254 a9dd53625c294f8682cc2fbedce37f45
195
+ msgid "The context length for Qwen3 models in pretraining is up to 32,768 tokens. To handle context length substantially exceeding 32,768 tokens, RoPE scaling techniques should be applied. We have validated the performance of [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts."
196
+ msgstr "Qwen3 模型在预训练中的上下文长度最长为 32,768 个 token。为了处理显著超过 32,768 个 token 的上下文长度,应应用 RoPE 缩放技术。我们已经验证了 [YaRN](https://arxiv.org/abs/2309.00071) 的性能,这是一种增强模型长度外推的技术,可确保在长文本上的最佳性能。"
197
+
198
+ #: ../../source/deployment/vllm.md:258 988e60ef751944c09274ce28aecf3fac
199
+ msgid "vLLM supports YaRN, which can be configured as"
200
+ msgstr "vLLM 支持 YaRN,可以配置为"
201
+
202
+ #: ../../source/deployment/vllm.md:264 7da95eb3121944859d583a7a5885c5c4
203
+ msgid "vLLM implements static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.** We advise adding the `rope_scaling` configuration only when processing long contexts is required. It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0."
204
+ msgstr "vLLM 实现了静态 YaRN,这意味着无论输入长度如何,缩放因子都保持不变,**这可能会对较短文本的性能产生影响。** 我们建议仅在需要处理长上下文时添加 `rope_scaling` 配置。还建议根据需要调整 `factor`。例如,如果您的应用程序的典型上下文长度为 65,536 个 token,则最好将 `factor` 设置为 2.0。"
205
+
206
+ #: ../../source/deployment/vllm.md:270 fa10485203e3408dabb81687868ce059
207
+ msgid "The default `max_position_embeddings` in `config.json` is set to 40,960, which used by vLLM, if `--max-model-len` is not specified. This allocation includes reserving 32,768 tokens for outputs and 8,192 tokens for typical prompts, which is sufficient for most scenarios involving short text processing and leave adequate room for model thinking. If the average context length does not exceed 32,768 tokens, we do not recommend enabling YaRN in this scenario, as it may potentially degrade model performance."
208
+ msgstr "如果未指定 `--max-model-len`,`config.json` 中的默认 `max_position_embeddings` 被设置为 40,960,vLLM 将使用该值。此分配包括为输出保留 32,768 个 token,为典型提示保留 8,192 个 token,这足以应对大多数涉及短文本处理的场景,并为模型思考留出充足空间。如果平均上下文长度不超过 32,768 个 token,我们不建议在此场景中启用 YaRN,因为这可能会降低模型性能。"
209
+
210
+ #: ../../source/deployment/vllm.md:275 fe82482bd3e1406998560b372e2707df
211
+ msgid "Python Library"
212
+ msgstr "Python 库使用"
213
+
214
+ #: ../../source/deployment/vllm.md:277 82fb6b76e9c24978b9bee04927b3d5d4
215
+ msgid "vLLM can also be directly used as a Python library, which is convenient for offline batch inference but lack some API-only features, such as parsing model generation to structure messages."
216
+ msgstr "vLLM 也可以直接用作 Python 库,这对离线批量推理非常方便,但缺少一些仅限 API 的功能,例如将模型生成解析为结构化消息。"
217
+
218
+ #: ../../source/deployment/vllm.md:279 857f6312cd4e44ccb34197793db59165
219
+ msgid "The following shows the basic usage of vLLM as a library:"
220
+ msgstr "以下展示了将 vLLM 用作库的基本用法:"
221
+
222
+ #: ../../source/deployment/vllm.md:316 0c88c07558e04cbd8f2e6cf04091ef62
223
+ msgid "Since vLLM v0.9.0, you can also use the `LLM.chat` interface which includes support for `chat_template_kwargs`:"
224
+ msgstr "自 vLLM v0.9.0 开始,`LLM.chat` 支持 `chat_template_kwargs` 参数,因而也可以使用以下方法:"
225
+
226
+ #: ../../source/deployment/vllm.md:347 de026655e79449f28854a1cbcc182d9f
227
+ msgid "FAQ"
228
+ msgstr "常见问题解答"
229
+
230
+ #: ../../source/deployment/vllm.md:349 30e351b0aebb4e71b187d74895124662
231
+ msgid "You may encounter OOM issues that are pretty annoying. We recommend two arguments for you to make some fix."
232
+ msgstr "您可能会遇到令人烦恼的OOM(内存溢出)问题。我们推荐您尝试两个参数进行修复。"
233
+
234
+ #: ../../source/deployment/vllm.md:352 cc5e992512ff4aa9bdede2e3791264f3
235
+ msgid "The first one is `--max-model-len`. Our provided default `max_position_embedding` is `40960` and thus the maximum length for the serving is also this value, leading to higher requirements of memory. Reducing it to a proper length for yourself often helps with the OOM issue."
236
+ msgstr "第一个参数是 `--max-model-len` 。我们提供的默认最大位置嵌入(`max_position_embedding`)为 40960 ,因此服务时的最大长度也是这个值,这会导致更高的内存需求。将此值适当减小通常有助于解决OOM问题。"
237
+
238
+ #: ../../source/deployment/vllm.md:355 9e8f5e6e064841de8bfa0f581f28c25b
239
+ msgid "Another argument you can pay attention to is `--gpu-memory-utilization`. vLLM will pre-allocate this much GPU memory. By default, it is `0.9`. This is also why you find a vLLM service always takes so much memory. If you are in eager mode (by default it is not), you can level it up to tackle the OOM problem. Otherwise, CUDA Graphs are used, which will use GPU memory not controlled by vLLM, and you should try lowering it. If it doesn't work, you should try `--enforce-eager`, which may slow down inference, or reduce the `--max-model-len`."
240
+ msgstr "另一个您可以关注的参数是 `--gpu-memory-utilization` 。 vLLM将预分配该参数指定比例的显存。默认情况下,该值为 `0.9`。这也是为什么您发现一个vLLM服务总是占用大量内存的原因。如果你使用了eager模式(默认不是),您可以将其调高以应对OOM问题。反之,vLLM会使用CUDA Graphs,而CUDA Graphs会额外占用不受vLLM管理的显存;此时,您应当尝试降低`--gpu-memory-utilization`。如果还是无法解决,可以尝试`--enforce-eager`(这会影响推理效率)或缩小`--max-model-len`。"
241
+
242
+ #: ../../source/deployment/vllm.md:364 2dd3f6552c53423ca7ce0576047f2ab6
243
+ msgid "For more usage guide with vLLM, please see vLLM's [Qwen3 Usage Guide](https://github.com/vllm-project/vllm/issues/17327)."
244
+ msgstr "有关 vLLM 的更多使用指南,请参阅 vLLM 的[Qwen3 使用指南](https://github.com/vllm-project/vllm/issues/17327)。"
245
+
docs/locales/zh_CN/LC_MESSAGES/framework/Langchain.po ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
+
21
+ #: ../../Qwen/source/framework/Langchain.rst:2 6f9b66430d9c495592b1e275fdfd7c9e
22
+ msgid "Langchain"
23
+ msgstr ""
24
+
25
+ #: ../../Qwen/source/framework/Langchain.rst:5 1205af46f88e4d6681003403109385c3
26
+ msgid "To be updated for Qwen3."
27
+ msgstr "仍需为Qwen3更新。"
28
+
29
+ #: ../../Qwen/source/framework/Langchain.rst:7 115ee7b1c8404629a8f98175264cc114
30
+ msgid "This guide helps you build a question-answering application based on a local knowledge base using ``Qwen2.5-7B-Instruct`` with ``langchain``. The goal is to establish a knowledge base Q&A solution."
31
+ msgstr "本教程旨在帮助您利用 ``Qwen2.5-7B-Instruct`` 与 ``langchain`` ,基于本地知识库构建问答应用。目标是建立一个知识库问答解决方案。"
32
+
33
+ #: ../../Qwen/source/framework/Langchain.rst:12
34
+ #: 7257b95612fb423bb9ca73212fd12a02
35
+ msgid "Basic Usage"
36
+ msgstr "基础用法"
37
+
38
+ #: ../../Qwen/source/framework/Langchain.rst:14
39
+ #: fecf7a682dcc4c15a53da1f7cdf145e5
40
+ msgid "The implementation process of this project includes loading files -> reading text -> segmenting text -> vectorizing text -> vectorizing questions -> matching the top k most similar text vectors with the question vectors -> incorporating the matched text as context along with the question into the prompt -> submitting to the Qwen2.5-7B-Instruct to generate an answer. Below is an example:"
41
+ msgstr "您可以仅使用您的文档配合 ``langchain`` 来构建一个问答应用。该项目的实现流程包括加载文件 -> 阅读文本 -> 文本分段 -> 文本向量化 -> 问题向量化 -> 将最相似的前k个文本向量与问题向量匹配 -> 将匹配的文本作为上下文连同问题一起纳入提示 -> 提交给Qwen2.5-7B-Instruct生成答案。以下是一个示例:"
42
+
43
+ #: ../../Qwen/source/framework/Langchain.rst:98
44
+ #: 6ad1ebd2ef4a49f9aa66cfdf777e1290
45
+ msgid "After loading the Qwen2.5-7B-Instruct model, you should specify the txt file for retrieval."
46
+ msgstr "加载Qwen2.5-7B-Instruct模型后,您可以指定需要用于知识库问答的txt文件。"
47
+
48
+ #: ../../Qwen/source/framework/Langchain.rst:274
49
+ #: 00467b1e4e294a26b9f49886633331e0
50
+ msgid "Next Step"
51
+ msgstr "下一步"
52
+
53
+ #: ../../Qwen/source/framework/Langchain.rst:276
54
+ #: 15ed906687054af78545290ba0746380
55
+ msgid "Now you can chat with Qwen2.5 use your own document. Continue to read the documentation and try to figure out more advanced usages of model retrieval!"
56
+ msgstr "现在,您可以在您自己的文档上与Qwen2.5进行交流。继续阅读文档,尝试探索模型检索的更多高级用法!"
57
+
docs/locales/zh_CN/LC_MESSAGES/framework/LlamaIndex.po ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
+
21
+ #: ../../Qwen/source/framework/LlamaIndex.rst:2
22
+ #: 2e41f8696c20488d8593b670c6361edf
23
+ msgid "LlamaIndex"
24
+ msgstr "LlamaIndex"
25
+
26
+ #: ../../Qwen/source/framework/LlamaIndex.rst:5
27
+ #: 20b3836fd391457bb00bf75b61e23e0d
28
+ msgid "To be updated for Qwen3."
29
+ msgstr "仍需为Qwen3更新。"
30
+
31
+ #: ../../Qwen/source/framework/LlamaIndex.rst:7
32
+ #: 86d9e6f0684749aab40a9824cd026fa3
33
+ msgid "To connect Qwen2.5 with external data, such as documents, web pages, etc., we offer a tutorial on `LlamaIndex <https://www.llamaindex.ai/>`__. This guide helps you quickly implement retrieval-augmented generation (RAG) using LlamaIndex with Qwen2.5."
34
+ msgstr "为了实现 Qwen2.5 与外部数据(例如文档、网页等)的连接,我们提供了 `LlamaIndex <https://www.llamaindex.ai/>`__ 的详细教程。本指南旨在帮助用户利用 LlamaIndex 与 Qwen2.5 快速部署检索增强生成(RAG)技术。"
35
+
36
+ #: ../../Qwen/source/framework/LlamaIndex.rst:11
37
+ #: 71ed222858054687a5b33222bb6ac086
38
+ msgid "Preparation"
39
+ msgstr "环境准备"
40
+
41
+ #: ../../Qwen/source/framework/LlamaIndex.rst:13
42
+ #: 161d9153d6484dd5a1f1bdb340847814
43
+ msgid "To implement RAG, we advise you to install the LlamaIndex-related packages first."
44
+ msgstr "为实现检索增强生成(RAG),我们建议您首先安装与 LlamaIndex 相关的软件包。"
45
+
46
+ #: ../../Qwen/source/framework/LlamaIndex.rst:16
47
+ #: a8d6acb1001a42c88185b971ae2de3bf
48
+ msgid "The following is a simple code snippet showing how to do this:"
49
+ msgstr "以下是一个简单的代码示例:"
50
+
51
+ #: ../../Qwen/source/framework/LlamaIndex.rst:25
52
+ #: e441d3b8fb6d4a13b52e1560ef250b16
53
+ msgid "Set Parameters"
54
+ msgstr "设置参数"
55
+
56
+ #: ../../Qwen/source/framework/LlamaIndex.rst:27
57
+ #: c2481804c3f34c7f883eed92ffa3111e
58
+ msgid "Now we can set up LLM, embedding model, and the related configurations. Qwen2.5-Instruct supports conversations in multiple languages, including English and Chinese. You can use the ``bge-base-en-v1.5`` model to retrieve from English documents, and you can download the ``bge-base-zh-v1.5`` model to retrieve from Chinese documents. You can also choose ``bge-large`` or ``bge-small`` as the embedding model or modify the context window size or text chunk size depending on your computing resources. Qwen2.5 model families support a maximum of 32K context window size (up to 128K for 7B, 14B, 32B, and 72B, requiring extra configuration)"
59
+ msgstr "现在,我们可以设置语言模型和向量模型。Qwen2.5-Instruct支持包括英语和中文在内的多种语言对话。您可以使用 ``bge-base-en-v1.5`` 模型来检索英文文档,下载 ``bge-base-zh-v1.5`` 模型以检索中文文档。根据您的计算资源,您还可以选择 ``bge-large`` 或 ``bge-small`` 作为向量模型,或调整上下文窗口大小或文本块大小。Qwen2.5模型系列支持最大32K上下文窗口大小(7B 、14B 、32B 及 72B可扩展支持 128K 上下文,但需要额外配置)"
60
+
61
+ #: ../../Qwen/source/framework/LlamaIndex.rst:85
62
+ #: 74c35d5a03734c289d162dfa3813ada6
63
+ msgid "Build Index"
64
+ msgstr "构建索引"
65
+
66
+ #: ../../Qwen/source/framework/LlamaIndex.rst:87
67
+ #: c49859d4ea5f49dba1fa2263f3ae284d
68
+ msgid "Now we can build index from documents or websites."
69
+ msgstr "现在我们可以从文档或网站构建索引。"
70
+
71
+ #: ../../Qwen/source/framework/LlamaIndex.rst:89
72
+ #: b460d000037e4266a4d9f43d38f1f9b0
73
+ msgid "The following code snippet demonstrates how to build an index for files (regardless of whether they are in PDF or TXT format) in a local folder named 'document'."
74
+ msgstr "以下代码片段展示了如何为本地名为'document'的文件夹中的文件(无论是PDF格式还是TXT格式)构建索引。"
75
+
76
+ #: ../../Qwen/source/framework/LlamaIndex.rst:102
77
+ #: a416d18b227940e29fac1f59851ff8c4
78
+ msgid "The following code snippet demonstrates how to build an index for the content in a list of websites."
79
+ msgstr "以下代码片段展示了如何为一系列网站的内容构建索引。"
80
+
81
+ #: ../../Qwen/source/framework/LlamaIndex.rst:118
82
+ #: 487cf928d048424fa1b50438f701137c
83
+ msgid "To save and load the index, you can use the following code snippet."
84
+ msgstr "要保存和加载已构建的索引,您可以使用以下代码示例。"
85
+
86
+ #: ../../Qwen/source/framework/LlamaIndex.rst:132
87
+ #: c68419c4318d46e891f5df9191be6d2d
88
+ msgid "RAG"
89
+ msgstr "检索增强(RAG)"
90
+
91
+ #: ../../Qwen/source/framework/LlamaIndex.rst:134
92
+ #: 8ad20a8f43fe496084a40f963ba97440
93
+ msgid "Now you can perform queries, and Qwen2.5 will answer based on the content of the indexed documents."
94
+ msgstr "现在您可以输入查询,Qwen2.5 将基于索引文档的内容提供答案。"
95
+
docs/locales/zh_CN/LC_MESSAGES/framework/function_call.po ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-06-13 16:36+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.16.0\n"
20
+
21
+ #: ../../source/framework/function_call.md:6 10546d07829648458ac4f91b91967697
22
+ msgid "Function Calling"
23
+ msgstr "函数调用"
24
+
25
+ #: ../../source/framework/function_call.md:9 97bb46c965d44cb4900c947356c571fd
26
+ msgid "Preface"
27
+ msgstr "前言"
28
+
29
+ #: ../../source/framework/function_call.md:11 539a099d2e764c8181e17c9c41f8053b
30
+ msgid "Function calling with large language models is a huge and evolving topic. It is particularly important for AI applications:"
31
+ msgstr "使用大型语言模型进行函数调用 (Function Calling) 是一个庞大且不断发展的主题。这对AI应用尤为重要:"
32
+
33
+ #: ../../source/framework/function_call.md:13 96e919c9808842ddb3225121c70a350b
34
+ msgid "either for AI-native applications that strive to work around the shortcomings of current AI technology,"
35
+ msgstr "无论是为了绕过当前AI技术的局限性,而设计的原生AI应用,"
36
+
37
+ #: ../../source/framework/function_call.md:14 e7f29fd2c11b413bb08860d1a1c8ad8d
38
+ msgid "or for existing applications that seeks the integration of AI technology to improve performance, user interaction and experience, or efficiency."
39
+ msgstr "还是为了提升性能、用户体验或效率,寻求整合AI技术的现有应用。"
40
+
41
+ #: ../../source/framework/function_call.md:16 cc49601082014a989c503f4461c8a942
42
+ msgid "We will talk about how Qwen3 can be used to support function calling and how it can be used to achieve your goals, from the inference usage for developing application to the inner workings for hardcore customizations. In this guide,"
43
+ msgstr "我们将讨论如何使用 Qwen3 来支持函数调用,以及如何利用它来实现您的目标,从用于开发应用程序的推理用法到针对硬核定制的内部工作机制。在本指南中,"
44
+
45
+ #: ../../source/framework/function_call.md:18 bad8e302d5044edd80cb9da02c0f6dbe
46
+ msgid "We will first demonstrate how to use function calling with Qwen3."
47
+ msgstr "我们首先将展示如何使用Qwen3进行函数调用。"
48
+
49
+ #: ../../source/framework/function_call.md:19 41f975e599264589af4819e9aee96f76
50
+ msgid "Then, we will introduce the technical details on functional calling with Qwen3, which are mainly about the templates."
51
+ msgstr "接着,我们将介绍使用Qwen3行函数调用的技术细节,主要涉及模板的使用。"
52
+
53
+ #: ../../source/framework/function_call.md:21 cad1eaec5df646509123bd97566c69c5
54
+ msgid "Before starting, there is one thing we have not yet introduced, that is ..."
55
+ msgstr "在开始之前,还有一件事我们尚未介绍,那就是…"
56
+
57
+ #: ../../source/framework/function_call.md:23 129f1c1d7bd7486f80955cda6cf77e3f
58
+ msgid "What is function calling?"
59
+ msgstr "什么是函数调用?"
60
+
61
+ #: ../../source/framework/function_call.md:26 cdf0c1412f234bd8bcc386683a38b131
62
+ msgid "There is another term \"tool use\" that may be used to refer to the same concept. While some may argue that tools are a generalized form of functions, at present, their difference exists only technically as different I/O types of programming interfaces."
63
+ msgstr "这一概念也可能被称为“工具使用” (\"tool use\")。虽然有人认为“工具”是“函数”的泛化形式,但在当前,它们的区别仅在技术层面上,表现为编程接口的不同输入输出类型。"
64
+
65
+ #: ../../source/framework/function_call.md:30 93085d6f71dd4349832e0c8832b57966
66
+ msgid "Large language models (LLMs) are powerful things. However, sometimes LLMs by themselves are simply not capable enough."
67
+ msgstr "大型语言模型(LLMs)确实强大。然而,有时候单靠大型语言模型的能力还是不够的。"
68
+
69
+ #: ../../source/framework/function_call.md:32 d441a861290d4a0aaa6fea713b628287
70
+ msgid "On the one hand, LLMs have inherent modeling limitations. For one, they do not know things that are not in their training data, which include those happened after their training ended. In addition, they learn things in the way of likelihood, which suggests that they may not be precise enough for tasks with fixed rule sets, e.g., mathematical computation."
71
+ msgstr "一方面,大型语言模型存在建模局限性。首先,对于训练数据中没有的信息,包括训练结束后发生的事情,它们并不了解。此外,它们通过概率方式学习,这意味着对于有固定规则集的任务,如数学计算,可能不够精确。"
72
+
73
+ #: ../../source/framework/function_call.md:35 f52f0935e2a346e3b1631eeaf2223fb0
74
+ msgid "On the other hand, it is not easy to use LLMs as a Plug-and-Play service programmatically with other things. LLMs mostly talk in words that are open to interpretation and thus ambiguous, while other software or applications or systems talk in code and through programming interfaces that are pre-defined and fixed and structured."
75
+ msgstr "另一方面,将大型语言模型作为即插即用服务与其它系统进行编程式协作,并非易事。大型语言模型的表达多含主观解释成分,因而产生歧义;而其他软件、应用或系统则通过预定义、固定和结构化的代码及编程接口进行沟通。"
76
+
77
+ #: ../../source/framework/function_call.md:38 4ff86e51b366418ba9cd2ff9a8fceb27
78
+ msgid "To this end, function calling establishes a common protocol that specifies how LLMs should interact with the other things. The procedure is mainly as follows:"
79
+ msgstr "为此,函数调用确立了一个通用协议,规定了大型语言模型应与其他实体互动的流程。主要流程如下:"
80
+
81
+ #: ../../source/framework/function_call.md:40 1bc24a6d6a5140cdb2f274b7df61a429
82
+ msgid "The application provides a set of functions and the instructions of the functions to an LLM."
83
+ msgstr "应用程序向大型语言模型提供一组函数及其使用说明。"
84
+
85
+ #: ../../source/framework/function_call.md:41 8569c9c13fd34caab163f4f9154e45bc
86
+ msgid "The LLM choose to or not to, or is forced to use one or many of the functions, in response to user queries."
87
+ msgstr "大型语言模型根据用户查询,选择使用或不使用,或被迫使用一个或多个函数。"
88
+
89
+ #: ../../source/framework/function_call.md:42 dac3cb931c3c4755b276886d5568340a
90
+ msgid "If the LLM chooses to use the functions, it states how the functions should be used based on the function instructions."
91
+ msgstr "如果大型语言模型选择使用这些函数,它会根据函数说明如何使用。"
92
+
93
+ #: ../../source/framework/function_call.md:43 a6439df6e0354e96b321fbfaa260dbd1
94
+ msgid "The chosen functions are used as such by the application and the results are obtained, which are then given to the LLM if further interaction is needed."
95
+ msgstr "应用程序按照选择使用这些函数,并获取结果。如果需要进一步互动,结果将提供给大型语言模型。"
96
+
97
+ #: ../../source/framework/function_call.md:45 8cef5c9125154720952742a4f51e19e2
98
+ msgid "There are many ways for LLMs to understand and follow this protocol. As always, the key is prompt engineering or an internalized template known by the model. We recommend using Hermes-style tool use for Qwen3 to maximize function calling performance."
99
+ msgstr "大型语言模型(LLMs)有许多方式来理解和遵循该协议。一如既往,关键在于提示工程或模型已内化的模板。我们建议对 Qwen3 使用 Hermes 风格的工具调用方法,以最大化函数调用性能。"
100
+
101
+ #: ../../source/framework/function_call.md:49 486bf0eaff5449f3966f948cf341570f
102
+ msgid "Inference with Function Calling"
103
+ msgstr "使用函数调用进行推理"
104
+
105
+ #: ../../source/framework/function_call.md:51 6d50be829cba4f43b587c494dc74a820
106
+ msgid "As function calling is essentially implemented using prompt engineering, you could manually construct the model inputs for Qwen3 models. However, frameworks with function calling support can help you with all that laborious work."
107
+ msgstr "由于函数调用本质上是通过提示工程实现的,您可以手动构建Qwen3模型的输入。但是,支持函数调用的框架可以帮助您完成所有繁重的工作。"
108
+
109
+ #: ../../source/framework/function_call.md:54 5afa6df4e2d94df89b26b66bce596264
110
+ msgid "In the following, we will introduce the usage (via dedicated function calling chat template) with"
111
+ msgstr "接下来,我们将介绍(通过专用的函数调用模板)使用"
112
+
113
+ #: ../../source/framework/function_call.md:55 380f90e66ba44ad686e981536dd29e12
114
+ msgid "**Qwen-Agent**,"
115
+ msgstr "**Qwen-Agent**,"
116
+
117
+ #: ../../source/framework/function_call.md:56 79b6f6475bc64a7bbe397ba0c94d43b1
118
+ msgid "**vLLM**."
119
+ msgstr "**vLLM**。"
120
+
121
+ #: ../../source/framework/function_call.md:58 30fff59c00c64a70821c167a944fd3f7
122
+ msgid "The Example Case"
123
+ msgstr "案例"
124
+
125
+ #: ../../source/framework/function_call.md:60 2b4cdb8daedd4da49877af5ecc67ba8b
126
+ msgid "Let's also use an example to demonstrate the inference usage. We assume **Python 3.11** is used as the programming language."
127
+ msgstr "我们同样通过一个示例来展示推理的使用方法。假设我们使用的编程语言是**Python 3.11**。"
128
+
129
+ #: ../../source/framework/function_call.md:63 ae5619a2a7ff41608d3420cd0caaba79
130
+ msgid "**Scenario**: Suppose we would like to ask the model about the temperature of a location. Normally, the model would reply that it cannot provide real-time information. But we have two tools that can be used to obtain the current temperature of and the temperature at a given date of a city respectively, and we would like the model to make use of them."
131
+ msgstr "**场景**:假设我们要询问模型某个地点的温度。通常��模型会回答无法提供实时信息。但我们有两个工具,可以分别获取城市的当前温度和指定日期的温度,我们希望模型能够利用这些工具。"
132
+
133
+ #: ../../source/framework/function_call.md:67 2617f66327e64038a5933bd825f099b8
134
+ msgid "To set up the example case, you can use the following code:"
135
+ msgstr "为了这个示例案例,您可以使用以下代码:"
136
+
137
+ #: ../../source/framework/function_call.md a419b632036846fdb90427683502c597
138
+ msgid "Preparation Code"
139
+ msgstr "准备代码"
140
+
141
+ #: ../../source/framework/function_call.md:173 77ce44e0fb3b43f6814da6a2ad36e511
142
+ msgid "In particular, the tools should be described using JSON Schema and the messages should contain as much available information as possible. You can find the explanations of the tools and messages below:"
143
+ msgstr "工具应使用JSON Schema进行描述,消息应包含尽可能多的有效信息。您可以在下面找到工具和消息的解释:"
144
+
145
+ #: ../../source/framework/function_call.md 48a8432a5d384a4ba10f39fcea96b825
146
+ msgid "Example Tools"
147
+ msgstr "示例工具"
148
+
149
+ #: ../../source/framework/function_call.md:178 f18d3697d6c347a2b407b21ae874f865
150
+ msgid "The tools should be described using the following JSON:"
151
+ msgstr "工具应使用以下JSON进行描述:"
152
+
153
+ #: ../../source/framework/function_call.md:242 6e55bd9040be4bc296ed948788780347
154
+ msgid "For each **tool**, it is a JSON object with two fields:"
155
+ msgstr "对于每个**工具**,它是一个具有两个字段的JSON object:"
156
+
157
+ #: ../../source/framework/function_call.md:243 ae43f666fcab4e5b93ff009688305fce
158
+ msgid "`type`: a string specifying the type of the tool, currently only `\"function\"` is valid"
159
+ msgstr "`type`:string,用于指定工具类型,目前仅`\"function\"`有效"
160
+
161
+ #: ../../source/framework/function_call.md:244 35cc77d63bf6455bb3376bec483b0f9b
162
+ msgid "`function`: an object detailing the instructions to use the function"
163
+ msgstr "`function`:object,详细说明了如何使用该函数"
164
+
165
+ #: ../../source/framework/function_call.md:246 b6f78c8fbb9b40d5a6c0c10e5273b85e
166
+ msgid "For each **function**, it is a JSON object with three fields:"
167
+ msgstr "对于每个**function**,它是一个具有三个字段的JSON object:"
168
+
169
+ #: ../../source/framework/function_call.md:247 0905c8ca11bb4454abb26ba42a3b29c3
170
+ msgid "`name`: a string indicating the name of the function"
171
+ msgstr "`name`:string 表示函数名称"
172
+
173
+ #: ../../source/framework/function_call.md:248 d787950be0144e0a83f18d7a06d43de0
174
+ msgid "`description`: a string describing what the function is used for"
175
+ msgstr "`description`:string 描述函数用途"
176
+
177
+ #: ../../source/framework/function_call.md:249 ba88a6e75ae8462d892a3ec3e9a6edaa
178
+ msgid "`parameters`: [a JSON Schema](https://json-schema.org/learn/getting-started-step-by-step) that specifies the parameters the function accepts. Please refer to the linked documentation for how to compose a JSON Schema. Notable fields include `type`, `required`, and `enum`."
179
+ msgstr "`parameters`:[JSON Schema](https://json-schema.org/learn/getting-started-step-by-step),用于指定函数接受的参数。请参阅链接文档以了解如何构建JSON Schema。值得注意的字段包括`type`、`required`和`enum`。"
180
+
181
+ #: ../../source/framework/function_call.md:251 abd8fe46919340a582f532932f9c1b52
182
+ msgid "Most frameworks use the tool format and some may use the function format. Which one to use should be obvious according to the naming."
183
+ msgstr "大多数框架使用“工具”格式,有些可能使用“函数”格式。根据命名,应该很明显应该使用哪一个。"
184
+
185
+ #: ../../source/framework/function_call.md 6c17006423714b9bb29379bd3674e1a0
186
+ msgid "Example Messages"
187
+ msgstr "示例消息"
188
+
189
+ #: ../../source/framework/function_call.md:258 1cd11a9c9f9b4f2ba308599a87f82613
190
+ msgid "Our query is `What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30.`."
191
+ msgstr ""
192
+
193
+ #: ../../source/framework/function_call.md:267 3f124f3c5ef54673bb6e12d8bd1bada3
194
+ msgid "Qwen-Agent"
195
+ msgstr ""
196
+
197
+ #: ../../source/framework/function_call.md:269 761ea5172da64e9d8911cc567d7e7779
198
+ msgid "[Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) is actually a Python Agent framework for developing AI applications. Although its intended use cases are higher-level than efficient inference, it does contain the **canonical implementation** of function calling for Qwen3. It provides the function calling ability for Qwen3 to an OpenAI-compatible API through templates that is transparent to users."
199
+ msgstr "[Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) 实际上是一个用于开发AI应用的Python智能体框架。尽管其设计用例比高效推理更高级,但它确实包含了Qwen3函数调用的**规范实现**。基于OpenAI兼容API,它可以通过模板为Qwen3提供了对用户透明的的函数调用能力。"
200
+
201
+ #: ../../source/framework/function_call.md:273 194c41677b7b4a6a81802980f4973988
202
+ msgid "It is worth noting that for reasoning models like Qwen3, it is *not recommended* to use tool call template based on stopwords, such as ReAct, because the model may output stopwords in the thought section, potentially leading to unexpected behavior in tool calls."
203
+ msgstr ""
204
+
205
+ #: ../../source/framework/function_call.md:275 02e0092b1db04537bb75bb8a9728b0c9
206
+ msgid "Before starting, let's make sure the latest library is installed:"
207
+ msgstr "在开始之前,让我们确保已安装了最新的库:"
208
+
209
+ #: ../../source/framework/function_call.md:280
210
+ #: ../../source/framework/function_call.md:450 8e49db2c62cc438193a1a385778c9908
211
+ msgid "Preparing"
212
+ msgstr "准备工作"
213
+
214
+ #: ../../source/framework/function_call.md:282 1181a68368ce484f9beec38d971108aa
215
+ msgid "Qwen-Agent can wrap an OpenAI-compatible API that does not support function calling. You can serve such an API with most inference frameworks or obtain one from cloud providers like DashScope or Together."
216
+ msgstr "Qwen-Agent可以封装一个不支持函数调用的OpenAI兼容API。您可以使用大多数推理框架来提供此类API,或者从DashScope或Together等云提供商处获取一个。"
217
+
218
+ #: ../../source/framework/function_call.md:285 d7708c50cf554212866c284d73a79c9e
219
+ msgid "Assuming there is an OpenAI-compatible API at `http://localhost:8000/v1`, Qwen-Agent provides a shortcut function `get_chat_model` to obtain a model inference class with function calling support:"
220
+ msgstr "假设在`http://localhost:8000/v1`处有一个OpenAI兼容API,Qwen-Agent提供了一个快捷函数`get_chat_model`,用于获取具有函数调用支持的模型推理类:"
221
+
222
+ #: ../../source/framework/function_call.md:302 e5676cec6583445888cf806ef54de829
223
+ msgid "In the above, `model_server` is the `api_base` common used in other OpenAI-compatible API clients. It is advised to provide the `api_key` (but not via plaintext in the code), even if the API server does not check it, in which case, you can set it to anything. You can pass model parameters to the model by `generate_cfg`. Here we demonstrate how to control the think and no_think modes of Qwen3. Different APIs may have different control methods."
224
+ msgstr "在上述代码中,`model_server` 是其他兼容 OpenAI 的 API 客户端常用的 `api_base`。建议提供 `api_key`(但不要以代码中的明文形式提供),即使 API 服务器不检查它,在这种情况下,您可以将其设置为任意值。您可以通过 `generate_cfg` 将模型参数传递给模型。在此我们演示如何控制 Qwen3 的思考与非思考模式。不同的 API 可能有不同的控制方法。"
225
+
226
+ #: ../../source/framework/function_call.md:307 42c1289baeef45b1a471e606bdafbe9a
227
+ msgid "For model inputs, the common message structure for system, user, and assistant history should be used:"
228
+ msgstr "对于模型输入,应使用系统、用户和助手历史记录的通用消息结构:"
229
+
230
+ #: ../../source/framework/function_call.md:313 64e0a941165d49299e80aa8270f10bfb
231
+ msgid "At the time, Qwen-Agent works with functions instead of tools. This requires a small change to our tool descriptions, that is, extracting the function fields:"
232
+ msgstr "目前,Qwen-Agent使用“函数”而非“工具”。这需要对我们工具描述进行一些小的更改,即提取函数字段:"
233
+
234
+ #: ../../source/framework/function_call.md:320
235
+ #: ../../source/framework/function_call.md:482 6babaeb87a48402086b0db01d6a0c5e2
236
+ msgid "Tool Calls and Tool Results"
237
+ msgstr "工具调用和工具结果"
238
+
239
+ #: ../../source/framework/function_call.md:322 53c98c106e2542f49d418348118717ea
240
+ msgid "To interact with the model, the `chat` method should be used:"
241
+ msgstr "为了与模型交互,应使用`chat`方法:"
242
+
243
+ #: ../../source/framework/function_call.md:333 a0e820c457e146298945b5df4cc918c5
244
+ msgid "The `chat` method returns a generator of list, each of which may contain multiple messages."
245
+ msgstr "`chat`方法返回一个列表的生成器,每个列表可能包含多条消息。"
246
+
247
+ #: ../../source/framework/function_call.md:336 4627b7f2ddd9427aa10a127ea5d0d2b4
248
+ msgid "The results of `no_think` mode:"
249
+ msgstr ""
250
+
251
+ #: ../../source/framework/function_call.md:344 bc34f89540c044d3809f29474f5cfe43
252
+ msgid "The results of `think` mode:"
253
+ msgstr ""
254
+
255
+ #: ../../source/framework/function_call.md:353 89732d0ca8ce4d93b666cdd51f8e126a
256
+ msgid "As we can see, Qwen-Agent attempts to parse the model generation in an easier to use structural format. The details related to function calls are placed in the `function_call` field of the messages:"
257
+ msgstr "我们可以看到,Qwen-Agent试图以更易于使用的结构化格式解析模型生成。与函数调用相关的详细信息被放置在消息的`function_call`字段中:"
258
+
259
+ #: ../../source/framework/function_call.md:355 d08d78b0219a4bbda4b6431e7f661eaa
260
+ msgid "`name`: a string representing the function to call"
261
+ msgstr "`name`:代表要调用的函数的字符串"
262
+
263
+ #: ../../source/framework/function_call.md:356 5a9245e840994576a89c28e4ce4f9378
264
+ msgid "`arguments`: a JSON-formatted string representing the arguments the function should be called with"
265
+ msgstr "`arguments`:表示函数应��有的参数的JSON格式字符串"
266
+
267
+ #: ../../source/framework/function_call.md:358 e108e1ea05564aac9a398e1093dab1ce
268
+ msgid "In the thinking mode, it will first generate a thought and then generate the tool call(s)."
269
+ msgstr ""
270
+
271
+ #: ../../source/framework/function_call.md:360 50cc88e82a004ab99199f46549f4aaa2
272
+ msgid "Then comes the critical part -- checking and applying the function call:"
273
+ msgstr "接下来是关键部分——检查和应用函数调用:"
274
+
275
+ #: ../../source/framework/function_call.md:376 6992f24f3f984594ac99e4267cd20144
276
+ msgid "To get tool results:"
277
+ msgstr "获取工具结果:"
278
+
279
+ #: ../../source/framework/function_call.md:377 23a3a2cbf74347948c6629be3d68be0f
280
+ msgid "line 1: We should iterate the function calls in the order the model generates them."
281
+ msgstr "第1行:我们应该按模型生成它们的顺序迭代函数调用。"
282
+
283
+ #: ../../source/framework/function_call.md:378 762ba5a6310248dc886921fa542aa667
284
+ msgid "line 2: We can check if a function call is needed as deemed by the model by checking the `function_call` field of the generated messages."
285
+ msgstr "第2行:通过检查生成消息的`function_call`字段,我们可以查看是否需要按模型判断进行函数调用。"
286
+
287
+ #: ../../source/framework/function_call.md:379 bfbb86b6b1b24ca598e6402043417cbf
288
+ msgid "line 3-4: The related details including the name and the arguments of the function can also be found there, which are `name` and `arguments` respectively."
289
+ msgstr "第3-4行:相关详情,包括函数名称和参数,也可以在那里找到,分别是`name`和`arguments`。"
290
+
291
+ #: ../../source/framework/function_call.md:380 7d108413597041c48363681e79da9813
292
+ msgid "line 6: With the details, one should call the function and obtain the results. Here, we assume there is a function named [`get_function_by_name`](#prepcode) to help us get the related function by its name."
293
+ msgstr "第6行:有了这些细节,应该调用函数并获取结果。这里,我们假设有一个名为[`get_function_by_name`](#prepcode)的函数来帮助我们根据名称获取相关函数。"
294
+
295
+ #: ../../source/framework/function_call.md:382 237839b4eb4048f6b22ab8d9c94f20c4
296
+ msgid "line 8-12: With the result obtained, add the function result to the messages as `content` and with `role` as `\"function\"`."
297
+ msgstr "第8-12行:获得结果后,将函数结果作为`content`添加到消息中,并将`role`设置为`\"function\"`。"
298
+
299
+ #: ../../source/framework/function_call.md:384 556c8b3b12544c5ab2fb8e5d2b7a818c
300
+ #, fuzzy
301
+ msgid "Now the messages are:"
302
+ msgstr "现在消息是"
303
+
304
+ #: ../../source/framework/function_call.md:386
305
+ #: ../../source/framework/function_call.md:421 dce3c134764b4690b2b0b37e36a9dbcb
306
+ #: edd9cf9e63af4a869eb3e7bb07c88328
307
+ msgid "`no_think` mode:"
308
+ msgstr ""
309
+
310
+ #: ../../source/framework/function_call.md:397
311
+ #: ../../source/framework/function_call.md:428 2f611a03bd624b2db666fb07fa8f658d
312
+ #: c18021fb05d5485ebe2e1afa6371ef65
313
+ msgid "`think` mode:"
314
+ msgstr ""
315
+
316
+ #: ../../source/framework/function_call.md:409
317
+ #: ../../source/framework/function_call.md:570 a5f394f05e9a4f80958a16e43ed31e7d
318
+ msgid "Final Response"
319
+ msgstr "最终响应"
320
+
321
+ #: ../../source/framework/function_call.md:411 215d04b89c1749f99831d4baa72f678d
322
+ msgid "Finally, run the model again to get the final model results:"
323
+ msgstr "最后,再次运行模型以获取最终的模型结果:"
324
+
325
+ #: ../../source/framework/function_call.md:419 823711ca9c364335948f2e994740417e
326
+ msgid "The final response should be like"
327
+ msgstr "最终响应应如下所示"
328
+
329
+ #: ../../source/framework/function_call.md:438 a5f84b2e746e4669bd836f43afaf16a2
330
+ msgid "vLLM"
331
+ msgstr ""
332
+
333
+ #: ../../source/framework/function_call.md:440 4d64c942ff674ba88a9753c25635374d
334
+ msgid "vLLM is a fast and easy-to-use library for LLM inference and serving. It uses the tokenizer from `transformers` to format the input, so we should have no trouble preparing the input. In addition, vLLm also implements helper functions so that generated tool calls can be parsed automatically if the format is supported."
335
+ msgstr "vLLM 是一个快速且易于使用的库,用于大型语言模型的推理和部署。它使用 `transformers` 中的分词器来格式化输入,因此我们在准备输入时应该不会遇到任何问题。此外,vLLM 还实现了辅助函数,以便在支持的情况下自动解析生成的工具调用。"
336
+
337
+ #: ../../source/framework/function_call.md:444 f65e19e7888c4d9ea42f4c82ca89b496
338
+ msgid "`vllm` >= v0.8.5."
339
+ msgstr ""
340
+
341
+ #: ../../source/framework/function_call.md:446 6df4774659a84791b0dff63ed1b211c1
342
+ msgid "For more information, check the [vLLM documentation](https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#tool-calling-in-the-chat-completion-api)."
343
+ msgstr "更多信息,请查阅 [vLLM 文档](https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#tool-calling-in-the-chat-completion-api)"
344
+
345
+ #: ../../source/framework/function_call.md:448 c134b90394c941d49115838d2280a343
346
+ msgid "We will use the OpenAI-Compatible API by `vllm` with the API client from the `openai` Python library."
347
+ msgstr "在本指南中,我们将使用 `vllm` 提供的 OpenAI 兼容 API,并通过 `openai` Python 库的 API 客户端来进行操作。"
348
+
349
+ #: ../../source/framework/function_call.md:452 401f8cd3cf204f459a7f7c42e7dc43e7
350
+ msgid "For Qwen3, the chat template in tokenizer_config.json has already included support for the Hermes-style tool use. We simply need to start a OpenAI-compatible API with vLLM:"
351
+ msgstr "对于 Qwen3,`tokenizer_config.json` 中的聊天模板已经包含了对 Hermes 风格工具调用的支持。我们只需要启动一个由 vLLM 提供的 OpenAI 兼容 API 即可:"
352
+
353
+ #: ../../source/framework/function_call.md:459 e27b0ff05a97431dbaa2a18d4e5b6ab5
354
+ msgid "The inputs are the same with those in [the preparation code](#prepcode):"
355
+ msgstr "输入与[准备代码](#prepcode)中的相同:"
356
+
357
+ #: ../../source/framework/function_call.md:466 bac07622ec554e9ba4090940724d8d21
358
+ msgid "Let's also initialize the client:"
359
+ msgstr "我们先初始化API客户端:"
360
+
361
+ #: ../../source/framework/function_call.md:484 46d45caf4eab44c69ad519d82e84818c
362
+ msgid "We can use the create chat completions endpoint to query the model. Here is an example of the `no_think` mode:"
363
+ msgstr "我们可以使用create chat completions endpoint直接查询底层API。以下是使用非思考模式的例子:"
364
+
365
+ #: ../../source/framework/function_call.md:502 4198241de2fb4e4ba5433b0c579734e1
366
+ msgid "vLLM should be able to parse the tool calls for us, and the main fields in the response (`response.choices[0]`) should be like"
367
+ msgstr "vLLM应当可以为我们解析工具调用,回复的主要字段(`response.choices[0]`)应如下所示:"
368
+
369
+ #: ../../source/framework/function_call.md:529 050ffcaa034f4cd7b1405ab5a561b969
370
+ msgid "Note that the function arguments are JSON-formatted strings, which Qwen-Agent follows."
371
+ msgstr "请注意这里函数的参数是JSON格式字符串,Qwen-Agent与其一致。"
372
+
373
+ #: ../../source/framework/function_call.md:531 e3012b896829473cb0e1802047f5819e
374
+ msgid "As before, chances are that there are corner cases where tool calls are generated but they are malformed and cannot be parsed. For production code, we should try parsing by ourselves."
375
+ msgstr "如前所述,有可能存在边界情况,模型生成了工具调用但格式不良也无法被解析。对于生产代码,我们需要尝试自行解析。"
376
+
377
+ #: ../../source/framework/function_call.md:534 de4fb4d7f1b342e0849b049e81fb8585
378
+ msgid "Then, we can obtain the tool results and add them to the messages as shown below:"
379
+ msgstr "随后,我们可以调用工具并获得结果,然后将它们加入消息中:"
380
+
381
+ #: ../../source/framework/function_call.md:555 e5e63bf3a7e34d0683d244549cbbbce1
382
+ msgid "It should be noted that the OpenAI API uses `tool_call_id` to identify the relation between tool results and tool calls."
383
+ msgstr "这里需要注意OpenAI API使用`tool_call_id`字段来识别工具结果和工具调用间的联系。"
384
+
385
+ #: ../../source/framework/function_call.md:557 deda1dccce204294ba69c74f24e4588f
386
+ msgid "The messages are now like"
387
+ msgstr "现在消息如下:"
388
+
389
+ #: ../../source/framework/function_call.md:572 2dd5c4ae2dd84633809c8365c10fdaa8
390
+ msgid "Let's call the endpoint again to seed the tool results and get response:"
391
+ msgstr "让我们再次查询接口,以给模型提供工具结果并获得回复:"
392
+
393
+ #: ../../source/framework/function_call.md:589 15f3ce61d4044fb1a06f75bdeb8140b2
394
+ msgid "The final response (`response.choices[0].message.content`) should be like"
395
+ msgstr "最终响应 (`response.choices[0].message.content`)应如"
396
+
397
+ #: ../../source/framework/function_call.md:595 1e8b7940bbbc46a8bbafb59afb086819
398
+ msgid "Finally"
399
+ msgstr "最后"
400
+
401
+ #: ../../source/framework/function_call.md:597 b588a910fcef435183d4d476851c10fb
402
+ msgid "In whichever way you choose to use function calling with Qwen3, keep in mind that the limitation and the perks of prompt engineering applies:"
403
+ msgstr "无论你选择哪种方式在Qwen3中使用函数调用,请记住提示工程的限制和优势适用:"
404
+
405
+ #: ../../source/framework/function_call.md:598 feaec442d07c4d3fa7e20d3dd9724db1
406
+ msgid "It is not guaranteed that the model generation will always follow the protocol even with proper prompting or templates. Especially, for the templates that are more complex and relies more on the model itself to think and stay on track than the ones that are simpler and relies on the template and the use of control or special tokens. The latter one, of course, requires some kind of training. In production code, be prepared that if it breaks, countermeasures or rectifications are in place."
407
+ msgstr "无法保证模型生成将始终遵循协议,即使有适当的提示或模板。特别是对于那些更复杂且更多依赖于模型本身思考和保持方向的模板,而非那些更简单且依赖于模板以及控制或特殊标记使用的模板。当然,后者需要某种训练。在生产代码中,要准备好如果出现问题,采取补救措施或修正措��。"
408
+
409
+ #: ../../source/framework/function_call.md:602 d86a7ee6f6f64e40bea8bdb0991f3361
410
+ msgid "If in certain scenarios, the generation is not up to expectation, you can refine the template to add more instructions or constraints. While the templates mentioned here are general enough, they may not be the best or the most specific or the most concise for your use cases. The ultimate solution is fine-tuning using your own data."
411
+ msgstr "如果在某些场景下,生成结果未达到预期,你可以细化模板以添加更多指令或约束。尽管这里提到的模板足够通用,但对于你的具体使用案例,它们可能不是最佳的、最具体的或最简洁的。最终解决方案是使用你自己的数据进行微调。"
412
+
413
+ #: ../../source/framework/function_call.md:606 e09bd8deef0e413698e55cc1dfbc3283
414
+ msgid "Have fun prompting!"
415
+ msgstr "享受提示的乐趣吧!"
docs/locales/zh_CN/LC_MESSAGES/framework/qwen_agent.po ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-05-16 18:57+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
+
21
+ #: ../../source/framework/qwen_agent.rst:2 74719c4bae294c5ea93e9f8542cef14c
22
+ msgid "Qwen-Agent"
23
+ msgstr "Qwen-Agent"
24
+
25
+ #: ../../source/framework/qwen_agent.rst:4 2a3d08cd70a34436bf5d9e1617a4d392
26
+ msgid "`Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ is a framework for developing LLM applications based on the instruction following, tool usage, planning, and memory capabilities of Qwen."
27
+ msgstr "`Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ 是一个基于 Qwen 的指令跟随、工具使用、计划和记忆能力来开发 LLM 应用程序的框架。"
28
+
29
+ #: ../../source/framework/qwen_agent.rst:8 ada0e9f26c6748768f66c1c62e4b6d75
30
+ msgid "This is a simple tutorial on using Qwen-Agent to quickly experience the agentic capabilities of Qwen3. For more detailed information, please refer to `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ repository."
31
+ msgstr "本教程展示基于 Qwen-Agent 快速体验 Qwen3 智能体能力的流程。更多信息请参考 `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ 仓库。"
32
+
33
+ #: ../../source/framework/qwen_agent.rst:14 b0997eeb63844471b1637075add23cb0
34
+ msgid "Installation"
35
+ msgstr "安装"
36
+
37
+ #: ../../source/framework/qwen_agent.rst:16 b6ba4e319cd24dee88d5cdbde60b096b
38
+ msgid "Install the stable version from PyPI:"
39
+ msgstr "从 PyPI 安装 Qwen-Agent 的稳定版本:"
40
+
41
+ #: ../../source/framework/qwen_agent.rst:29 3f5ac104f7a647b99b1146d72fdda96d
42
+ msgid "Developing Your Own Agent"
43
+ msgstr "开发您自己的智能体"
44
+
45
+ #: ../../source/framework/qwen_agent.rst:31 e85c4ea6d3d9406da3823cb4f188ffc4
46
+ msgid "Qwen3 excels in tool calling capabilities. Qwen-Agent encapsulates tool-calling templates and tool-calling parsers internally, greatly reducing coding complexity."
47
+ msgstr "Qwen3 在工具调用能力方面表现出色。Qwen-Agent 内部封装了工具调用模板和工具调用解析器,大大降低了编码复杂性。"
48
+
49
+ #: ../../source/framework/qwen_agent.rst:35 d63624897ee340fb8d31eeea6a02e995
50
+ msgid "To define the available tools, you can use the MCP configuration file, use the integrated tool of Qwen-Agent, or integrate other tools by yourself."
51
+ msgstr "要定义可用的工具,您可以使用 MCP 配置文件,使用 Qwen-Agent 的集成工具,或者自行集成其他工具。"
52
+
53
+ #: ../../source/framework/qwen_agent.rst:112 ada0e9f26c6748768f66c1c62e4b6d75
54
+ msgid "For more detailed examples and MCP cookbooks, please refer to `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ repository."
55
+ msgstr "有关更详细的示例和 MCP 使用指南,请参阅 `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ 仓库。"
56
+
57
+ #~ msgid "To be updated for Qwen3."
58
+ #~ msgstr "仍需为Qwen3更新。"
59
+
60
+ #~ msgid "Qwen-Agent provides atomic components such as LLMs and prompts, as well as high-level components such as Agents. The example below uses the Assistant component as an illustration, demonstrating how to add custom tools and quickly develop an agent that uses tools."
61
+ #~ msgstr "Qwen-Agent 提供包括语言模型和提示词等原子级组件,及智能体等高级组件在内的多种组件。以下示例选取助理组件进行展示,阐述了如何整合自定义工具以及如何迅速开发出一个能够应用这些工具的代理程序。"
62
+
63
+ #~ msgid "The framework also provides more atomic components for developers to combine. For additional showcases, please refer to `examples <https://github.com/QwenLM/Qwen-Agent/tree/main/examples>`__."
64
+ #~ msgstr "该框架还为开发者提供了更多的原子组件以供组合使用。欲了解更多示例,请参见 `examples <https://github.com/QwenLM/Qwen-Agent/tree/main/examples>`__。"
65
+
66
+ #~ msgid "This is the simplest tutorial on using Qwen-Agent to quickly experience the agentic capabilities of Qwen3. For more detailed information, please refer to `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ repository."
67
+ #~ msgstr ""
68
+
docs/locales/zh_CN/LC_MESSAGES/getting_started/concepts.po ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.17.0\n"
21
+
22
+ #: ../../Qwen/source/getting_started/concepts.md:1
23
+ #: 581ec8a4d8dd4b5a99caf167b796a6e9
24
+ msgid "Key Concepts"
25
+ msgstr "核心概念"
26
+
27
+ #: ../../Qwen/source/getting_started/concepts.md:4
28
+ #: fc803dd8f02a4caf9be29e42364659a0
29
+ msgid "To be updated for Qwen3."
30
+ msgstr "仍需为Qwen3更新。"
31
+
32
+ #: ../../Qwen/source/getting_started/concepts.md:7
33
+ #: 834244ff25a040fe91f63682732dd416
34
+ msgid "Qwen"
35
+ msgstr "通义千问 (Qwen)"
36
+
37
+ #: ../../Qwen/source/getting_started/concepts.md:9
38
+ #: ee9dee3630614908860b2144007186fd
39
+ msgid "Qwen (Chinese: 通义千问; pinyin: _Tongyi Qianwen_) is the large language model and large multimodal model series of the Qwen Team, Alibaba Group. Qwen is capable of natural language understanding, text generation, vision understanding, audio understanding, tool use, role play, playing as AI agent, etc. Both language models and multimodal models are pre-trained on large-scale multilingual and multimodal data and post-trained on quality data for aligning to human preferences."
40
+ msgstr "通义千问(英文: Qwen ;读作: _kùn_)是由阿里巴巴通义千问团队开发的大规模语言和多模态系列模型。通义千问可以执行自然语言理解、文本生成、视觉理解、音频理解、工具调用、角色扮演、智能体等多种任务。语言和多模态模型均在大规模、多语言、多模态数据上进行预训练,并在高质量语料上后训练以与人类偏好对齐。"
41
+
42
+ #: ../../Qwen/source/getting_started/concepts.md:13
43
+ #: 6a37d9a0b6e2414a9b7ede0e095476af
44
+ msgid "There is the proprietary version and the open-weight version."
45
+ msgstr ""
46
+
47
+ #: ../../Qwen/source/getting_started/concepts.md:15
48
+ #: 4fba11f4661b4e469f88dc3917b27427
49
+ msgid "The proprietary versions include"
50
+ msgstr ""
51
+
52
+ #: ../../Qwen/source/getting_started/concepts.md:16
53
+ #: ../../Qwen/source/getting_started/concepts.md:31
54
+ #: be8423cea0b447c2b15de596c120f541 d07679ae34d0463f96aeff896a759118
55
+ msgid "Qwen: the language models"
56
+ msgstr "通义千问 (Qwen):语言模型"
57
+
58
+ #: ../../Qwen/source/getting_started/concepts.md:17
59
+ #: a1461ec445034ba099aa58b1a13375a0
60
+ #, fuzzy
61
+ msgid "Qwen Max"
62
+ msgstr "通义千问 (Qwen)"
63
+
64
+ #: ../../Qwen/source/getting_started/concepts.md:18
65
+ #: 19f8d7108d69464a8d1ce2980c1e4e92
66
+ #, fuzzy
67
+ msgid "Qwen Plus"
68
+ msgstr "通义千问 (Qwen)"
69
+
70
+ #: ../../Qwen/source/getting_started/concepts.md:19
71
+ #: ede369bc8dd24052ad674131f4a3b68a
72
+ msgid "Qwen Turbo"
73
+ msgstr ""
74
+
75
+ #: ../../Qwen/source/getting_started/concepts.md:20
76
+ #: ../../Qwen/source/getting_started/concepts.md:36
77
+ #: ddb0acdec40b4f79a3e6517f86727e4b e4df2227d36a46ee8644ce77f9fc1dc0
78
+ msgid "Qwen-VL: the vision-language models"
79
+ msgstr "通义千问 VL (Qwen-VL): 视觉语言模型"
80
+
81
+ #: ../../Qwen/source/getting_started/concepts.md:21
82
+ #: f9f5a5b50af44e90999a87661cdf4e5a
83
+ msgid "Qwen-VL Max"
84
+ msgstr ""
85
+
86
+ #: ../../Qwen/source/getting_started/concepts.md:22
87
+ #: fd0074955211498c8520ef3405bf312f
88
+ msgid "Qwen-VL Plus"
89
+ msgstr ""
90
+
91
+ #: ../../Qwen/source/getting_started/concepts.md:23
92
+ #: 40c8d32d570c4a76a5392c8e296c3793
93
+ msgid "Qwen-VL OCR"
94
+ msgstr ""
95
+
96
+ #: ../../Qwen/source/getting_started/concepts.md:24
97
+ #: ../../Qwen/source/getting_started/concepts.md:39
98
+ #: c0e45bd6e6b44ac7b18ef6a511c0999e f84666b662ab4d5ea41766d46f34fbc0
99
+ msgid "Qwen-Audio: the audio-language models"
100
+ msgstr "通义千问 Audio: 音频语言模型"
101
+
102
+ #: ../../Qwen/source/getting_started/concepts.md:25
103
+ #: 0584dbb5e76949ea965661c535e982d7
104
+ msgid "Qwen-Audio Turbo"
105
+ msgstr ""
106
+
107
+ #: ../../Qwen/source/getting_started/concepts.md:26
108
+ #: aa78dd31bce94f6db05be93976278455
109
+ msgid "Qwen-Audio ASR"
110
+ msgstr ""
111
+
112
+ #: ../../Qwen/source/getting_started/concepts.md:28
113
+ #: df255434cec04d12b8e2d048d4e5baf8
114
+ msgid "You can learn more about them at Alibaba Cloud Model Studio ([China Site](https://help.aliyun.com/zh/model-studio/getting-started/models#9f8890ce29g5u) \\[zh\\], [International Site](https://www.alibabacloud.com/en/product/modelstudio))."
115
+ msgstr ""
116
+
117
+ #: ../../Qwen/source/getting_started/concepts.md:30
118
+ #: bc0fbc68d29b49da90efba3358f5013f
119
+ msgid "The spectrum for the open-weight models spans over"
120
+ msgstr "开源模型包括:"
121
+
122
+ #: ../../Qwen/source/getting_started/concepts.md:32
123
+ #: e3107d97ea1b4e0284c2a33c0da02813
124
+ msgid "[Qwen](https://github.com/QwenLM/Qwen): 1.8B, 7B, 14B, and 72B models"
125
+ msgstr "[Qwen](https://github.com/QwenLM/Qwen): 1.8B、 7B、 14B 及 72B 模型"
126
+
127
+ #: ../../Qwen/source/getting_started/concepts.md:33
128
+ #: 8918b660d015430a8d14c3c62b87b19d
129
+ msgid "[Qwen1.5](https://github.com/QwenLM/Qwen1.5/tree/v1.5): 0.5B, 1.8B, 4B, 14BA2.7B, 7B, 14B, 32B, 72B, and 110B models"
130
+ msgstr "[Qwen1.5](https://github.com/QwenLM/Qwen1.5/tree/v1.5): 0.5B、 1.8B、 4B、 14BA2.7B、 7B、 14B、 32B、 72B 及 110B 模型"
131
+
132
+ #: ../../Qwen/source/getting_started/concepts.md:34
133
+ #: c5ad94aa9d524a7290d9d0ec35321641
134
+ msgid "[Qwen2](https://github.com/QwenLM/Qwen2/tree/v2.0): 0.5B, 1.5B, 7B, 57A14B, and 72B models"
135
+ msgstr "[Qwen2](https://github.com/QwenLM/Qwen2/tree/v2.0): 0.5B、 1.5B、 7B、 57A14B 及 72B 模型"
136
+
137
+ #: ../../Qwen/source/getting_started/concepts.md:35
138
+ #: 5c38bd713ca847b4bb552971cdd75a99
139
+ msgid "[Qwen2.5](https://github.com/QwenLM/Qwen2.5/): 0.5B, 1.5B, 3B, 7B, 14B, 32B, and 72B models"
140
+ msgstr "[Qwen2.5](https://github.com/QwenLM/Qwen2.5/): 0.5B、 1.5B、 3B、 7B、 14B、 32B 及 72B 模型"
141
+
142
+ #: ../../Qwen/source/getting_started/concepts.md:37
143
+ #: aa36bbcafdf742a9addd2a7b32705a02
144
+ msgid "[Qwen-VL](https://github.com/QwenLM/Qwen-VL): 7B-based models"
145
+ msgstr "[Qwen-VL](https://github.com/QwenLM/Qwen-VL): 基于 7B 的模型"
146
+
147
+ #: ../../Qwen/source/getting_started/concepts.md:38
148
+ #: 9d1d663950d34fefbfc7df37fa1def7a
149
+ msgid "[Qwen2-VL](https://github.com/QwenLM/Qwen2-VL): 2B, 7B, and 72B-based models"
150
+ msgstr "[Qwen-VL](https://github.com/QwenLM/Qwen2-VL): 基于 2B 、 7B 和 72B 的模型"
151
+
152
+ #: ../../Qwen/source/getting_started/concepts.md:40
153
+ #: bb8a3431ea1f4cc99b4b8dd78e55d9ad
154
+ msgid "[Qwen-Audio](https://github.com/QwenLM/Qwen-Audio): 7B-based model"
155
+ msgstr "[Qwen-Audio](https://github.com/QwenLM/Qwen-Audio): 基于 7B 的模型"
156
+
157
+ #: ../../Qwen/source/getting_started/concepts.md:41
158
+ #: 2421a5d0f547440bbf0211274bf44d5d
159
+ msgid "[Qwen2-Audio](https://github.com/QwenLM/Qwen2-Audio): 7B-based models"
160
+ msgstr "[Qwen2-Audio](https://github.com/QwenLM/Qwen2-Audio): 基于 7B 的模型"
161
+
162
+ #: ../../Qwen/source/getting_started/concepts.md:42
163
+ #: df8610d7dfbf4651a955dc909b727061
164
+ #, fuzzy
165
+ msgid "Q*Q: the reasoning models"
166
+ msgstr "通义千问 (Qwen):语言模型"
167
+
168
+ #: ../../Qwen/source/getting_started/concepts.md:43
169
+ #: 67e209da7f5848adab885598a9069f11
170
+ #, fuzzy
171
+ msgid "[QwQ-Preview](https://github.com/QwenLM/Qwen2.5/): 32B LLM"
172
+ msgstr "[Qwen2.5-Coder](https://github.com/QwenLM/Qwen2.5-Coder): 7B 模型"
173
+
174
+ #: ../../Qwen/source/getting_started/concepts.md:44
175
+ #: 4e9ad66b735a4109ab8ec727486c463c
176
+ #, fuzzy
177
+ msgid "[QVQ-Preview](https://github.com/QwenLM/Qwen2-VL): 72B VLM"
178
+ msgstr "[Qwen-VL](https://github.com/QwenLM/Qwen-VL): 基于 7B 的模型"
179
+
180
+ #: ../../Qwen/source/getting_started/concepts.md:45
181
+ #: 728cd9f1dc9d4502ad9a3702e802fc2e
182
+ msgid "CodeQwen/Qwen-Coder: the language models for coding"
183
+ msgstr "Code通义千问 / 通义千问Coder:代码语言模型"
184
+
185
+ #: ../../Qwen/source/getting_started/concepts.md:46
186
+ #: 133fd513d7084b54bfe910fda13a42ec
187
+ msgid "[CodeQwen1.5](https://github.com/QwenLM/CodeQwen1.5): 7B models"
188
+ msgstr "[CodeQwen1.5](https://github.com/QwenLM/CodeQwen1.5): 7B 模型"
189
+
190
+ #: ../../Qwen/source/getting_started/concepts.md:47
191
+ #: a903957acc0d458b8200788144be0b4d
192
+ #, fuzzy
193
+ msgid "[Qwen2.5-Coder](https://github.com/QwenLM/Qwen2.5-Coder): 0.5B, 1.5B, 3B, 7B, 14B, and 32B models"
194
+ msgstr "[Qwen2.5](https://github.com/QwenLM/Qwen2.5/): 0.5B、 1.5B、 3B、 7B、 14B、 32B 及 72B 模型"
195
+
196
+ #: ../../Qwen/source/getting_started/concepts.md:48
197
+ #: 6c47a9310a6945719b35da4bff3e0c9e
198
+ msgid "Qwen-Math: the language models for mathematics"
199
+ msgstr "通义千问 Math:数学语言模型"
200
+
201
+ #: ../../Qwen/source/getting_started/concepts.md:49
202
+ #: fadbf7de806d4f288fc4355b52bcc060
203
+ msgid "[Qwen2-Math](https://github.com/QwenLM/Qwen2-Math): 1.5B, 7B, and 72B models"
204
+ msgstr "[Qwen2-Math](https://github.com/QwenLM/Qwen2-Math): 1.5B、 7B 及 72B 模型"
205
+
206
+ #: ../../Qwen/source/getting_started/concepts.md:50
207
+ #: 0066352e253345288d16bb1a8df40e1c
208
+ msgid "[Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math): 1.5B, 7B, and 72B models"
209
+ msgstr "[Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math): 1.5B、 7B 及 72B 模型"
210
+
211
+ #: ../../Qwen/source/getting_started/concepts.md:51
212
+ #: b45ed6f1601c41f8a33f6b2b6ff8b47b
213
+ #, fuzzy
214
+ msgid "Qwen-Math-RM: the reward models for mathematics"
215
+ msgstr "通义千问 Math:数学语言模型"
216
+
217
+ #: ../../Qwen/source/getting_started/concepts.md:52
218
+ #: 286e8dd455ef4bab91821d399dd4a582
219
+ #, fuzzy
220
+ msgid "[Qwen2-Math-RM](https://github.com/QwenLM/Qwen2-Math): 72B models"
221
+ msgstr "[Qwen2-Math](https://github.com/QwenLM/Qwen2-Math): 1.5B、 7B 及 72B 模型"
222
+
223
+ #: ../../Qwen/source/getting_started/concepts.md:53
224
+ #: 81eb8401de1646309924a74e633b9b45
225
+ #, fuzzy
226
+ msgid "[Qwen2.5-Math-RM](https://github.com/QwenLM/Qwen2.5-Math): 72B models"
227
+ msgstr "[Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math): 1.5B、 7B 及 72B 模型"
228
+
229
+ #: ../../Qwen/source/getting_started/concepts.md:54
230
+ #: e0cd026299ba4809a86504afbe2dd8d5
231
+ #, fuzzy
232
+ msgid "[Qwen2.5-Math-PRM](https://github.com/QwenLM/Qwen2.5-Math): 7B and 72B models"
233
+ msgstr "[Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math): 1.5B、 7B 及 72B 模型"
234
+
235
+ #: ../../Qwen/source/getting_started/concepts.md:56
236
+ #: acec8c22ff094ebe8295cad38ec7a8db
237
+ msgid "**In this document, our focus is Qwen, the language models.**"
238
+ msgstr "**本文档针对通义千问 (Qwen) 语言模型。**"
239
+
240
+ #: ../../Qwen/source/getting_started/concepts.md:58
241
+ #: e1e6ade4e85b4975bf992ed0a9c99140
242
+ msgid "Causal Language Models"
243
+ msgstr "因果语言模型 (Causal Language Models)"
244
+
245
+ #: ../../Qwen/source/getting_started/concepts.md:60
246
+ #: 593921d01e7a41caa52eda69db81c908
247
+ msgid "Causal language models, also known as autoregressive language models or decoder-only language models, are a type of machine learning model designed to predict the next token in a sequence based on the preceding tokens. In other words, they generate text one token at a time, using the previously generated tokens as context. The \"causal\" aspect refers to the fact that the model only considers the past context (the already generated tokens) when predicting the next token, not any future tokens."
248
+ msgstr "因果语言模型 (causal Language Models),也被称为自回归语言模型 (autoregressive language models) 或仅解码器语言模型 (decoder-only language models) ,是一种机器学习模型,旨在根据序列中的前导 token 预测下一个 token 。换句话说,它使用之前生成的 token 作为上下文,一次生成一个 token 的文本。\"因果\"方面指的是模型在预测下一个 token 时只考虑过去的上下文(即已生成的 token ),而不考虑任何未来的 token 。"
249
+
250
+ #: ../../Qwen/source/getting_started/concepts.md:64
251
+ #: 4b31da2c06c54107857edcb2764e0019
252
+ msgid "Causal language models are widely used for various natural language processing tasks involving text completion and generation. They have been particularly successful in generating coherent and contextually relevant text, making them a cornerstone of modern natural language understanding and generation systems."
253
+ msgstr "因果语言模型被广泛用于涉及文本补全和生成的各种自然语言处理任务。它们在生成连贯且具有上下文关联性的文本方面尤其成功,这使得它们成为现代自然语言理解和生成系统的基础。"
254
+
255
+ #: ../../Qwen/source/getting_started/concepts.md:67
256
+ #: 98f73b1f049641038ec1b310a219b209
257
+ msgid "**Takeaway: Qwen models are causal language models suitable for text completion.**"
258
+ msgstr "**要点:Qwen 模型是适用于文本补全的因果语言模型。**"
259
+
260
+ #: ../../Qwen/source/getting_started/concepts.md
261
+ #: 2f5c19be905046e1ae669119e3bb6e7c
262
+ msgid "Learn more about language models"
263
+ msgstr "了解更多关于语言模型的信息"
264
+
265
+ #: ../../Qwen/source/getting_started/concepts.md:71
266
+ #: 557d7c8bafb94a34b76b6d96a3ce46ff
267
+ msgid "They are three main kinds of models that are commonly referred to as language models in deep learning:"
268
+ msgstr "在深度学习中,被称为语言模型的主要有三类:"
269
+
270
+ #: ../../Qwen/source/getting_started/concepts.md:72
271
+ #: 89ef0f95d0f5492f877ddceb0233d2fc
272
+ msgid "Sequence-to-sequence models: T5 and the likes"
273
+ msgstr "序列到序列模型 (sequence-to-sequence models):T5及其类似模型"
274
+
275
+ #: ../../Qwen/source/getting_started/concepts.md:74
276
+ #: 80f14b7e5beb41d7920772b053681e24
277
+ msgid "Sequence-to-sequence models use both an encoder to capture the entire input sequence and a decoder to generate an output sequence. They are widely used for tasks like machine translation, text summarization, etc."
278
+ msgstr "序列到序列模型同时使用编码器来捕获整个输入序列,以及解码器来生成输出序列。它们广泛应用于诸如机器翻译、文本摘要等任务。"
279
+
280
+ #: ../../Qwen/source/getting_started/concepts.md:77
281
+ #: 0b15c87feae5409f80999e86ad5f5942
282
+ msgid "Bidirectional models or encoder-only models: BERT and the likes"
283
+ msgstr "双向模型 (bidirectional models) 或仅编码器模型 (encoder-only models) :BERT及其类似模型"
284
+
285
+ #: ../../Qwen/source/getting_started/concepts.md:79
286
+ #: 7439fe506ee64fbfaba86bb409cb76ca
287
+ msgid "Bidirectional models can access both past and future context in a sequence during training. They cannot generate sequential outputs in real-time due to the need for future context. They are widely used as embedding models and subsequently used for text classification."
288
+ msgstr "双向模型在训练期间可以访问序列中的过去和未来上下文。由于需要未来上下文,它们无法实时生成顺序输出。它们广泛用作嵌入模型,并随后用于文本分类。"
289
+
290
+ #: ../../Qwen/source/getting_started/concepts.md:83
291
+ #: c7f7ae809802445bbaafc7d7f783c71a
292
+ msgid "Casual language models or decoder-only models: GPT and the likes"
293
+ msgstr "因果语言模型 (casual language models) 或仅解码器模型 (decoder-only models) :GPT及其类似模型"
294
+
295
+ #: ../../Qwen/source/getting_started/concepts.md:85
296
+ #: b2825bdbf41c485c849444fc734fde43
297
+ msgid "Causal language models operate unidirectionally in a strictly forward direction, predicting each subsequent word based only on the previous words in the sequence. This unidirectional nature ensures that the model's predictions do not rely on future context, making them suitable for tasks like text completion and generation."
298
+ msgstr "因果语言模型以严格向前的单向方式运行,仅根据序列中的前导词汇预测每个后续词汇。这种单向性确保了模型的预测不依赖于未来上下文,使它们适合于文本补全和生成等任务。"
299
+
300
+ #: ../../Qwen/source/getting_started/concepts.md:89
301
+ #: 26bfa80a4e224b9ca3494f83fc37b0b6
302
+ msgid "Pre-training & Base models"
303
+ msgstr "预训练 (Pre-training) 和基模型 (Base models)"
304
+
305
+ #: ../../Qwen/source/getting_started/concepts.md:91
306
+ #: d75a1bc5132a43e8b41ce24b8021e7ab
307
+ msgid "Base language models are foundational models trained on extensive corpora of text to predict the next word in a sequence. Their main goal is to capture the statistical patterns and structures of language, enabling them to generate coherent and contextually relevant text. These models are versatile and can be adapted to various natural language processing tasks through fine-tuning. While adept at producing fluent text, they may require in-context learning or additional training to follow specific instructions or perform complex reasoning tasks effectively. For Qwen models, the base models are those without \"-Instruct\" indicators, such as Qwen2.5-7B and Qwen2.5-72B."
308
+ msgstr "基础语言模型 (base language models) 是在大量文本语料库上训练的基本模型,用于预测序列中的下一个词。它们的主要目标是捕捉语言的统计模式和结构,使它们能够生成连贯且具有上下文关联性的文本。这些模型具有多功能性,可以通过微调适应各种自然语言处理任务。虽然擅长生成流畅的文本,但它们可能需要情境学习 (in-context learning)或额外训练才能遵循特定指令或有效执行复杂推理任务。对于 Qwen 模型,基础模型是指那些没有 \"-Instruct\" 标识符的模型,例如 Qwen2.5-7B 和 Qwen2.5-72B 。"
309
+
310
+ #: ../../Qwen/source/getting_started/concepts.md:97
311
+ #: 7f7321ea84f34e29beabf6122a77ec64
312
+ msgid "**Takeaway: Use base models for in-context learning, downstream fine-tuning, etc.**"
313
+ msgstr "**要点:使用基础模型进行情境学习、下游微调等。**"
314
+
315
+ #: ../../Qwen/source/getting_started/concepts.md:99
316
+ #: b1d8ca8221c0494796dda85ac2456389
317
+ msgid "Post-training & Instruction-tuned models"
318
+ msgstr "后训练 (Post-training) 和指令微调模型 (Instruction-tuned models)"
319
+
320
+ #: ../../Qwen/source/getting_started/concepts.md:101
321
+ #: 2f55c1d2c9234c44ab55bf90fcb1b10f
322
+ msgid "Instruction-tuned language models are specialized models designed to understand and execute specific instructions in conversational styles. These models are fine-tuned to interpret user commands accurately and can perform tasks such as summarization, translation, and question answering with improved accuracy and consistency. Unlike base models, which are trained on large corpora of text, instruction-tuned models undergo additional training using datasets that contain examples of instructions and their desired outcomes, often in multiple turns. This kind of training makes them ideal for applications requiring targeted functionalities while maintaining the ability to generate fluent and coherent text. For Qwen models, the instruction-tuned models are those with the \"-Instruct\" suffix, such as Qwen2.5-7B-Instruct and Qwen2.5-72B-Instruct. [^instruct-chat]"
323
+ msgstr "指令微调语言模型 (Instruction-tuned language models) 是专门设计用于理解并以对话风格执行特定指令的模型。这些模型经过微调,能准确地解释用户命令,并能以更高的准确性和一致性执行诸如摘要、翻译和问答等任务。与在大量文本语料库上训练的基础模型不同,指令调优模型会使用包含指令示例及其预期结果的数据集进行额外训练,通常涵盖多个回合。这种训练方式使它们非常适合需要特定功能的应用,同时保持生成流畅且连贯文本的能力。对于 Qwen 模型,指令调优模型是指带有 \"-Instruct\" 后缀的模型,例如 Qwen2.5-7B-Instruct 和 Qwen2.5-72B-Instruct 。 [^instruct-chat]"
324
+
325
+ #: ../../Qwen/source/getting_started/concepts.md:107
326
+ #: d5b5590ccf434715bd57d0746f196cfe
327
+ msgid "**Takeaway: Use instruction-tuned models for conducting tasks in conversations, downstream fine-tuning, etc.**"
328
+ msgstr "**要点:使用指令微调模型进行对话式的任务执行、下游微调等。**"
329
+
330
+ #: ../../Qwen/source/getting_started/concepts.md:112
331
+ #: 5dc4cca1e5104c67b1a3bcdd004e7a9d
332
+ msgid "Tokens & Tokenization"
333
+ msgstr "Tokens & Tokenization"
334
+
335
+ #: ../../Qwen/source/getting_started/concepts.md:114
336
+ #: 9e3a74bf95fd40e49fef921a0d0df6ff
337
+ msgid "Tokens represent the fundamental units that models process and generate. They can represent texts in human languages (regular tokens) or represent specific functionality like keywords in programming languages (control tokens [^special]). Typically, a tokenizer is used to split text into regular tokens, which can be words, subwords, or characters depending on the specific tokenization scheme employed, and furnish the token sequence with control tokens as needed. The vocabulary size, or the total number of unique tokens a model recognizes, significantly impacts its performance and versatility. Larger language models often use sophisticated tokenization methods to handle the vast diversity of human language while keeping the vocabulary size manageable. Qwen use a relatively large vocabulary of 151,646 tokens in total."
338
+ msgstr "token 代表模型处理和生成的基本单位。它们可以表示人类语言中的文本(常规 token),或者表示特定功能,如编程语言中的关键字(控制 token [^special])。通常,使用 tokenizer 将文本分割成常规 token ,这些 token 可以是单词、子词或字符,具体取决于所采用的特定 tokenization 方案,并按需为 token 序列添加控制 token 。词表大小,即模型识别的唯一 token 总数,对模型的性能和多功能性有重大影响。大型语言模型通常使用复杂的 tokenization 来处理人类语言的广阔多样性,同时保持词表大小可控。Qwen 词表相对较大,有 15 1646 个 token。"
339
+
340
+ #: ../../Qwen/source/getting_started/concepts.md:123
341
+ #: 9e1c049b23fc403ea61919a755ae865a
342
+ msgid "**Takeaway: Tokenization method and vocabulary size is important.**"
343
+ msgstr "**要点:tokenization 和词表大小很重要。**"
344
+
345
+ #: ../../Qwen/source/getting_started/concepts.md:125
346
+ #: 0a01476839134505b1e2e004f67c876b
347
+ msgid "Byte-level Byte Pair Encoding"
348
+ msgstr "Byte-level Byte Pair Encoding"
349
+
350
+ #: ../../Qwen/source/getting_started/concepts.md:127
351
+ #: e461340d6e834aaeb233649a70618165
352
+ msgid "Qwen adopts a subword tokenization method called Byte Pair Encoding (BPE), which attempts to learn the composition of tokens that can represent the text with the fewest tokens. For example, the string \" tokenization\" is decomposed as \" token\" and \"ization\" (note that the space is part of the token). Especially, the tokenization of Qwen ensures that there is no unknown words and all texts can be transformed to token sequences."
353
+ msgstr "Qwen采用了名为字节对编码(Byte Pair Encoding,简称BPE)的子词tokenization方法,这种方法试图学习能够用最少的 token 表示文本的 token 组合。例如,字符串\"tokenization\"被分解为\" token\"和\"ization\"(注意空格是 token 的一部分)。特别地,Qwen的 tokenization 确保了不存在未知词汇,并且所有文本都可以转换为 token 序列。"
354
+
355
+ #: ../../Qwen/source/getting_started/concepts.md:131
356
+ #: af40a128cbe44fb59a057f9477737197
357
+ msgid "There are 151,643 tokens as a result of BPE in the vocabulary of Qwen, which is a large vocabulary efficient for diverse languages. As a rule of thumb, 1 token is 3~4 characters for English texts and 1.5~1.8 characters for Chinese texts."
358
+ msgstr "Qwen词表中因BPE而产生的 token 数量为 15 1643 个,这是一个适用于多种语言的大词表。一般而言,对于英语文本,1个token大约是3~4个字符;而对于中文文本,则大约是1.5~1.8个汉字。"
359
+
360
+ #: ../../Qwen/source/getting_started/concepts.md:134
361
+ #: 3b92bf813f14474f842584fa9bf4fdee
362
+ msgid "**Takeaway: Qwen processes texts in subwords and there are no unknown words.**"
363
+ msgstr "**要点:Qwen 以子词形式处理文本,不存在未知词汇。**"
364
+
365
+ #: ../../Qwen/source/getting_started/concepts.md
366
+ #: b29e165e1810403dbcd90cfedd8c73a6
367
+ msgid "Learn more about tokenization in Qwen"
368
+ msgstr "了解更多"
369
+
370
+ #: ../../Qwen/source/getting_started/concepts.md:137
371
+ #: b7fa098dbce946c9847eb414f7d52b9e
372
+ msgid "Qwen uses byte-level BPE (BBPE) on UTF-8 encoded texts. It starts by treating each byte as a token and then iteratively merges the most frequent pairs of tokens occurring the texts into larger tokens until the desired vocabulary size is met."
373
+ msgstr "Qwen 使用基于字节的BPE (BBPE) 对UTF-8编码的文本进行处理。它开始时将每个字节视为一个 token ,然后迭代地将文本中最频繁出现的 token 对合并成更大的 token,直到达到所需的词表大小。"
374
+
375
+ #: ../../Qwen/source/getting_started/concepts.md:140
376
+ #: 504bb23b689949dd9bbee78f97d7e0a0
377
+ msgid "In byte-level BPE, minimum 256 tokens are needed to tokenize every piece of text and avoid the out of vocabulary (OOV) problem. In comparison, character-level BPE needs every Unicode character in its vocabulary to avoid OOV and the Unicode Standard contains 154,998 characters as of Unicode Version 16.0."
378
+ msgstr "在基于字节的BPE中,至少需要256个 token 来对每段文本进行 tokenization,并避免未登录词(out of vocabulary, OOV)问题。相比之下,基于字符的 BPE 需要其词表中包含所有 Unicode 字符以避免未登录词,而截至 Unicode 版本16.0,Unicode标准包含 15 4998 个字符。"
379
+
380
+ #: ../../Qwen/source/getting_started/concepts.md:143
381
+ #: cfed44d0c905486cb7e12838014249e1
382
+ msgid "One limitation to keep in mind for byte-level BPE is that the individual tokens in the vocabulary may not be seemingly semantically meaningful or even valid UTF-8 byte sequences, and in certain aspects, they should be viewed as a text compression scheme."
383
+ msgstr "基于字节的BPE的一个限制是,词表中的个别 token 可能看似没有语义意义,甚至不是有效的 UTF-8 字节序列,在某些方面,它们应该被视为一种文本压缩方案。"
384
+
385
+ #: ../../Qwen/source/getting_started/concepts.md:146
386
+ #: 4c6140ebdb0742e199793a7da566943e
387
+ msgid "Control Tokens & Chat Template"
388
+ msgstr "控制 Token 和 对话模板"
389
+
390
+ #: ../../Qwen/source/getting_started/concepts.md:148
391
+ #: 7fab9c7227b94996bbdd30a2dd6a11cc
392
+ msgid "Control tokens and chat templates both serve as mechanisms to guide the model's behavior and outputs."
393
+ msgstr "控制 token 和对话模板都作为指导模型行为和输出的机制。"
394
+
395
+ #: ../../Qwen/source/getting_started/concepts.md:150
396
+ #: 9d38b62cddc34442bffc173b6c5e15ea
397
+ msgid "Control tokens are special tokens inserted into the sequence that signifies meta information. For example, in pre-training, multiple documents may be packed into a single sequence. For Qwen, the control token \"<|endoftext|>\" is inserted after each document to signify that the document has ended and a new document will proceed."
398
+ msgstr "控制token是插入到序列中的特殊token,表示元信息。例如,在预训练中,多个文档可以被打包成一个单一的序列。对于Qwen,控制令牌 \"<|endoftext|>\" 在每个文档后插入,表示文档已经结束,新的文档将开始。"
399
+
400
+ #: ../../Qwen/source/getting_started/concepts.md:154
401
+ #: aed5af70b3de447b9b3c1312f040f103
402
+ msgid "Chat templates provide a structured format for conversational interactions, where predefined placeholders or prompts are used to elicit responses from the model that adhere to a desired dialogue flow or context. Different models may use different kinds of chat template to format the conversations. It is crucial to use the designated one to ensure the precise control over the LLM's generation process."
403
+ msgstr "对话模板为对话交互提供了结构化的格式,其中使用预定义的占位符或提示来从模型中引发遵循期望的对话流程或上下文的响应。不同的模型可能使用不同类型的对话模板来格式化对话。使用指定的模板对于确保对语言模型生成过程的精确控制至关重要。"
404
+
405
+ #: ../../Qwen/source/getting_started/concepts.md:158
406
+ #: 7acbb7b28f1746a8b779a004a7dc2d93
407
+ msgid "Qwen uses the following format (ChatML[^chatml]), making use of control tokens to format each turn in the conversations"
408
+ msgstr "Qwen使用以下格式(ChatML[^chatml]),利用控制 token 来格式化对话中的每一轮。"
409
+
410
+ #: ../../Qwen/source/getting_started/concepts.md:163
411
+ #: 33f3aee8869748fa9f7a51c7efa76338
412
+ msgid "The user input take the role of `user` and the model generation takes the role of `assistant`. Qwen also supports the meta message that instruct the model to perform specific actions or generate text with certain characteristics, such as altering tone, style, or content, which takes the role of `system` and the content defaults to \"You are Qwen, created by Alibaba Cloud. You are a helpful assistant.\""
413
+ msgstr "用户输入扮演 `user` 的 role ,而模型生成则承担 `assistant` 的 role 。 Qwen 还支持元消息,该消息指导模型执行特定操作或生成具有特定特性的文本,例如改变语气、风格或内容,这将承担 `system` 的 role,且内容默认为 \"You are Qwen, created by Alibaba Cloud. You are a helpful assistant.\" 。"
414
+
415
+ #: ../../Qwen/source/getting_started/concepts.md:166
416
+ #: 0129cbc394614f5f94047592df13c9b6
417
+ msgid "The following is a full example:"
418
+ msgstr "下面为一个完整示例"
419
+
420
+ #: ../../Qwen/source/getting_started/concepts.md:183
421
+ #: 59bab0422fa34a19ab2995e6ff15dc56
422
+ msgid "Starting from Qwen2.5, the Qwen model family including multimodal and specialized models will use a unified vocabulary, which contains control tokens from all subfamilies. There are 22 control tokens in the vocabulary of Qwen2.5, making the vocabulary size totaling 151,665:"
423
+ msgstr "从 Qwen2.5 开始,Qwen 模型家族,包括多模态和专项模型,将使用统一的词汇表,其中包含了所有子系列的控制 token 。Qwen2.5 的词汇表中有 22 个控制 token,使得词汇表的总规模达到 15 1665 。"
424
+
425
+ #: ../../Qwen/source/getting_started/concepts.md:185
426
+ #: 701bd6f896634b0aaf2920d883268a16
427
+ msgid "1 general: `<|endoftext|>`"
428
+ msgstr "通用 token 1个:`<|endoftext|>`"
429
+
430
+ #: ../../Qwen/source/getting_started/concepts.md:186
431
+ #: 7e78239f93a245dbb046d4ae2afe8a72
432
+ msgid "2 for chat: `<|im_start|>` and `<|im_end|>`"
433
+ msgstr "对话 token 2个:`<|im_start|>` 和 `<|im_end|>`"
434
+
435
+ #: ../../Qwen/source/getting_started/concepts.md:187
436
+ #: eb686086dfe44d53a5cdfc98e9bbaad8
437
+ msgid "2 for tool use: `<tool_call>` and `</tool_call>`"
438
+ msgstr "工具调用 token 2个: `<tool_call>` 和 `</tool_call>`"
439
+
440
+ #: ../../Qwen/source/getting_started/concepts.md:188
441
+ #: c8259cada9e94790a759a4b1f8edaf2d
442
+ msgid "11 for vision"
443
+ msgstr "视觉相关 token 11个"
444
+
445
+ #: ../../Qwen/source/getting_started/concepts.md:189
446
+ #: 9b67870139b144c8ae4451e3deb1c1c5
447
+ msgid "6 for coding"
448
+ msgstr "代码相关 token 6个"
449
+
450
+ #: ../../Qwen/source/getting_started/concepts.md:191
451
+ #: 32c9581187f640d2a37cca85390bf1de
452
+ msgid "**Takeaway: Qwen uses ChatML with control tokens for chat template.**"
453
+ msgstr "**要点: Qwen 使用带有控制 token 的 ChatML 作为对话模板。**"
454
+
455
+ #: ../../Qwen/source/getting_started/concepts.md:195
456
+ #: 74d8b323a0864a9c94a78f154a5c86c0
457
+ msgid "Length Limit"
458
+ msgstr "长度限制"
459
+
460
+ #: ../../Qwen/source/getting_started/concepts.md:197
461
+ #: 2833c71b35d94ff0b6825f86bc9be098
462
+ msgid "As Qwen models are causal language models, in theory there is only one length limit of the entire sequence. However, since there is often packing in training and each sequence may contain multiple individual pieces of texts. **How long the model can generate or complete ultimately depends on the use case and in that case how long each document (for pre-training) or each turn (for post-training) is in training.**"
463
+ msgstr "由于 Qwen 模型是因果语言模型,理论上整个序列只有一个长度限制。然而,由于在训练中通常存在打包现象,每个序列可能包含多个独立的文本片段。**模型能够生成或完成的长度最终取决于具体的应用场景,以及在这种情况下,预训练时每份文档或后训练时每轮对话的长度。**"
464
+
465
+ #: ../../Qwen/source/getting_started/concepts.md:201
466
+ #: 1d25c6232d924639b313a1a66d1990c9
467
+ msgid "For Qwen2.5, the packed sequence length in training is 32,768 tokens.[^yarn] The maximum document length in pre-training is this length. The maximum message length for user and assistant is different in post-training. In general, the assistant message could be up to 8192 tokens."
468
+ msgstr "对于Qwen2.5,在训练中的打包序列长度为 3 2768 个 token [^yarn]。预训练中的最大文档长度即为此长度。而后训练中,user和assistant的最大消息长度则有所不同。一般情况下,assistant消息长度可达 8192 个 token。"
469
+
470
+ #: ../../Qwen/source/getting_started/concepts.md:209
471
+ #: f39c2748eccb486794c941d23b23835c
472
+ msgid "**Takeaway: Qwen2.5 models can process texts of 32K or 128K tokens and up to 8K tokens can be assistant output.**"
473
+ msgstr "**要点:Qwen2 模型可以处理 32K 或 128K token 长的文本,其中 8K 长度可作为输出。**"
474
+
475
+ #: ../../Qwen/source/getting_started/concepts.md:109
476
+ #: 7195ff6a5d1a4e6881f272081c9885d7
477
+ msgid "Previously, they are known as the chat models and with the \"-Chat\" suffix. Starting from Qwen2, the name is changed to follow the common practice. For Qwen, \"-Instruct\" and \"-Chat\" should be regarded as synonymous."
478
+ msgstr "此前,它们被称为对话模型,并带有\"-Chat\"后缀。从Qwen2开始,名称变更为遵循通用做法。对于Qwen,\"-Instruct\"和\"-Chat\"应被视为同义词。"
479
+
480
+ #: ../../Qwen/source/getting_started/concepts.md:121
481
+ #: f50caec63c8948a894dbf8c718f0b2d8
482
+ msgid "Control tokens can be called special tokens. However, the meaning of special tokens need to be interpreted based on the contexts: special tokens may contain extra regular tokens."
483
+ msgstr "控制 token 也可以称为“特殊 token”。但是,特殊 token 的意义需要根据上下文进行解释:特殊 token 也可能包含额外的常规 token。"
484
+
485
+ #: ../../Qwen/source/getting_started/concepts.md:193
486
+ #: fc70e6f93b71452ca0d09aa0ff28dd54
487
+ msgid "For historical reference only, ChatML is first described by the OpenAI Python SDK. The last available version is [this](https://github.com/openai/openai-python/blob/v0.28.1/chatml.md). Please also be aware that that document lists use cases intended for OpenAI models. For Qwen2.5 models, please only use as in our guide."
488
+ msgstr "仅供历史参考,ChatML最初由OpenAI的Python SDK描述。可获取的最新版本是[这个](https//github.com/openai/openai-python/blob/v0.28.1/chatml.md)。请注意,该文档列出的应用案例是为OpenAI模型设计的。对于Qwen2.5模型,请仅按照我们的指南使用。"
489
+
490
+ #: ../../Qwen/source/getting_started/concepts.md:206
491
+ #: a08b83b36c2d4e8d8f3dbb020ecb37a2
492
+ msgid "The sequence length can be extended to 131,072 tokens for Qwen2.5-7B, Qwen2.5-14B, Qwen2.5-32B, and Qwen2.5-72B models with YaRN. Please refer to the model card on how to enable YaRN in vLLM."
493
+ msgstr "使用YaRN,Qwen2.5-7B、Qwen2.5-14B、Qwen2.5-32B和Qwen2-72B模型的序列长度可以扩展到13 1072个token。请参考模型卡片了解如何在 vLLM 中启用 YaRN。"
494
+
495
+ #~ msgid "There is the proprietary version hosted exclusively at [Alibaba Cloud \\[zh\\]](https://help.aliyun.com/zh/model-studio/developer-reference/tongyi-qianwen-llm/) and the open-weight version."
496
+ #~ msgstr "通义千问分为[闭源](https://help.aliyun.com/zh/model-studio/developer-reference/tongyi-qianwen-llm/)和开源两大版本。"
497
+
docs/locales/zh_CN/LC_MESSAGES/getting_started/quantization_benchmark.po ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
+
21
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:2
22
+ #: 6d4d3bb3020f4e4d8dba0ca5778cdcae
23
+ msgid "Performance of Quantized Models"
24
+ msgstr "量化模型效果评估"
25
+
26
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:5
27
+ #: 3a541cd8cba74edf9b06b46f59eaaf38
28
+ msgid "To be updated for Qwen3."
29
+ msgstr "仍需为Qwen3更新。"
30
+
31
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:7
32
+ #: 3a95fc299de141dea4fc729ef907ce17
33
+ msgid "This section reports the generation performance of quantized models (including GPTQ and AWQ) of the Qwen2 series. Specifically, we report:"
34
+ msgstr "本部分介绍Qwen2量化模型(包括GPTQ与AWQ量化方案)的效果评估,有以下数据集"
35
+
36
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:11
37
+ #: 9386a3b95eb340568185da78224a1ccd
38
+ msgid "MMLU (Accuracy)"
39
+ msgstr "MMLU (准确率)"
40
+
41
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:12
42
+ #: 3cd93b881c90488895c61298104bc7fb
43
+ msgid "C-Eval (Accuracy)"
44
+ msgstr "C-Eval (准确率)"
45
+
46
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:13
47
+ #: 7ac4bb515b0a49699d4eb95fc433bb51
48
+ msgid "IFEval (Strict Prompt-Level Accuracy)"
49
+ msgstr "IFEval (提示词级的严格准确率,Strict Prompt-Level Accuracy)"
50
+
51
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:15
52
+ #: 08e3f35820344c93877618815650b866
53
+ msgid "We use greedy decoding in evaluating all models."
54
+ msgstr "所有模型均使用贪心解码。"
55
+
56
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:18
57
+ #: 9aec40221219455d8fc4e473e5acf09c
58
+ msgid "Quantization"
59
+ msgstr "量化模型"
60
+
61
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:18
62
+ #: 93f274f4751f445d85f04937b25c7f7d
63
+ msgid "Average"
64
+ msgstr "平均"
65
+
66
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:18
67
+ #: 776612f5dd4a40d98976bdfe4896508c
68
+ msgid "MMLU"
69
+ msgstr ""
70
+
71
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:18
72
+ #: f6e8014116cf4179a934d601ee61d04d
73
+ msgid "C-Eval"
74
+ msgstr ""
75
+
76
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:18
77
+ #: 0c40e96c4a3b4cdeaaf1a95ff1aa8f98
78
+ msgid "IFEval"
79
+ msgstr ""
80
+
81
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:20
82
+ #: 773ccb0f10bd4cf690e819af51c40e76
83
+ msgid "Qwen2-72B-Instruct"
84
+ msgstr ""
85
+
86
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:20
87
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:28
88
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:36
89
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:44
90
+ #: 71e180f75e624b738d56ec2a1fad253c 7ebe73a2e96445c4bb733845c3190240
91
+ #: bd5a3b8861d646fa9e8d8bc51bb1b80c cc79a78b34f94c18b7bdaf1bfcc8824d
92
+ msgid "BF16"
93
+ msgstr ""
94
+
95
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:20
96
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:22
97
+ #: 08517ffc3e6e4ceb812c3d8710307266 2e879d3d1fef4c878b097550d745e7ae
98
+ msgid "81.3"
99
+ msgstr ""
100
+
101
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:20
102
+ #: f795aa42cf7d42ccb5a573a5f44be79f
103
+ msgid "82.3"
104
+ msgstr ""
105
+
106
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:20
107
+ #: 01c54f3da3454e178a07a9f88ed5302b
108
+ msgid "83.8"
109
+ msgstr ""
110
+
111
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:20
112
+ #: 7651df5ccaa14b11a3a89827a5265ae8
113
+ msgid "77.6"
114
+ msgstr ""
115
+
116
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:22
117
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:30
118
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:38
119
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:46
120
+ #: 04de04c9ff3640f096301e76fdd291de 301aa8e494ff4fe4aefcc8cfb7a4c065
121
+ #: d395be41cf144318a1faeccc6f6965c8 ec513d10a75d44b8bd134287a57b5cdd
122
+ msgid "GPTQ-Int8"
123
+ msgstr ""
124
+
125
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:22
126
+ #: 411166db878d4d8f8515e9f5d78a651c
127
+ msgid "80.7"
128
+ msgstr ""
129
+
130
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:22
131
+ #: e63ce8a2f1cc4cec9b52521015e2aebe
132
+ msgid "83.4"
133
+ msgstr ""
134
+
135
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:22
136
+ #: e6be6c30e0d740d39c6c8807e2d4f5f8
137
+ msgid "77.5"
138
+ msgstr ""
139
+
140
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:24
141
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:32
142
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:40
143
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:48
144
+ #: 21720ff324814b2b865f37a40c3586b5 4644a49bcdfd457b84eb5b2771177d78
145
+ #: 560dcb4bfa6e45088faefdb504d629a5 7044a0d2dd6945138ea385287ab5bf33
146
+ msgid "GPTQ-Int4"
147
+ msgstr ""
148
+
149
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:24
150
+ #: 1cb55cd40b3c484d8213c15375b2ad68
151
+ msgid "81.2"
152
+ msgstr ""
153
+
154
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:24
155
+ #: 32b889d9ef014f2ab6be6881e20d40ae
156
+ msgid "80.8"
157
+ msgstr ""
158
+
159
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:24
160
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:26
161
+ #: ba86de9eb27b40e0ba6a57580aed89c3 eed2e99c0edc426e81ec24e961fe971e
162
+ msgid "83.9"
163
+ msgstr ""
164
+
165
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:24
166
+ #: ee3a3132082048d5b79721fa84f6f816
167
+ msgid "78.9"
168
+ msgstr ""
169
+
170
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:26
171
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:34
172
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:42
173
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:50
174
+ #: 632f832fc1f249fa92764538b698550d 8c7ccf4f75f44b27bb1b5aac544836cb
175
+ #: b473937c2be94c3490483bb5a820e2fe bc1abd77dd27412992d21bda1831a2a8
176
+ msgid "AWQ"
177
+ msgstr ""
178
+
179
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:26
180
+ #: 2711a3f907224e51ba30818b2e730a30
181
+ msgid "80.4"
182
+ msgstr ""
183
+
184
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:26
185
+ #: ca9624c0258b425ba53f024b086c173a
186
+ msgid "80.5"
187
+ msgstr ""
188
+
189
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:26
190
+ #: 2f4b57d4394c4cb187407145ce8d5f1e
191
+ msgid "76.9"
192
+ msgstr ""
193
+
194
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:28
195
+ #: 48cc75ed7bf04778b327c7b03d418e37
196
+ msgid "Qwen2-7B-Instruct"
197
+ msgstr ""
198
+
199
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:28
200
+ #: 75182905b74a41099ff859fb86752e99
201
+ msgid "66.9"
202
+ msgstr ""
203
+
204
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:28
205
+ #: 80cda712e9dc482fac24952d3bb27b28
206
+ msgid "70.5"
207
+ msgstr ""
208
+
209
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:28
210
+ #: 0701d66bc3084aef8937e4b687705f37
211
+ msgid "77.2"
212
+ msgstr ""
213
+
214
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:28
215
+ #: 8efb5c133644420c808dfd78f8fcde2f
216
+ msgid "53.1"
217
+ msgstr ""
218
+
219
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:30
220
+ #: 2076e02516bd4ff1856bc12a8d6bd320
221
+ msgid "66.2"
222
+ msgstr ""
223
+
224
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:30
225
+ #: 588f4ad13845491d9589ea094265d532
226
+ msgid "69.1"
227
+ msgstr ""
228
+
229
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:30
230
+ #: 0c79963a231a402eb6db1671e851be38
231
+ msgid "76.7"
232
+ msgstr ""
233
+
234
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:30
235
+ #: 5d525163672f456289990489459466ae
236
+ msgid "52.9"
237
+ msgstr ""
238
+
239
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:32
240
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:34
241
+ #: 9283ca6491194b59a5edf57228f9b5af a4123c0691a442f6850ae25615c108af
242
+ msgid "64.1"
243
+ msgstr ""
244
+
245
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:32
246
+ #: 9e7ffb49aac34129894b0582c0d8aba1
247
+ msgid "67.8"
248
+ msgstr ""
249
+
250
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:32
251
+ #: 7c2fc310e5764b7fbf6034ffd3a5d26d
252
+ msgid "75.2"
253
+ msgstr ""
254
+
255
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:32
256
+ #: 33e6b6e590a64c08adccf0bb161c1046
257
+ msgid "49.4"
258
+ msgstr ""
259
+
260
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:34
261
+ #: b3cbe7665bdf4f4388f015fb6606540e
262
+ msgid "67.4"
263
+ msgstr ""
264
+
265
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:34
266
+ #: a47d3b52e80249f986c4339b9d3fff10
267
+ msgid "73.6"
268
+ msgstr ""
269
+
270
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:34
271
+ #: d76543cff2df434185fbe51712024679
272
+ msgid "51.4"
273
+ msgstr ""
274
+
275
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:36
276
+ #: cee2c965036d41c6a93ffbf9a9788e4b
277
+ msgid "Qwen2-1.5B-Instruct"
278
+ msgstr ""
279
+
280
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:36
281
+ #: 8c9d1cd8fb5a4d75b85d0edcb9ed69df
282
+ msgid "48.4"
283
+ msgstr ""
284
+
285
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:36
286
+ #: f5e05b0942a24e2b9cac753932ad51c4
287
+ msgid "52.4"
288
+ msgstr ""
289
+
290
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:36
291
+ #: c6f81ec529004598aa14c55228ff9538
292
+ msgid "63.8"
293
+ msgstr ""
294
+
295
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:36
296
+ #: 5b2b4092d04f4d02a56bd0df5807e2c5
297
+ msgid "29.0"
298
+ msgstr ""
299
+
300
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:38
301
+ #: 08d2bf82e83f4a889d622c72c1e1b3b2
302
+ msgid "48.1"
303
+ msgstr ""
304
+
305
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:38
306
+ #: 3d8ea738153f467ba55d50e6bf0f84c0
307
+ msgid "53.0"
308
+ msgstr ""
309
+
310
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:38
311
+ #: 8755d6c4c1e64cd38122f08a92bd90ca
312
+ msgid "62.5"
313
+ msgstr ""
314
+
315
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:38
316
+ #: 1c403dbb3692472a88706cb4b4a1f0f3
317
+ msgid "28.8"
318
+ msgstr ""
319
+
320
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:40
321
+ #: f3f43ea77edc4ff0969e2466e6fe13e1
322
+ msgid "45.0"
323
+ msgstr ""
324
+
325
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:40
326
+ #: 9d070c4b9f3e4fceb27b29ecdf90eb41
327
+ msgid "50.7"
328
+ msgstr ""
329
+
330
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:40
331
+ #: 24ff991704c440deb34b92512f89c371
332
+ msgid "57.4"
333
+ msgstr ""
334
+
335
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:40
336
+ #: b4645b7317a44cb795fc4190149dd0e0
337
+ msgid "27.0"
338
+ msgstr ""
339
+
340
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:42
341
+ #: eeee44d1d65647569999de94e72c00cb
342
+ msgid "46.5"
343
+ msgstr ""
344
+
345
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:42
346
+ #: 41630bee9142494c801083cd5d213dc0
347
+ msgid "51.6"
348
+ msgstr ""
349
+
350
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:42
351
+ #: 762395735fb34bccbc4d057968bbfbf1
352
+ msgid "58.1"
353
+ msgstr ""
354
+
355
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:42
356
+ #: f5915835bcb24051bebed452fc398728
357
+ msgid "29.9"
358
+ msgstr ""
359
+
360
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:44
361
+ #: 39108e2a66444ca780a720f115251308
362
+ msgid "Qwen2-0.5B-Instruct"
363
+ msgstr ""
364
+
365
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:44
366
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:50
367
+ #: 2795adace57c401cb8bacc00082dfd53 a59271d53e434d17a8a0a19529158f2c
368
+ msgid "34.4"
369
+ msgstr ""
370
+
371
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:44
372
+ #: c93982789e4e453eb5a02d64f02cb74f
373
+ msgid "37.9"
374
+ msgstr ""
375
+
376
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:44
377
+ #: 213dfd43b2254a2caec1d4b1d231ed55
378
+ msgid "45.2"
379
+ msgstr ""
380
+
381
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:44
382
+ #: 11de22e2a04a4c04b0b91d09d028b853
383
+ msgid "20.0"
384
+ msgstr ""
385
+
386
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:46
387
+ #: 84b6570bcc8d4c6598336d5bc9b9d36a
388
+ msgid "32.6"
389
+ msgstr ""
390
+
391
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:46
392
+ #: b79e88232d114f43a179dcc5b0477c97
393
+ msgid "35.6"
394
+ msgstr ""
395
+
396
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:46
397
+ #: 1166b675e1e64e18a82c3219f321e248
398
+ msgid "43.9"
399
+ msgstr ""
400
+
401
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:46
402
+ #: fdf340d39b074778b55d36f477f8dc0a
403
+ msgid "18.1"
404
+ msgstr ""
405
+
406
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:48
407
+ #: ed930e1b13dd4c5caf80b2a180a1bcc3
408
+ msgid "29.7"
409
+ msgstr ""
410
+
411
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:48
412
+ #: c3d5617389634f7e96c66b4f869379a9
413
+ msgid "33.0"
414
+ msgstr ""
415
+
416
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:48
417
+ #: 4573b471c48d4028ad6fb378e75f40aa
418
+ msgid "39.2"
419
+ msgstr ""
420
+
421
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:48
422
+ #: c867c42e916f493b9715b1adf656ddcb
423
+ msgid "16.8"
424
+ msgstr ""
425
+
426
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:50
427
+ #: 20d4c89c335648bb93f07ebfb8ce9fce
428
+ msgid "31.1"
429
+ msgstr ""
430
+
431
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:50
432
+ #: 25400aeaf79d49cb914ffa5ff26bfe03
433
+ msgid "42.1"
434
+ msgstr ""
435
+
436
+ #: ../../Qwen/source/getting_started/quantization_benchmark.rst:50
437
+ #: d15e246b65b0427d970b78deffd8c2bc
438
+ msgid "16.7"
439
+ msgstr ""
440
+
docs/locales/zh_CN/LC_MESSAGES/getting_started/quickstart.po ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-06-13 16:36+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.16.0\n"
18
+
19
+ #: ../../source/getting_started/quickstart.md:1
20
+ #: a99b6a1db1374218a20b06bcd0c57957
21
+ msgid "Quickstart"
22
+ msgstr "快速开始"
23
+
24
+ #: ../../source/getting_started/quickstart.md:3
25
+ #: 1da6c3f04eb24db8b697e094163096a1
26
+ msgid "This guide helps you quickly start using Qwen3. We provide examples of [Hugging Face Transformers](https://github.com/huggingface/transformers) as well as [ModelScope](https://github.com/modelscope/modelscope), and [vLLM](https://github.com/vllm-project/vllm) for deployment."
27
+ msgstr "本指南帮助您快速上手 Qwen3 的使用,并提供了如下示例: [Hugging Face Transformers](https://github.com/huggingface/transformers) 以及 [ModelScope](https://github.com/modelscope/modelscope) 和 [vLLM](https://github.com/vllm-project/vllm) 在部署时的应用实例。"
28
+
29
+ #: ../../source/getting_started/quickstart.md:6
30
+ #: 11c38e7141f941efb448e7099935b8a9
31
+ msgid "You can find Qwen3 models in [the Qwen3 collection](https://huggingface.co/collections/Qwen/qwen3-67dd247413f0e2e4f653967f) at Hugging Face Hub and [the Qwen3 collection](https://www.modelscope.cn/collections/Qwen3-9743180bdc6b48) at ModelScope."
32
+ msgstr "你可以在 Hugging Face Hub 的 [Qwen3 collection](https://huggingface.co/collections/Qwen/qwen3-67dd247413f0e2e4f653967f) 或 ModelScope 的 [Qwen3 collection](https://www.modelscope.cn/collections/Qwen3-9743180bdc6b48) 中寻找 Qwen3 模型。"
33
+
34
+ #: ../../source/getting_started/quickstart.md:8
35
+ #: 842c24eb7d30496baf9025af21ca1ed0
36
+ msgid "Transformers"
37
+ msgstr "Transformers"
38
+
39
+ #: ../../source/getting_started/quickstart.md:10
40
+ #: d0c61f87b0b347ae91e115ba60ebd46e
41
+ msgid "To get a quick start with Qwen3, you can try the inference with `transformers` first. Make sure that you have installed `transformers>=4.51.0`. We advise you to use Python 3.10 or higher, and PyTorch 2.6 or higher."
42
+ msgstr "要快速上手 Qwen3 ,我们建议您首先尝试使用 `transformers` 进行推理。请确保已安装了 `transformers>=4.51.0` 版本。我们建议您使用 Python 3.10 或以上版本, PyTorch 2.6 或以上版本。"
43
+
44
+ #: ../../source/getting_started/quickstart.md:14
45
+ #: a7fbb3d015b4440ca14ba00821f84fb0
46
+ msgid "The following is a very simple code snippet showing how to run Qwen3-8B:"
47
+ msgstr "以下是一个非常简单的代码片段示例,展示如何运行 Qwen3 模型:"
48
+
49
+ #: ../../source/getting_started/quickstart.md:63
50
+ #: b55178516d31433c9ead5287e9abd3b4
51
+ msgid "Qwen3 will think before respond, similar to QwQ models. This means the model will use its reasoning abilities to enhance the quality of generated responses. The model will first generate thinking content wrapped in a `<think>...</think>` block, followed by the final response."
52
+ msgstr "Qwen3 将在实际回复前思考,与 QwQ 模型类似。这意味着模型将运用其推理能力来提升生成回复的质量。模型会首先生成包含在 `<think>...</think>` 块中的思考内容,随后给出最终回复。"
53
+
54
+ #: ../../source/getting_started/quickstart.md:67
55
+ #: e31fa076c2264d9fa2ae5d8516b7f4a7
56
+ msgid "Hard Switch: To strictly disable the model's thinking behavior, aligning its functionality with the previous Qwen2.5-Instruct models, you can set `enable_thinking=False` when formatting the text."
57
+ msgstr "硬开关:为了严格禁用模型的思考行为,使其功能与之前的Qwen2.5-Instruct模型保持一致,您可以在格式化文本时设置`enable_thinking=False`。"
58
+
59
+ #: ../../source/getting_started/quickstart.md:77
60
+ #: a6c11c7147e54cf9a86d65b4f80840c3
61
+ msgid "It can be particularly useful in scenarios where disabling thinking is essential for enhancing efficiency."
62
+ msgstr "在某些需要通过禁用思考来提升效率的场景中,这一功能尤其有用。"
63
+
64
+ #: ../../source/getting_started/quickstart.md:79
65
+ #: 57bd7b66fe3b4dbfabe7439dc67b7d5f
66
+ msgid "Soft Switch: Qwen3 also understands the user's instruction on its thinking behavior, in particular, the soft switch `/think` and `/no_think`. You can add them to user prompts or system messages to switch the model's thinking mode from turn to turn. The model will follow the most recent instruction in multi-turn conversations."
67
+ msgstr "软开关:Qwen3 还能够理解用户对其思考行为的指令,特别是软开关 `/think` 和 `/no_think`。您可以将这些指令添加到用户 (user) 或系统 (system) 消息中,以在对话轮次之间灵活切换模型的思考模式。在多轮对话中,模型将遵循最近的指令。"
68
+
69
+ #: ../../source/getting_started/quickstart.md:85
70
+ #: 73fa1ee92c7b4a71a2724aedb665dd1b
71
+ msgid "For thinking mode, use Temperature=0.6, TopP=0.95, TopK=20, and MinP=0 (the default setting in `generation_config.json`). DO NOT use greedy decoding, as it can lead to performance degradation and endless repetitions. For more detailed guidance, please refer to the Best Practices section."
72
+ msgstr "对于思考模式,使用 Temperature=0.6,TopP=0.95,TopK=20,以及 MinP=0(`generation_config.json` 中的默认设置)。不要使用贪婪解码,因为它可能导致性能下降和无尽的重复。更多详细指导,请参阅最佳实践部分。"
73
+
74
+ #: ../../source/getting_started/quickstart.md:89
75
+ #: 4ce3b1cf5e1349628a66c101432fd748
76
+ msgid "For non-thinking mode, we suggest using Temperature=0.7, TopP=0.8, TopK=20, and MinP=0."
77
+ msgstr "对于非思考模式,我们建议使用 Temperature=0.7,TopP=0.8,TopK=20,以及 MinP=0。"
78
+
79
+ #: ../../source/getting_started/quickstart.md:93
80
+ #: 34d138d1ca8c4ecab4002b354cfe64d2
81
+ msgid "ModelScope"
82
+ msgstr "魔搭 (ModelScope)"
83
+
84
+ #: ../../source/getting_started/quickstart.md:95
85
+ #: 0c25fecd5e42412a80214fbc35b08226
86
+ msgid "To tackle with downloading issues, we advise you to try [ModelScope](https://github.com/modelscope/modelscope). Before starting, you need to install `modelscope` with `pip`."
87
+ msgstr "为了解决下载问题,我们建议您尝试从 [ModelScope](https://github.com/modelscope/modelscope) 进行下载。开始之前,需要使用 `pip` 安装 `modelscope` 。"
88
+
89
+ #: ../../source/getting_started/quickstart.md:98
90
+ #: d8ccf4eafeb849ae8bd49d9fb2281c60
91
+ msgid "`modelscope` adopts a programmatic interface similar (but not identical) to `transformers`. For basic usage, you can simply change the first line of code above to the following:"
92
+ msgstr "`modelscope` 采用了与 `transformers` 类似(但不完全一致)的编程接口。对于基础使用,仅需将上面代码第一行做如下修改:"
93
+
94
+ #: ../../source/getting_started/quickstart.md:105
95
+ #: f17c53400572487ca066135facd711bb
96
+ msgid "For more information, please refer to [the documentation of `modelscope`](https://www.modelscope.cn/docs)."
97
+ msgstr "欲获取更多信息,请参考 [`modelscope` 文档](https://www.modelscope.cn/docs)。"
98
+
99
+ #: ../../source/getting_started/quickstart.md:107
100
+ #: 6e3028c50b2146bd932d168662e57620
101
+ msgid "OpenAI API Compatibility"
102
+ msgstr ""
103
+
104
+ #: ../../source/getting_started/quickstart.md:109
105
+ #: 046b0833e5b744cda72d7a7ef5672cc2
106
+ msgid "You can serve Qwen3 via OpenAI-compatible APIs using frameworks such as vLLM, SGLang, and interact with the API using common HTTP clients or the OpenAI SDKs."
107
+ msgstr ""
108
+
109
+ #: ../../source/getting_started/quickstart.md:112
110
+ #: 1542f3cbe7ba4adab50dfc85da110c36
111
+ msgid "Here we take Qwen3-8B as an example to start the API:"
112
+ msgstr ""
113
+
114
+ #: ../../source/getting_started/quickstart.md:114
115
+ #: 4bfa52cf82914d73b0fcbbceafa4ff8a
116
+ msgid "SGLang (`sglang>=0.4.6.post1` is required):"
117
+ msgstr ""
118
+
119
+ #: ../../source/getting_started/quickstart.md:120
120
+ #: cc7a9ae4d4fe4b86be41b376d7334024
121
+ msgid "vLLM (`vllm>=0.8.5` is recommended):"
122
+ msgstr ""
123
+
124
+ #: ../../source/getting_started/quickstart.md:126
125
+ #: 7a690ab7e23f4505a355abd50e647101
126
+ msgid "Then, you can use the [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) to communicate with Qwen:"
127
+ msgstr "然后,可以使用 [\"create chat\" interface](https://platform.openai.com/docs/api-reference/chat/completions/create>) 来与 Qwen 进行交流:"
128
+
129
+ #: ../../source/getting_started/quickstart.md 9cd82768a97142acac1c2c63a05e1ad3
130
+ msgid "curl"
131
+ msgstr ""
132
+
133
+ #: ../../source/getting_started/quickstart.md 7d220176fa6b4622ae74431873d49396
134
+ msgid "Python"
135
+ msgstr ""
136
+
137
+ #: ../../source/getting_started/quickstart.md:146
138
+ #: f55afdfc6fa54f468b1b554fab082263
139
+ msgid "You can use the API client with the `openai` Python SDK as shown below:"
140
+ msgstr "您可以按照下面所示的方式,使用 `openai` Python SDK中的客户端:"
141
+
142
+ #: ../../source/getting_started/quickstart.md:175
143
+ #: d0370e64550a4c51b6146ad7dfb52f97
144
+ msgid "While the soft switch is always available, the hard switch is also available in the API through the following configuration to the API call. For more usage, please refer to our document on [SGLang](../deployment/sglang) and [vLLM](../deployment/vllm)."
145
+ msgstr "虽然软开关始终可用,但硬开关也可以通过以下 API 调用配置在 API 中使用。更多用法,请参阅我们关于 [SGLang](../deployment/sglang) 和 [vLLM](../deployment/vllm) 的文档。"
146
+
147
+ #: ../../source/getting_started/quickstart.md:178
148
+ #: e48c576eba5e4c5db9ef0a48882e18c2
149
+ msgid "Thinking Budget"
150
+ msgstr "思考预算"
151
+
152
+ #: ../../source/getting_started/quickstart.md:180
153
+ #: cc5be59588e34164b7f2e84a7d8b82c0
154
+ msgid "Qwen3 supports the configuration of thinking budget. It is achieved by ending the thinking process once the budget is reached and guiding the model to generate the \"summary\" with an early-stopping prompt."
155
+ msgstr "Qwen3 支持配置思考预算。其实现方式是,一旦达到预算,便结束思考过程,并通过提前停止提示引导模型生成“总结”。"
156
+
157
+ #: ../../source/getting_started/quickstart.md:183
158
+ #: 8a2760351bc04093adc5017b58ec4981
159
+ msgid "Since this feature involves customization specific to each model, it is currently not available in the open-source frameworks and only implemented by [the Alibaba Cloud Model Studio API](https://www.alibabacloud.com/help/en/model-studio/deep-thinking#6f0633b9cdts1)."
160
+ msgstr "由于此功能涉及针对模型的定制,目前在开源框架中不可用,仅由[阿里云百炼API](https://bailian.console.aliyun.com/?tab=doc#/doc/?type=model&url=https%3A%2F%2Fhelp.aliyun.com%2Fdocument_detail%2F2870973.html&renderType=iframe)实现。"
161
+
162
+ #: ../../source/getting_started/quickstart.md:185
163
+ #: 01acc4a8caa443dc8da81862d2e7d6bb
164
+ msgid "However, with existing open-source frameworks, one can generate twice to implement this feature as follows:"
165
+ msgstr "然而,利用现有的开源框架,可以通过两次生成来实现此功能,具体如下:"
166
+
167
+ #: ../../source/getting_started/quickstart.md:186
168
+ #: 677f5e6ad5b1416aa4bbadff3e6537a1
169
+ msgid "For the first time, generate tokens up to the thinking budget and check if the thinking process is finished. If the thinking process is not finished, append the early-stopping prompt."
170
+ msgstr "第一次生成时,生成的token数量达到思考预算,并检查思考过程是否完成。如果思考过程未完成,则追加提前停止提示。"
171
+
172
+ #: ../../source/getting_started/quickstart.md:187
173
+ #: 479c92c1bc9d4a74b18d5c175d1e6cda
174
+ msgid "For the second time, continue generation until the end of the content or the upper length limit is fulfilled."
175
+ msgstr "第二次生成时,继续生成直到内容结束或达到长度上限。"
176
+
177
+ #: ../../source/getting_started/quickstart.md:189
178
+ #: dd7834e30f9344ddad21792279ad4732
179
+ msgid "The following snippet shows the implementation with Hugging Face Transformers:"
180
+ msgstr "以下代码片段展示了使用Hugging Face Transformers的实现:"
181
+
182
+ #: ../../source/getting_started/quickstart.md:262
183
+ #: 85f448fb112e4742bc5d4bd05979f30d
184
+ msgid "You should see the output in the console like the following"
185
+ msgstr "您应该会在控制台中看到类似以下的输出:"
186
+
187
+ #: ../../source/getting_started/quickstart.md:274
188
+ #: 4fc4ae8cdbb54c8b97b2da717d61e42e
189
+ msgid "For purpose of demonstration only, `thinking_budget` is set to 16. However, `thinking_budget` should not be set to that low in practice. We recommend tuning `thinking_budget` based on the latency users can accept and setting it higher than 1024 for meaningful improvements across tasks."
190
+ msgstr "出于示例目的,`thinking_budget` 被设置为 16。然而,在实际应用中不应将其设置得如此低。我们建议根据用户可接受的延迟调整 `thinking_budget`,并将其设置为高于 1024,以在各项任务中获得有意义的改进。"
191
+
192
+ #: ../../source/getting_started/quickstart.md:278
193
+ #: f5b4018640c24a3cb6dd1e958f2860d9
194
+ msgid "If thinking is not desired at all, developers should make use of the hard switch instead."
195
+ msgstr "如果完全不需要思考,开发者应改用硬开关。"
196
+
197
+ #: ../../source/getting_started/quickstart.md:281
198
+ #: a6bbbe9da06c43c09cd3756e075e6103
199
+ msgid "Next Step"
200
+ msgstr "下一步"
201
+
202
+ #: ../../source/getting_started/quickstart.md:283
203
+ #: 40f5270a92bf490ab4fa0d6af2761044
204
+ msgid "Now, you can have fun with Qwen3 models. Would love to know more about its usage? Feel free to check other documents in this documentation."
205
+ msgstr "现在,您可以尽情探索 Qwen3 模型的各种用途。若想了解更多,请随时查阅本文档中的其他内容。"
docs/locales/zh_CN/LC_MESSAGES/getting_started/speed_benchmark.po ADDED
@@ -0,0 +1,1579 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-05-20 17:08+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.16.0\n"
20
+
21
+ #: ../../source/getting_started/speed_benchmark.md:1
22
+ #: d7da8abe501c46e99fee28d56435b08b
23
+ msgid "Speed Benchmark"
24
+ msgstr "效率评估"
25
+
26
+ #: ../../source/getting_started/speed_benchmark.md:3
27
+ #: 478eb0d956db47ccafda9ec05e9c7253
28
+ msgid "We report the speed performance of bfloat16 models and quantized models (including FP8, GPTQ, AWQ) of the Qwen3 series. Specifically, we report the inference speed (tokens/s) as well as memory footprint (GB) under different context lengths."
29
+ msgstr "本部分介绍 Qwen3 系列模型(原始模型和量化模型)的效率测试结果,包括推理速度(tokens/s)与不同上下文长度时的显存占用(GB)。"
30
+
31
+ #: ../../source/getting_started/speed_benchmark.md:6
32
+ #: c3e1ab9d5f8b4a54bff5d5a56ea6a2bb
33
+ msgid "Environments"
34
+ msgstr "环境配置"
35
+
36
+ #: ../../source/getting_started/speed_benchmark.md:8
37
+ #: 6b7764c599eb4693be742f161daf5cc4
38
+ msgid "Hugging Face Transformers"
39
+ msgstr ""
40
+
41
+ #: ../../source/getting_started/speed_benchmark.md:10
42
+ #: ../../source/getting_started/speed_benchmark.md:25
43
+ #: aa80ee8b1abd4be1b0a9a88cff496938 c43bf971a253469c832f5e874eda86a9
44
+ msgid "**Hardware**:"
45
+ msgstr "**硬件**:"
46
+
47
+ #: ../../source/getting_started/speed_benchmark.md:11
48
+ #: ../../source/getting_started/speed_benchmark.md:26
49
+ #: 471dbb8bd26c41a58f485dabf6643aa0
50
+ msgid "NVIDIA H20 96GB"
51
+ msgstr ""
52
+
53
+ #: ../../source/getting_started/speed_benchmark.md:12
54
+ #: 04347c8d74a44a18af8fb11cbf47bb42
55
+ msgid "**Software for Non-AutoAWQ**:"
56
+ msgstr "**非AutoAWQ的软件环境**:"
57
+
58
+ #: ../../source/getting_started/speed_benchmark.md:13
59
+ #: 5bf39b332ff04657838c29c627a0e3a6
60
+ msgid "PyTorch 2.6.0"
61
+ msgstr ""
62
+
63
+ #: ../../source/getting_started/speed_benchmark.md:14
64
+ #: e1ca0b138a5248a59f6fb59331ff09c1
65
+ msgid "Flash Attention 2.7.4"
66
+ msgstr ""
67
+
68
+ #: ../../source/getting_started/speed_benchmark.md:15
69
+ #: ../../source/getting_started/speed_benchmark.md:19
70
+ #: ../../source/getting_started/speed_benchmark.md:29
71
+ #: c763f81c0b2443d594f7b7c6c1cacce0
72
+ msgid "Transformers 4.51.3"
73
+ msgstr ""
74
+
75
+ #: ../../source/getting_started/speed_benchmark.md:16
76
+ #: 07c9d4a46b1446d9a334ad590b23ae8c
77
+ msgid "GPTQModel 2.2.0+cu128torch2.6"
78
+ msgstr ""
79
+
80
+ #: ../../source/getting_started/speed_benchmark.md:17
81
+ #: a13e8f4aa82f4693af93c20cda549afe
82
+ msgid "**Software for AutoAWQ**:"
83
+ msgstr "**AutoAWQ的软件环境**:"
84
+
85
+ #: ../../source/getting_started/speed_benchmark.md:18
86
+ #: ../../source/getting_started/speed_benchmark.md:28
87
+ #: 14b90e1a69ce40f6a1edc3eb0fbf92b3
88
+ msgid "PyTorch 2.6.0+cu124"
89
+ msgstr ""
90
+
91
+ #: ../../source/getting_started/speed_benchmark.md:20
92
+ #: c8709c79343448838e2e6423ae888b6e
93
+ msgid "AutoAWQ 0.2.9"
94
+ msgstr ""
95
+
96
+ #: ../../source/getting_started/speed_benchmark.md:21
97
+ #: c8bd3eae4c8e497197bd3da6e79ded0a
98
+ msgid "AutoAWQ_kernels 0.0.9"
99
+ msgstr ""
100
+
101
+ #: ../../source/getting_started/speed_benchmark.md:24
102
+ #: cc0dad54e88d4e13857f3a45888b6030
103
+ msgid "SGLang"
104
+ msgstr ""
105
+
106
+ #: ../../source/getting_started/speed_benchmark.md:27
107
+ #: 931979d5babc4459940b65cc29f091b3
108
+ msgid "**Software**:"
109
+ msgstr "**软件环境**:"
110
+
111
+ #: ../../source/getting_started/speed_benchmark.md:30
112
+ #: 23713b47351b4b82949d982019a725b1
113
+ msgid "SGLang 0.4.6.post1"
114
+ msgstr ""
115
+
116
+ #: ../../source/getting_started/speed_benchmark.md:31
117
+ #: 8a1e4b407a5e46748b9fcbd29b7624ef
118
+ msgid "SGL-kernel 0.1.0"
119
+ msgstr ""
120
+
121
+ #: ../../source/getting_started/speed_benchmark.md:32
122
+ #: bc8a5ce98be34cd3987b015f51b607a1
123
+ msgid "vLLM 0.7.2 (Required by SGLang for AWQ quantization)"
124
+ msgstr "vLLM 0.7.2 (被SGLang AWQ量化依赖)"
125
+
126
+ #: ../../source/getting_started/speed_benchmark.md:34
127
+ #: 1b5176a8dd9647738f81c3f726f9e9dd
128
+ msgid "Notes"
129
+ msgstr "备注"
130
+
131
+ #: ../../source/getting_started/speed_benchmark.md:36
132
+ #: 5b67ede5b69845158d7de45576b5f511
133
+ msgid "**Inference Speed (tokens/s)** is calculated as:"
134
+ msgstr "**推理速度(tokens/s)** 的计算公式为:"
135
+
136
+ #: ../../source/getting_started/speed_benchmark.md:38
137
+ #: 8d9cad9e886e4ba09e3a9907eecdc85e
138
+ msgid "\\text{Speed} = \\frac{\\text{tokens}_{\\text{prompt}} + \\text{tokens}_{\\text{generation}}}{\\text{time}}"
139
+ msgstr ""
140
+
141
+ #: ../../source/getting_started/speed_benchmark.md:42
142
+ #: 5e23850b08f54a5b93ca312f77ad16cb
143
+ msgid "We use a **batch size of 1** and the **minimum number of GPUs** possible for evaluation."
144
+ msgstr "batch size 设置为1,使用 GPU 数量尽可能少"
145
+
146
+ #: ../../source/getting_started/speed_benchmark.md:44
147
+ #: 25f5f831928e428a857e76cb66be39dc
148
+ msgid "We test the **speed and memory usage** when generating **2048 tokens**, with input lengths of `1`, `6144`, `14336`, `30720`, `63488`, and `129024` tokens."
149
+ msgstr "我们测试生成2048 tokens时的速度与显存占用,输入长度分别为1、6144、14336、30720、63488、129024 tokens(如受模型支持)。"
150
+
151
+ #: ../../source/getting_started/speed_benchmark.md:47
152
+ #: 11a1e0c5d8ec462987503d3eddf02e93
153
+ msgid "**For SGLang**:"
154
+ msgstr "**对于SGLang**:"
155
+
156
+ #: ../../source/getting_started/speed_benchmark.md:48
157
+ #: 39a19fc71e414215bfefe47fabd4f103
158
+ msgid "**Memory usage** is not reported because SGLang pre-allocates all GPU memory. By default, we set `mem_fraction_static=0.85`."
159
+ msgstr "**内存使用情况**未报告,因为 SGLang 会预先分配所有 GPU 内存。默认情况下,我们设置 `mem_fraction_static=0.85`。"
160
+
161
+ #: ../../source/getting_started/speed_benchmark.md:50
162
+ #: 4dc120620fe04f8d929eb9a49e162384
163
+ msgid "We configure `context_length=140000` and enable `enable_mixed_chunk=True`."
164
+ msgstr "我们配置了 `context_length=140000` 并启用了 `enable_mixed_chunk=True`。"
165
+
166
+ #: ../../source/getting_started/speed_benchmark.md:51
167
+ #: f1912315cef646d885132a95c1bbfe61
168
+ msgid "For **AWQ quantization**, we use the **awq_marlin** backend."
169
+ msgstr "对于 **AWQ 量化**,我们使用 **awq_marlin** 后端。"
170
+
171
+ #: ../../source/getting_started/speed_benchmark.md:52
172
+ #: b71d9ac6ac2a4007b1bf5bcbbcc0a583
173
+ msgid "We set `skip_tokenizer_init=True` and perform generation using `input_ids` instead of raw text prompts."
174
+ msgstr "我们设置 `skip_tokenizer_init=True` 并使用 `input_ids` 进行生成,而不是使用原始文本提示。"
175
+
176
+ #: ../../source/getting_started/speed_benchmark.md:54
177
+ #: 68e13ce181df472fb7ac447baccccd5f
178
+ msgid "**FP8 Performance in Transformers**: The inference speed of Transformers in FP8 mode is currently not optimal and requires further optimization."
179
+ msgstr "**Transformers 中的 FP8 性能**:Transformers 在 FP8 模式下的推理速度目前不够理想,还需要进一步优化。"
180
+
181
+ #: ../../source/getting_started/speed_benchmark.md:56
182
+ #: eba091d7757241eba26249e3b4481358
183
+ msgid "**GPTQ-INT4 Performance in SGLang**: The performance of GPTQ-INT4 in SGLang also needs improvement, and we are actively working with the team to enhance it."
184
+ msgstr "**SGLang 中 GPTQ-INT4 的性能**:SGLang 中 GPTQ-INT4 的性能也需要改进,SGLang团队正提升其表现。"
185
+
186
+ #: ../../source/getting_started/speed_benchmark.md:58
187
+ #: 378478a6059142c4baa00ef74101c7f5
188
+ msgid "Results"
189
+ msgstr "结果"
190
+
191
+ #: ../../source/getting_started/speed_benchmark.md:60
192
+ #: e70ceb3f7c51413a9f385a49a32a5f53
193
+ msgid "Qwen3-0.6B (SGLang)"
194
+ msgstr ""
195
+
196
+ #: ../../source/getting_started/speed_benchmark.md:114
197
+ #: 48d34c54a6f84a679798b6d6e10b9258
198
+ msgid "Qwen3-0.6B (Transformers)"
199
+ msgstr ""
200
+
201
+ #: ../../source/getting_started/speed_benchmark.md:169
202
+ #: 6bbf0e62079c420ea3466b988c613429
203
+ msgid "Qwen3-1.7B (SGLang)"
204
+ msgstr ""
205
+
206
+ #: ../../source/getting_started/speed_benchmark.md:225
207
+ #: d0b2aba9331646b28d3a8b2d75385d6c
208
+ msgid "Qwen3-1.7B (Transformers)"
209
+ msgstr ""
210
+
211
+ #: ../../source/getting_started/speed_benchmark.md:279
212
+ #: 74e433c4044d4a06930966868db14258
213
+ msgid "Qwen3-4B (SGLang)"
214
+ msgstr ""
215
+
216
+ #: ../../source/getting_started/speed_benchmark.md:351
217
+ #: 0fa507ce71d846688e57481c96114d58
218
+ msgid "Qwen3-4B (Transformers)"
219
+ msgstr ""
220
+
221
+ #: ../../source/getting_started/speed_benchmark.md:405
222
+ #: dbffaaf4c5274194a1eb1ff640e86dea
223
+ msgid "Qwen3-8B (SGLang)"
224
+ msgstr ""
225
+
226
+ #: ../../source/getting_started/speed_benchmark.md:478
227
+ #: f3be6cabb6db49769fd4d7f64e16391f
228
+ msgid "Qwen3-8B (Transformers)"
229
+ msgstr ""
230
+
231
+ #: ../../source/getting_started/speed_benchmark.md:533
232
+ #: d08b7dfd146a4853a4d47c8f2a028cc4
233
+ msgid "Qwen3-14B (SGLang)"
234
+ msgstr ""
235
+
236
+ #: ../../source/getting_started/speed_benchmark.md:606
237
+ #: 0fa507ce71d846688e57481c96114d58
238
+ msgid "Qwen3-14B (Transformers)"
239
+ msgstr ""
240
+
241
+ #: ../../source/getting_started/speed_benchmark.md:661
242
+ #: 245c24c8822b4b95aa59bc31d3798e3b
243
+ msgid "Qwen3-32B (SGLang)"
244
+ msgstr ""
245
+
246
+ #: ../../source/getting_started/speed_benchmark.md:735
247
+ #: f3be6cabb6db49769fd4d7f64e16391f
248
+ msgid "Qwen3-32B (Transformers)"
249
+ msgstr ""
250
+
251
+ #: ../../source/getting_started/speed_benchmark.md:789
252
+ #: 35fe65bc8eac4fde92b4614a2875c78d
253
+ msgid "Qwen3-30B-A3B (SGLang)"
254
+ msgstr ""
255
+
256
+ #: ../../source/getting_started/speed_benchmark.md:861
257
+ #: 31c35c93d04143bc9af6b4966beb6d1b
258
+ msgid "Qwen3-30B-A3B (Transformers)"
259
+ msgstr ""
260
+
261
+ #: ../../source/getting_started/speed_benchmark.md:916
262
+ #: c6f3063607fe403284c5aae77059b415
263
+ msgid "Qwen3-235B-A22B (SGLang)"
264
+ msgstr ""
265
+
266
+ #~ msgid "To be updated for Qwen3."
267
+ #~ msgstr "仍需为Qwen3更新。"
268
+
269
+ #~ msgid "The environment of the evaluation with huggingface transformers is:"
270
+ #~ msgstr "测试HuggingFace ``transformers`` 时的环境配置:"
271
+
272
+ #~ msgid "NVIDIA A100 80GB"
273
+ #~ msgstr ""
274
+
275
+ #~ msgid "CUDA 12.1"
276
+ #~ msgstr ""
277
+
278
+ #~ msgid "Pytorch 2.3.1"
279
+ #~ msgstr ""
280
+
281
+ #~ msgid "Flash Attention 2.5.8"
282
+ #~ msgstr ""
283
+
284
+ #~ msgid "Transformers 4.46.0"
285
+ #~ msgstr ""
286
+
287
+ #~ msgid "AutoGPTQ 0.7.1+cu121 (Compiled from source code)"
288
+ #~ msgstr ""
289
+
290
+ #~ msgid "AutoAWQ 0.2.6"
291
+ #~ msgstr ""
292
+
293
+ #~ msgid "The environment of the evaluation with vLLM is:"
294
+ #~ msgstr "测试vLLM时的环境配置:"
295
+
296
+ #~ msgid "vLLM 0.6.3"
297
+ #~ msgstr ""
298
+
299
+ #~ msgid "Pytorch 2.4.0"
300
+ #~ msgstr ""
301
+
302
+ #~ msgid "Flash Attention 2.6.3"
303
+ #~ msgstr ""
304
+
305
+ #~ msgid "For vLLM, the memory usage is not reported because it pre-allocates all GPU memory. We use ``gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False`` by default."
306
+ #~ msgstr "对于vLLM,由于GPU显存预分配,实际显存使用难以评估。默认情况下,统一设定为``gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False``。"
307
+
308
+ #~ msgid "0.5B (Transformer)"
309
+ #~ msgstr ""
310
+
311
+ #~ msgid "Model"
312
+ #~ msgstr "模型"
313
+
314
+ #~ msgid "Input Length"
315
+ #~ msgstr "输入长度"
316
+
317
+ #~ msgid "Quantization"
318
+ #~ msgstr "量化"
319
+
320
+ #~ msgid "GPU Num"
321
+ #~ msgstr "GPU数量"
322
+
323
+ #~ msgid "Speed(tokens/s)"
324
+ #~ msgstr "速度 (tokens/s)"
325
+
326
+ #~ msgid "GPU Memory(GB)"
327
+ #~ msgstr "显存占用 (GB)"
328
+
329
+ #~ msgid "Note"
330
+ #~ msgstr "注意:"
331
+
332
+ #~ msgid "Qwen2.5-0.5B-Instruct"
333
+ #~ msgstr ""
334
+
335
+ #~ msgid "1"
336
+ #~ msgstr ""
337
+
338
+ #~ msgid "BF16"
339
+ #~ msgstr ""
340
+
341
+ #~ msgid "47.40"
342
+ #~ msgstr ""
343
+
344
+ #~ msgid "0.97"
345
+ #~ msgstr ""
346
+
347
+ #~ msgid "GPTQ-Int8"
348
+ #~ msgstr ""
349
+
350
+ #~ msgid "35.17"
351
+ #~ msgstr ""
352
+
353
+ #~ msgid "0.64"
354
+ #~ msgstr ""
355
+
356
+ #~ msgid "auto_gptq==0.6.0+cu1210"
357
+ #~ msgstr ""
358
+
359
+ #~ msgid "GPTQ-Int4"
360
+ #~ msgstr ""
361
+
362
+ #~ msgid "50.60"
363
+ #~ msgstr ""
364
+
365
+ #~ msgid "0.48"
366
+ #~ msgstr ""
367
+
368
+ #~ msgid "AWQ"
369
+ #~ msgstr ""
370
+
371
+ #~ msgid "37.09"
372
+ #~ msgstr ""
373
+
374
+ #~ msgid "0.68"
375
+ #~ msgstr ""
376
+
377
+ #~ msgid "6144"
378
+ #~ msgstr ""
379
+
380
+ #~ msgid "47.45"
381
+ #~ msgstr ""
382
+
383
+ #~ msgid "1.23"
384
+ #~ msgstr ""
385
+
386
+ #~ msgid "36.47"
387
+ #~ msgstr ""
388
+
389
+ #~ msgid "0.90"
390
+ #~ msgstr ""
391
+
392
+ #~ msgid "48.89"
393
+ #~ msgstr ""
394
+
395
+ #~ msgid "0.73"
396
+ #~ msgstr ""
397
+
398
+ #~ msgid "37.04"
399
+ #~ msgstr ""
400
+
401
+ #~ msgid "0.72"
402
+ #~ msgstr ""
403
+
404
+ #~ msgid "14336"
405
+ #~ msgstr ""
406
+
407
+ #~ msgid "47.11"
408
+ #~ msgstr ""
409
+
410
+ #~ msgid "1.60"
411
+ #~ msgstr ""
412
+
413
+ #~ msgid "35.44"
414
+ #~ msgstr ""
415
+
416
+ #~ msgid "1.26"
417
+ #~ msgstr ""
418
+
419
+ #~ msgid "48.26"
420
+ #~ msgstr ""
421
+
422
+ #~ msgid "1.10"
423
+ #~ msgstr ""
424
+
425
+ #~ msgid "37.14"
426
+ #~ msgstr ""
427
+
428
+ #~ msgid "30720"
429
+ #~ msgstr ""
430
+
431
+ #~ msgid "47.16"
432
+ #~ msgstr ""
433
+
434
+ #~ msgid "2.34"
435
+ #~ msgstr ""
436
+
437
+ #~ msgid "36.25"
438
+ #~ msgstr ""
439
+
440
+ #~ msgid "2.01"
441
+ #~ msgstr ""
442
+
443
+ #~ msgid "49.22"
444
+ #~ msgstr ""
445
+
446
+ #~ msgid "1.85"
447
+ #~ msgstr ""
448
+
449
+ #~ msgid "36.90"
450
+ #~ msgstr ""
451
+
452
+ #~ msgid "1.84"
453
+ #~ msgstr ""
454
+
455
+ #~ msgid "0.5B (vLLM)"
456
+ #~ msgstr ""
457
+
458
+ #~ msgid "311.55"
459
+ #~ msgstr ""
460
+
461
+ #~ msgid "257.07"
462
+ #~ msgstr ""
463
+
464
+ #~ msgid "260.93"
465
+ #~ msgstr ""
466
+
467
+ #~ msgid "261.95"
468
+ #~ msgstr ""
469
+
470
+ #~ msgid "304.79"
471
+ #~ msgstr ""
472
+
473
+ #~ msgid "254.10"
474
+ #~ msgstr ""
475
+
476
+ #~ msgid "257.33"
477
+ #~ msgstr ""
478
+
479
+ #~ msgid "259.80"
480
+ #~ msgstr ""
481
+
482
+ #~ msgid "290.28"
483
+ #~ msgstr ""
484
+
485
+ #~ msgid "243.69"
486
+ #~ msgstr ""
487
+
488
+ #~ msgid "247.01"
489
+ #~ msgstr ""
490
+
491
+ #~ msgid "249.58"
492
+ #~ msgstr ""
493
+
494
+ #~ msgid "264.51"
495
+ #~ msgstr ""
496
+
497
+ #~ msgid "223.86"
498
+ #~ msgstr ""
499
+
500
+ #~ msgid "226.50"
501
+ #~ msgstr ""
502
+
503
+ #~ msgid "229.84"
504
+ #~ msgstr ""
505
+
506
+ #~ msgid "1.5B (Transformer)"
507
+ #~ msgstr ""
508
+
509
+ #~ msgid "Qwen2.5-1.5B-Instruct"
510
+ #~ msgstr ""
511
+
512
+ #~ msgid "39.68"
513
+ #~ msgstr ""
514
+
515
+ #~ msgid "2.95"
516
+ #~ msgstr ""
517
+
518
+ #~ msgid "32.62"
519
+ #~ msgstr ""
520
+
521
+ #~ msgid "1.82"
522
+ #~ msgstr ""
523
+
524
+ #~ msgid "43.33"
525
+ #~ msgstr ""
526
+
527
+ #~ msgid "1.18"
528
+ #~ msgstr ""
529
+
530
+ #~ msgid "31.70"
531
+ #~ msgstr ""
532
+
533
+ #~ msgid "1.51"
534
+ #~ msgstr ""
535
+
536
+ #~ msgid "40.88"
537
+ #~ msgstr ""
538
+
539
+ #~ msgid "3.43"
540
+ #~ msgstr ""
541
+
542
+ #~ msgid "31.46"
543
+ #~ msgstr ""
544
+
545
+ #~ msgid "2.30"
546
+ #~ msgstr ""
547
+
548
+ #~ msgid "43.96"
549
+ #~ msgstr ""
550
+
551
+ #~ msgid "1.66"
552
+ #~ msgstr ""
553
+
554
+ #~ msgid "32.30"
555
+ #~ msgstr ""
556
+
557
+ #~ msgid "1.63"
558
+ #~ msgstr ""
559
+
560
+ #~ msgid "40.43"
561
+ #~ msgstr ""
562
+
563
+ #~ msgid "4.16"
564
+ #~ msgstr ""
565
+
566
+ #~ msgid "31.06"
567
+ #~ msgstr ""
568
+
569
+ #~ msgid "3.03"
570
+ #~ msgstr ""
571
+
572
+ #~ msgid "43.66"
573
+ #~ msgstr ""
574
+
575
+ #~ msgid "2.39"
576
+ #~ msgstr ""
577
+
578
+ #~ msgid "32.39"
579
+ #~ msgstr ""
580
+
581
+ #~ msgid "2.36"
582
+ #~ msgstr ""
583
+
584
+ #~ msgid "38.59"
585
+ #~ msgstr ""
586
+
587
+ #~ msgid "5.62"
588
+ #~ msgstr ""
589
+
590
+ #~ msgid "31.04"
591
+ #~ msgstr ""
592
+
593
+ #~ msgid "4.49"
594
+ #~ msgstr ""
595
+
596
+ #~ msgid "35.68"
597
+ #~ msgstr ""
598
+
599
+ #~ msgid "3.85"
600
+ #~ msgstr ""
601
+
602
+ #~ msgid "31.95"
603
+ #~ msgstr ""
604
+
605
+ #~ msgid "3.82"
606
+ #~ msgstr ""
607
+
608
+ #~ msgid "1.5B (vLLM)"
609
+ #~ msgstr ""
610
+
611
+ #~ msgid "183.33"
612
+ #~ msgstr ""
613
+
614
+ #~ msgid "201.67"
615
+ #~ msgstr ""
616
+
617
+ #~ msgid "217.03"
618
+ #~ msgstr ""
619
+
620
+ #~ msgid "213.74"
621
+ #~ msgstr ""
622
+
623
+ #~ msgid "176.68"
624
+ #~ msgstr ""
625
+
626
+ #~ msgid "192.83"
627
+ #~ msgstr ""
628
+
629
+ #~ msgid "206.63"
630
+ #~ msgstr ""
631
+
632
+ #~ msgid "203.64"
633
+ #~ msgstr ""
634
+
635
+ #~ msgid "168.69"
636
+ #~ msgstr ""
637
+
638
+ #~ msgid "183.69"
639
+ #~ msgstr ""
640
+
641
+ #~ msgid "195.88"
642
+ #~ msgstr ""
643
+
644
+ #~ msgid "192.64"
645
+ #~ msgstr ""
646
+
647
+ #~ msgid "152.04"
648
+ #~ msgstr ""
649
+
650
+ #~ msgid "162.82"
651
+ #~ msgstr ""
652
+
653
+ #~ msgid "173.57"
654
+ #~ msgstr ""
655
+
656
+ #~ msgid "170.20"
657
+ #~ msgstr ""
658
+
659
+ #~ msgid "3B (Transformer)"
660
+ #~ msgstr ""
661
+
662
+ #~ msgid "Qwen2.5-3B-Instruct"
663
+ #~ msgstr ""
664
+
665
+ #~ msgid "30.80"
666
+ #~ msgstr ""
667
+
668
+ #~ msgid "5.95"
669
+ #~ msgstr ""
670
+
671
+ #~ msgid "25.69"
672
+ #~ msgstr ""
673
+
674
+ #~ msgid "3.38"
675
+ #~ msgstr ""
676
+
677
+ #~ msgid "35.21"
678
+ #~ msgstr ""
679
+
680
+ #~ msgid "2.06"
681
+ #~ msgstr ""
682
+
683
+ #~ msgid "25.29"
684
+ #~ msgstr ""
685
+
686
+ #~ msgid "2.50"
687
+ #~ msgstr ""
688
+
689
+ #~ msgid "32.20"
690
+ #~ msgstr ""
691
+
692
+ #~ msgid "6.59"
693
+ #~ msgstr ""
694
+
695
+ #~ msgid "24.69"
696
+ #~ msgstr ""
697
+
698
+ #~ msgid "3.98"
699
+ #~ msgstr ""
700
+
701
+ #~ msgid "34.47"
702
+ #~ msgstr ""
703
+
704
+ #~ msgid "2.67"
705
+ #~ msgstr ""
706
+
707
+ #~ msgid "24.86"
708
+ #~ msgstr ""
709
+
710
+ #~ msgid "2.62"
711
+ #~ msgstr ""
712
+
713
+ #~ msgid "31.72"
714
+ #~ msgstr ""
715
+
716
+ #~ msgid "7.47"
717
+ #~ msgstr ""
718
+
719
+ #~ msgid "24.70"
720
+ #~ msgstr ""
721
+
722
+ #~ msgid "4.89"
723
+ #~ msgstr ""
724
+
725
+ #~ msgid "34.36"
726
+ #~ msgstr ""
727
+
728
+ #~ msgid "3.58"
729
+ #~ msgstr ""
730
+
731
+ #~ msgid "25.19"
732
+ #~ msgstr ""
733
+
734
+ #~ msgid "3.54"
735
+ #~ msgstr ""
736
+
737
+ #~ msgid "25.37"
738
+ #~ msgstr ""
739
+
740
+ #~ msgid "9.30"
741
+ #~ msgstr ""
742
+
743
+ #~ msgid "21.67"
744
+ #~ msgstr ""
745
+
746
+ #~ msgid "6.72"
747
+ #~ msgstr ""
748
+
749
+ #~ msgid "23.60"
750
+ #~ msgstr ""
751
+
752
+ #~ msgid "5.41"
753
+ #~ msgstr ""
754
+
755
+ #~ msgid "24.56"
756
+ #~ msgstr ""
757
+
758
+ #~ msgid "5.37"
759
+ #~ msgstr ""
760
+
761
+ #~ msgid "3B (vLLM)"
762
+ #~ msgstr ""
763
+
764
+ #~ msgid "127.61"
765
+ #~ msgstr ""
766
+
767
+ #~ msgid "150.02"
768
+ #~ msgstr ""
769
+
770
+ #~ msgid "168.20"
771
+ #~ msgstr ""
772
+
773
+ #~ msgid "165.50"
774
+ #~ msgstr ""
775
+
776
+ #~ msgid "123.15"
777
+ #~ msgstr ""
778
+
779
+ #~ msgid "143.09"
780
+ #~ msgstr ""
781
+
782
+ #~ msgid "159.85"
783
+ #~ msgstr ""
784
+
785
+ #~ msgid "156.38"
786
+ #~ msgstr ""
787
+
788
+ #~ msgid "117.35"
789
+ #~ msgstr ""
790
+
791
+ #~ msgid "135.50"
792
+ #~ msgstr ""
793
+
794
+ #~ msgid "149.35"
795
+ #~ msgstr ""
796
+
797
+ #~ msgid "147.75"
798
+ #~ msgstr ""
799
+
800
+ #~ msgid "105.88"
801
+ #~ msgstr ""
802
+
803
+ #~ msgid "118.38"
804
+ #~ msgstr ""
805
+
806
+ #~ msgid "129.28"
807
+ #~ msgstr ""
808
+
809
+ #~ msgid "127.19"
810
+ #~ msgstr ""
811
+
812
+ #~ msgid "7B (Transformer)"
813
+ #~ msgstr ""
814
+
815
+ #~ msgid "Qwen2.5-7B-Instruct"
816
+ #~ msgstr ""
817
+
818
+ #~ msgid "40.38"
819
+ #~ msgstr ""
820
+
821
+ #~ msgid "14.38"
822
+ #~ msgstr ""
823
+
824
+ #~ msgid "31.55"
825
+ #~ msgstr ""
826
+
827
+ #~ msgid "8.42"
828
+ #~ msgstr ""
829
+
830
+ #~ msgid "43.10"
831
+ #~ msgstr ""
832
+
833
+ #~ msgid "5.52"
834
+ #~ msgstr ""
835
+
836
+ #~ msgid "32.03"
837
+ #~ msgstr ""
838
+
839
+ #~ msgid "5.39"
840
+ #~ msgstr ""
841
+
842
+ #~ msgid "38.76"
843
+ #~ msgstr ""
844
+
845
+ #~ msgid "15.38"
846
+ #~ msgstr ""
847
+
848
+ #~ msgid "31.26"
849
+ #~ msgstr ""
850
+
851
+ #~ msgid "9.43"
852
+ #~ msgstr ""
853
+
854
+ #~ msgid "38.27"
855
+ #~ msgstr ""
856
+
857
+ #~ msgid "6.52"
858
+ #~ msgstr ""
859
+
860
+ #~ msgid "32.37"
861
+ #~ msgstr ""
862
+
863
+ #~ msgid "6.39"
864
+ #~ msgstr ""
865
+
866
+ #~ msgid "29.78"
867
+ #~ msgstr ""
868
+
869
+ #~ msgid "16.91"
870
+ #~ msgstr ""
871
+
872
+ #~ msgid "26.86"
873
+ #~ msgstr ""
874
+
875
+ #~ msgid "10.96"
876
+ #~ msgstr ""
877
+
878
+ #~ msgid "28.70"
879
+ #~ msgstr ""
880
+
881
+ #~ msgid "8.05"
882
+ #~ msgstr ""
883
+
884
+ #~ msgid "30.23"
885
+ #~ msgstr ""
886
+
887
+ #~ msgid "7.92"
888
+ #~ msgstr ""
889
+
890
+ #~ msgid "18.83"
891
+ #~ msgstr ""
892
+
893
+ #~ msgid "19.97"
894
+ #~ msgstr ""
895
+
896
+ #~ msgid "17.59"
897
+ #~ msgstr ""
898
+
899
+ #~ msgid "14.01"
900
+ #~ msgstr ""
901
+
902
+ #~ msgid "18.45"
903
+ #~ msgstr ""
904
+
905
+ #~ msgid "11.11"
906
+ #~ msgstr ""
907
+
908
+ #~ msgid "19.11"
909
+ #~ msgstr ""
910
+
911
+ #~ msgid "10.98"
912
+ #~ msgstr ""
913
+
914
+ #~ msgid "7B (vLLM)"
915
+ #~ msgstr ""
916
+
917
+ #~ msgid "84.28"
918
+ #~ msgstr ""
919
+
920
+ #~ msgid "122.01"
921
+ #~ msgstr ""
922
+
923
+ #~ msgid "154.05"
924
+ #~ msgstr ""
925
+
926
+ #~ msgid "148.10"
927
+ #~ msgstr ""
928
+
929
+ #~ msgid "80.70"
930
+ #~ msgstr ""
931
+
932
+ #~ msgid "112.38"
933
+ #~ msgstr ""
934
+
935
+ #~ msgid "141.98"
936
+ #~ msgstr ""
937
+
938
+ #~ msgid "137.64"
939
+ #~ msgstr ""
940
+
941
+ #~ msgid "77.69"
942
+ #~ msgstr ""
943
+
944
+ #~ msgid "105.25"
945
+ #~ msgstr ""
946
+
947
+ #~ msgid "129.35"
948
+ #~ msgstr ""
949
+
950
+ #~ msgid "124.91"
951
+ #~ msgstr ""
952
+
953
+ #~ msgid "70.33"
954
+ #~ msgstr ""
955
+
956
+ #~ msgid "90.71"
957
+ #~ msgstr ""
958
+
959
+ #~ msgid "108.30"
960
+ #~ msgstr ""
961
+
962
+ #~ msgid "104.66"
963
+ #~ msgstr ""
964
+
965
+ #~ msgid "63488"
966
+ #~ msgstr ""
967
+
968
+ #~ msgid "50.86"
969
+ #~ msgstr ""
970
+
971
+ #~ msgid "setting-64k"
972
+ #~ msgstr "[设定3]"
973
+
974
+ #~ msgid "60.52"
975
+ #~ msgstr ""
976
+
977
+ #~ msgid "67.97"
978
+ #~ msgstr ""
979
+
980
+ #~ msgid "66.42"
981
+ #~ msgstr ""
982
+
983
+ #~ msgid "129024"
984
+ #~ msgstr ""
985
+
986
+ #~ msgid "28.94"
987
+ #~ msgstr ""
988
+
989
+ #~ msgid "vllm==0.6.2, new sample config"
990
+ #~ msgstr ""
991
+
992
+ #~ msgid "25.97"
993
+ #~ msgstr ""
994
+
995
+ #~ msgid "26.37"
996
+ #~ msgstr ""
997
+
998
+ #~ msgid "26.57"
999
+ #~ msgstr ""
1000
+
1001
+ #~ msgid "[Setting-64k]=(gpu_memory_utilization=0.9 max_model_len=65536 enforce_eager=False)"
1002
+ #~ msgstr "[默认设定]=(gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False)"
1003
+
1004
+ #~ msgid "[new sample config]: for vLLM, set the following sampling parameters: SamplingParams(temperature=0.7,top_p=0.8,top_k=20,repetition_penalty=1,presence_penalty=0,frequency_penalty=0,max_tokens=out_length)"
1005
+ #~ msgstr ""
1006
+
1007
+ #~ msgid "14B (Transformer)"
1008
+ #~ msgstr ""
1009
+
1010
+ #~ msgid "Qwen2.5-14B-Instruct"
1011
+ #~ msgstr ""
1012
+
1013
+ #~ msgid "24.74"
1014
+ #~ msgstr ""
1015
+
1016
+ #~ msgid "28.08"
1017
+ #~ msgstr ""
1018
+
1019
+ #~ msgid "18.84"
1020
+ #~ msgstr ""
1021
+
1022
+ #~ msgid "16.11"
1023
+ #~ msgstr ""
1024
+
1025
+ #~ msgid "25.89"
1026
+ #~ msgstr ""
1027
+
1028
+ #~ msgid "9.94"
1029
+ #~ msgstr ""
1030
+
1031
+ #~ msgid "19.23"
1032
+ #~ msgstr ""
1033
+
1034
+ #~ msgid "9.79"
1035
+ #~ msgstr ""
1036
+
1037
+ #~ msgid "20.51"
1038
+ #~ msgstr ""
1039
+
1040
+ #~ msgid "29.50"
1041
+ #~ msgstr ""
1042
+
1043
+ #~ msgid "17.80"
1044
+ #~ msgstr ""
1045
+
1046
+ #~ msgid "17.61"
1047
+ #~ msgstr ""
1048
+
1049
+ #~ msgid "20.06"
1050
+ #~ msgstr ""
1051
+
1052
+ #~ msgid "11.36"
1053
+ #~ msgstr ""
1054
+
1055
+ #~ msgid "19.21"
1056
+ #~ msgstr ""
1057
+
1058
+ #~ msgid "11.22"
1059
+ #~ msgstr ""
1060
+
1061
+ #~ msgid "13.92"
1062
+ #~ msgstr ""
1063
+
1064
+ #~ msgid "12.66"
1065
+ #~ msgstr ""
1066
+
1067
+ #~ msgid "19.98"
1068
+ #~ msgstr ""
1069
+
1070
+ #~ msgid "13.79"
1071
+ #~ msgstr ""
1072
+
1073
+ #~ msgid "13.81"
1074
+ #~ msgstr ""
1075
+
1076
+ #~ msgid "14.17"
1077
+ #~ msgstr ""
1078
+
1079
+ #~ msgid "13.67"
1080
+ #~ msgstr ""
1081
+
1082
+ #~ msgid "8.20"
1083
+ #~ msgstr ""
1084
+
1085
+ #~ msgid "36.85"
1086
+ #~ msgstr ""
1087
+
1088
+ #~ msgid "7.77"
1089
+ #~ msgstr ""
1090
+
1091
+ #~ msgid "24.88"
1092
+ #~ msgstr ""
1093
+
1094
+ #~ msgid "8.14"
1095
+ #~ msgstr ""
1096
+
1097
+ #~ msgid "18.71"
1098
+ #~ msgstr ""
1099
+
1100
+ #~ msgid "8.31"
1101
+ #~ msgstr ""
1102
+
1103
+ #~ msgid "18.57"
1104
+ #~ msgstr ""
1105
+
1106
+ #~ msgid "14B (vLLM)"
1107
+ #~ msgstr ""
1108
+
1109
+ #~ msgid "46.30"
1110
+ #~ msgstr ""
1111
+
1112
+ #~ msgid "70.40"
1113
+ #~ msgstr ""
1114
+
1115
+ #~ msgid "98.02"
1116
+ #~ msgstr ""
1117
+
1118
+ #~ msgid "92.66"
1119
+ #~ msgstr ""
1120
+
1121
+ #~ msgid "43.83"
1122
+ #~ msgstr ""
1123
+
1124
+ #~ msgid "64.33"
1125
+ #~ msgstr ""
1126
+
1127
+ #~ msgid "86.10"
1128
+ #~ msgstr ""
1129
+
1130
+ #~ msgid "83.11"
1131
+ #~ msgstr ""
1132
+
1133
+ #~ msgid "41.91"
1134
+ #~ msgstr ""
1135
+
1136
+ #~ msgid "59.21"
1137
+ #~ msgstr ""
1138
+
1139
+ #~ msgid "76.85"
1140
+ #~ msgstr ""
1141
+
1142
+ #~ msgid "74.03"
1143
+ #~ msgstr ""
1144
+
1145
+ #~ msgid "37.18"
1146
+ #~ msgstr ""
1147
+
1148
+ #~ msgid "49.23"
1149
+ #~ msgstr ""
1150
+
1151
+ #~ msgid "60.91"
1152
+ #~ msgstr ""
1153
+
1154
+ #~ msgid "59.01"
1155
+ #~ msgstr ""
1156
+
1157
+ #~ msgid "26.85"
1158
+ #~ msgstr ""
1159
+
1160
+ #~ msgid "32.83"
1161
+ #~ msgstr ""
1162
+
1163
+ #~ msgid "37.67"
1164
+ #~ msgstr ""
1165
+
1166
+ #~ msgid "36.71"
1167
+ #~ msgstr ""
1168
+
1169
+ #~ msgid "14.53"
1170
+ #~ msgstr ""
1171
+
1172
+ #~ msgid "15.10"
1173
+ #~ msgstr ""
1174
+
1175
+ #~ msgid "15.13"
1176
+ #~ msgstr ""
1177
+
1178
+ #~ msgid "15.25"
1179
+ #~ msgstr ""
1180
+
1181
+ #~ msgid "32B (Transformer)"
1182
+ #~ msgstr ""
1183
+
1184
+ #~ msgid "Qwen2.5-32B-Instruct"
1185
+ #~ msgstr ""
1186
+
1187
+ #~ msgid "17.54"
1188
+ #~ msgstr ""
1189
+
1190
+ #~ msgid "61.58"
1191
+ #~ msgstr ""
1192
+
1193
+ #~ msgid "14.52"
1194
+ #~ msgstr ""
1195
+
1196
+ #~ msgid "33.56"
1197
+ #~ msgstr ""
1198
+
1199
+ #~ msgid "19.20"
1200
+ #~ msgstr ""
1201
+
1202
+ #~ msgid "18.94"
1203
+ #~ msgstr ""
1204
+
1205
+ #~ msgid "14.60"
1206
+ #~ msgstr ""
1207
+
1208
+ #~ msgid "18.67"
1209
+ #~ msgstr ""
1210
+
1211
+ #~ msgid "12.49"
1212
+ #~ msgstr ""
1213
+
1214
+ #~ msgid "63.72"
1215
+ #~ msgstr ""
1216
+
1217
+ #~ msgid "11.61"
1218
+ #~ msgstr ""
1219
+
1220
+ #~ msgid "35.86"
1221
+ #~ msgstr ""
1222
+
1223
+ #~ msgid "13.42"
1224
+ #~ msgstr ""
1225
+
1226
+ #~ msgid "21.09"
1227
+ #~ msgstr ""
1228
+
1229
+ #~ msgid "20.81"
1230
+ #~ msgstr ""
1231
+
1232
+ #~ msgid "8.95"
1233
+ #~ msgstr ""
1234
+
1235
+ #~ msgid "67.31"
1236
+ #~ msgstr ""
1237
+
1238
+ #~ msgid "8.53"
1239
+ #~ msgstr ""
1240
+
1241
+ #~ msgid "39.28"
1242
+ #~ msgstr ""
1243
+
1244
+ #~ msgid "9.48"
1245
+ #~ msgstr ""
1246
+
1247
+ #~ msgid "24.67"
1248
+ #~ msgstr ""
1249
+
1250
+ #~ msgid "9.71"
1251
+ #~ msgstr ""
1252
+
1253
+ #~ msgid "24.39"
1254
+ #~ msgstr ""
1255
+
1256
+ #~ msgid "5.59"
1257
+ #~ msgstr ""
1258
+
1259
+ #~ msgid "74.47"
1260
+ #~ msgstr ""
1261
+
1262
+ #~ msgid "5.42"
1263
+ #~ msgstr ""
1264
+
1265
+ #~ msgid "46.45"
1266
+ #~ msgstr ""
1267
+
1268
+ #~ msgid "5.79"
1269
+ #~ msgstr ""
1270
+
1271
+ #~ msgid "31.84"
1272
+ #~ msgstr ""
1273
+
1274
+ #~ msgid "5.85"
1275
+ #~ msgstr ""
1276
+
1277
+ #~ msgid "31.56"
1278
+ #~ msgstr ""
1279
+
1280
+ #~ msgid "32B (vLLM)"
1281
+ #~ msgstr ""
1282
+
1283
+ #~ msgid "22.13"
1284
+ #~ msgstr ""
1285
+
1286
+ #~ msgid "setting1"
1287
+ #~ msgstr "[设定3]"
1288
+
1289
+ #~ msgid "37.57"
1290
+ #~ msgstr ""
1291
+
1292
+ #~ msgid "55.83"
1293
+ #~ msgstr ""
1294
+
1295
+ #~ msgid "51.92"
1296
+ #~ msgstr ""
1297
+
1298
+ #~ msgid "21.05"
1299
+ #~ msgstr ""
1300
+
1301
+ #~ msgid "34.67"
1302
+ #~ msgstr ""
1303
+
1304
+ #~ msgid "49.96"
1305
+ #~ msgstr ""
1306
+
1307
+ #~ msgid "46.68"
1308
+ #~ msgstr ""
1309
+
1310
+ #~ msgid "19.91"
1311
+ #~ msgstr ""
1312
+
1313
+ #~ msgid "31.89"
1314
+ #~ msgstr ""
1315
+
1316
+ #~ msgid "44.79"
1317
+ #~ msgstr ""
1318
+
1319
+ #~ msgid "41.83"
1320
+ #~ msgstr ""
1321
+
1322
+ #~ msgid "2"
1323
+ #~ msgstr ""
1324
+
1325
+ #~ msgid "31.82"
1326
+ #~ msgstr ""
1327
+
1328
+ #~ msgid "26.88"
1329
+ #~ msgstr ""
1330
+
1331
+ #~ msgid "35.66"
1332
+ #~ msgstr ""
1333
+
1334
+ #~ msgid "33.75"
1335
+ #~ msgstr ""
1336
+
1337
+ #~ msgid "24.45"
1338
+ #~ msgstr ""
1339
+
1340
+ #~ msgid "18.60"
1341
+ #~ msgstr ""
1342
+
1343
+ #~ msgid "22.72"
1344
+ #~ msgstr ""
1345
+
1346
+ #~ msgid "21.79"
1347
+ #~ msgstr ""
1348
+
1349
+ #~ msgid "14.31"
1350
+ #~ msgstr ""
1351
+
1352
+ #~ msgid "9.77"
1353
+ #~ msgstr ""
1354
+
1355
+ #~ msgid "10.39"
1356
+ #~ msgstr ""
1357
+
1358
+ #~ msgid "10.34"
1359
+ #~ msgstr ""
1360
+
1361
+ #~ msgid "For context length 129024, the model needs to be predicted with the following config: \"model_max_length\"=131072"
1362
+ #~ msgstr ""
1363
+
1364
+ #~ msgid "[Default Setting]=(gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False)"
1365
+ #~ msgstr "[默认设定]=(gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False)"
1366
+
1367
+ #~ msgid "[Setting 1]=(gpu_memory_utilization=1.0 max_model_len=32768 enforce_eager=True)"
1368
+ #~ msgstr "[设定 3]=(gpu_memory_utilization=1.0 max_model_len=8192 enforce_eager=True)"
1369
+
1370
+ #~ msgid "72B (Transformer)"
1371
+ #~ msgstr ""
1372
+
1373
+ #~ msgid "Qwen2.5-72B-Instruct"
1374
+ #~ msgstr ""
1375
+
1376
+ #~ msgid "8.73"
1377
+ #~ msgstr ""
1378
+
1379
+ #~ msgid "136.20"
1380
+ #~ msgstr ""
1381
+
1382
+ #~ msgid "8.66"
1383
+ #~ msgstr ""
1384
+
1385
+ #~ msgid "72.61"
1386
+ #~ msgstr ""
1387
+
1388
+ #~ msgid "11.07"
1389
+ #~ msgstr ""
1390
+
1391
+ #~ msgid "39.91"
1392
+ #~ msgstr ""
1393
+
1394
+ #~ msgid "11.50"
1395
+ #~ msgstr ""
1396
+
1397
+ #~ msgid "39.44"
1398
+ #~ msgstr ""
1399
+
1400
+ #~ msgid "140.00"
1401
+ #~ msgstr ""
1402
+
1403
+ #~ msgid "77.81"
1404
+ #~ msgstr ""
1405
+
1406
+ #~ msgid "7.56"
1407
+ #~ msgstr ""
1408
+
1409
+ #~ msgid "42.50"
1410
+ #~ msgstr ""
1411
+
1412
+ #~ msgid "8.17"
1413
+ #~ msgstr ""
1414
+
1415
+ #~ msgid "42.13"
1416
+ #~ msgstr ""
1417
+
1418
+ #~ msgid "3"
1419
+ #~ msgstr ""
1420
+
1421
+ #~ msgid "4.25"
1422
+ #~ msgstr ""
1423
+
1424
+ #~ msgid "149.14"
1425
+ #~ msgstr ""
1426
+
1427
+ #~ msgid "4.66"
1428
+ #~ msgstr ""
1429
+
1430
+ #~ msgid "82.55"
1431
+ #~ msgstr ""
1432
+
1433
+ #~ msgid "5.27"
1434
+ #~ msgstr ""
1435
+
1436
+ #~ msgid "46.86"
1437
+ #~ msgstr ""
1438
+
1439
+ #~ msgid "5.57"
1440
+ #~ msgstr ""
1441
+
1442
+ #~ msgid "46.38"
1443
+ #~ msgstr ""
1444
+
1445
+ #~ msgid "2.94"
1446
+ #~ msgstr ""
1447
+
1448
+ #~ msgid "164.79"
1449
+ #~ msgstr ""
1450
+
1451
+ #~ msgid "94.75"
1452
+ #~ msgstr ""
1453
+
1454
+ #~ msgid "3.14"
1455
+ #~ msgstr ""
1456
+
1457
+ #~ msgid "62.57"
1458
+ #~ msgstr ""
1459
+
1460
+ #~ msgid "3.23"
1461
+ #~ msgstr ""
1462
+
1463
+ #~ msgid "61.64"
1464
+ #~ msgstr ""
1465
+
1466
+ #~ msgid "72B (vLLM)"
1467
+ #~ msgstr ""
1468
+
1469
+ #~ msgid "18.19"
1470
+ #~ msgstr ""
1471
+
1472
+ #~ msgid "Setting 1"
1473
+ #~ msgstr "[设定3]"
1474
+
1475
+ #~ msgid "4"
1476
+ #~ msgstr ""
1477
+
1478
+ #~ msgid "31.37"
1479
+ #~ msgstr ""
1480
+
1481
+ #~ msgid "Default"
1482
+ #~ msgstr ""
1483
+
1484
+ #~ msgid "31.40"
1485
+ #~ msgstr ""
1486
+
1487
+ #~ msgid "16.47"
1488
+ #~ msgstr ""
1489
+
1490
+ #~ msgid "Setting 2"
1491
+ #~ msgstr "[设定2]"
1492
+
1493
+ #~ msgid "44.30"
1494
+ #~ msgstr ""
1495
+
1496
+ #~ msgid "29.90"
1497
+ #~ msgstr ""
1498
+
1499
+ #~ msgid "29.37"
1500
+ #~ msgstr ""
1501
+
1502
+ #~ msgid "13.88"
1503
+ #~ msgstr ""
1504
+
1505
+ #~ msgid "Setting 3"
1506
+ #~ msgstr "[设定3]"
1507
+
1508
+ #~ msgid "40.67"
1509
+ #~ msgstr ""
1510
+
1511
+ #~ msgid "30.10"
1512
+ #~ msgstr ""
1513
+
1514
+ #~ msgid "27.20"
1515
+ #~ msgstr ""
1516
+
1517
+ #~ msgid "38.10"
1518
+ #~ msgstr ""
1519
+
1520
+ #~ msgid "36.63"
1521
+ #~ msgstr ""
1522
+
1523
+ #~ msgid "27.53"
1524
+ #~ msgstr ""
1525
+
1526
+ #~ msgid "23.32"
1527
+ #~ msgstr ""
1528
+
1529
+ #~ msgid "30.98"
1530
+ #~ msgstr ""
1531
+
1532
+ #~ msgid "30.02"
1533
+ #~ msgstr ""
1534
+
1535
+ #~ msgid "20.74"
1536
+ #~ msgstr ""
1537
+
1538
+ #~ msgid "Setting 4"
1539
+ #~ msgstr "[设定3]"
1540
+
1541
+ #~ msgid "16.27"
1542
+ #~ msgstr ""
1543
+
1544
+ #~ msgid "19.84"
1545
+ #~ msgstr ""
1546
+
1547
+ #~ msgid "19.32"
1548
+ #~ msgstr ""
1549
+
1550
+ #~ msgid "12.68"
1551
+ #~ msgstr ""
1552
+
1553
+ #~ msgid "Setting 5"
1554
+ #~ msgstr "[设定3]"
1555
+
1556
+ #~ msgid "14.11"
1557
+ #~ msgstr ""
1558
+
1559
+ #~ msgid "10.11"
1560
+ #~ msgstr ""
1561
+
1562
+ #~ msgid "9.88"
1563
+ #~ msgstr ""
1564
+
1565
+ #~ msgid "[Setting 1]=(gpu_memory_utilization=0.98 max_model_len=4096 enforce_eager=True)"
1566
+ #~ msgstr "[设定 1]=(gpu_memory_utilization=0.98 max_model_len=4096 enforce_eager=True)"
1567
+
1568
+ #~ msgid "[Setting 2]=(gpu_memory_utilization=1.0 max_model_len=4096 enforce_eager=True)"
1569
+ #~ msgstr "[设定 2]=(gpu_memory_utilization=1.0 max_model_len=4096 enforce_eager=True)"
1570
+
1571
+ #~ msgid "[Setting 3]=(gpu_memory_utilization=1.0 max_model_len=8192 enforce_eager=True)"
1572
+ #~ msgstr "[设定 3]=(gpu_memory_utilization=1.0 max_model_len=8192 enforce_eager=True)"
1573
+
1574
+ #~ msgid "[Setting 4]=(gpu_memory_utilization=0.9 max_model_len=65536 enforce_eager=False)"
1575
+ #~ msgstr "[默认设定]=(gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False)"
1576
+
1577
+ #~ msgid "[Setting 5]=(gpu_memory_utilization=0.9 max_model_len=131072 enforce_eager=False)"
1578
+ #~ msgstr "[默认设定]=(gpu_memory_utilization=0.9 max_model_len=32768 enforce_eager=False)"
1579
+
docs/locales/zh_CN/LC_MESSAGES/getting_started/thinking_budget.po ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-06-13 16:36+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.16.0\n"
21
+
22
+ #: ../../source/getting_started/thinking_budget.md:1
23
+ #: 98870c0bf86c4c3b832204258d05c95c
24
+ msgid "Thinking budget"
25
+ msgstr ""
26
+
27
+ #: ../../source/getting_started/thinking_budget.md:3
28
+ #: f3ac8e3721084db486cd5c8f99c40e68
29
+ msgid "This example demonstrates the inference process with thinking budgets using Qwen3 series models. The process involves two steps:"
30
+ msgstr ""
31
+
32
+ #: ../../source/getting_started/thinking_budget.md:4
33
+ #: 9e573494a6294fe4b33fb9e20d2648a0
34
+ msgid "the model generates reasoning content within the specified thinking budget"
35
+ msgstr ""
36
+
37
+ #: ../../source/getting_started/thinking_budget.md:5
38
+ #: 873d4d7b33e54257b32096a23f5bfbac
39
+ msgid "append the reasoning content to the conversation context and call the model again to get the final response"
40
+ msgstr ""
41
+
42
+ #: ../../source/getting_started/thinking_budget.md:7
43
+ #: 3284c7a085b04934aaa32317c5c1a9b7
44
+ msgid "Environment Setup"
45
+ msgstr ""
46
+
47
+ #: ../../source/getting_started/thinking_budget.md:9
48
+ #: 0c8eee4d2e06463ab03c7f8330a8ffd0
49
+ msgid "`transformers >= 4.51.0`"
50
+ msgstr ""
51
+
52
+ #: ../../source/getting_started/thinking_budget.md:10
53
+ #: 1bb85d8dbe9f40d9a9f6da43ea92bc19
54
+ msgid "`openai >= 1.65.0`"
55
+ msgstr ""
56
+
57
+ #: ../../source/getting_started/thinking_budget.md:12
58
+ #: 1fbbb06af9474e30a50db81b4733f931
59
+ msgid "Basic Usage"
60
+ msgstr ""
61
+
62
+ #: ../../source/getting_started/thinking_budget.md:14
63
+ #: b365e4aac4c047378fd3b09771987379
64
+ msgid "First, you should start a Qwen3 model in thinking mode. You can refer to [Quickstart](https://github.com/QwenLM/Qwen3/blob/main/docs/source/getting_started/quickstart.md) for more details."
65
+ msgstr ""
66
+
67
+ #: ../../source/getting_started/thinking_budget.md:16
68
+ #: 259a5805d2e3483aa6f4d056b7c9ce94
69
+ msgid "Then, you can use the following code to call the model with thinking budgets."
70
+ msgstr ""
71
+
docs/locales/zh_CN/LC_MESSAGES/index.po ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.17.0\n"
18
+
19
+ #: ../../Qwen/source/index.rst:34
20
+ msgid "Getting Started"
21
+ msgstr "快速开始"
22
+
23
+ #: ../../Qwen/source/index.rst:44
24
+ msgid "Inference"
25
+ msgstr "推理"
26
+
27
+ #: ../../Qwen/source/index.rst:51
28
+ msgid "Run Locally"
29
+ msgstr "本地运行"
30
+
31
+ #: ../../Qwen/source/index.rst:60
32
+ msgid "Deployment"
33
+ msgstr "部署"
34
+
35
+ #: ../../Qwen/source/index.rst:71
36
+ msgid "Quantization"
37
+ msgstr "量化"
38
+
39
+ #: ../../Qwen/source/index.rst:80
40
+ msgid "Training"
41
+ msgstr "训练"
42
+
43
+ #: ../../Qwen/source/index.rst:87
44
+ msgid "Framework"
45
+ msgstr "框架"
46
+
47
+ #: ../../Qwen/source/index.rst:2 6e52d3a497924f828d4c6b9dd59370d5
48
+ msgid "Welcome to Qwen!"
49
+ msgstr "欢迎来到Qwen"
50
+
51
+ #: ../../Qwen/source/index.rst:4 235805a6d4a34184821c0f4f81020ef1
52
+ msgid "Qwen3"
53
+ msgstr ""
54
+
55
+ #: ../../Qwen/source/index.rst:11 b8a3aa3f31594232959a08d89e9dc7db
56
+ msgid "Qwen is the large language model and large multimodal model series of the Qwen Team, Alibaba Group. Both language models and multimodal models are pretrained on large-scale multilingual and multimodal data and post-trained on quality data for aligning to human preferences. Qwen is capable of natural language understanding, text generation, vision understanding, audio understanding, tool use, role play, playing as AI agent, etc."
57
+ msgstr "Qwen是阿里巴巴集团Qwen团队研发的大语言模型和大型多模态模型系列。无论是语言模型还是多模态模型,均在大规模多语言和多模态数据上进行预训练,并通过高质量数据进行后期微调以贴近人类偏好。Qwen具备自然语言理解、文本生成、视觉理解、音频理解、工具使用、角色扮演、作为AI Agent进行互动等多种能力。"
58
+
59
+ #: ../../Qwen/source/index.rst:14 8735c67355064a97b2793b721a701b21
60
+ msgid "The latest version, Qwen3, has the following features:"
61
+ msgstr "最新版本Qwen3有以下特点:"
62
+
63
+ #: ../../Qwen/source/index.rst:16 1956d75084244379aad9503fcc572f00
64
+ msgid "**Dense and Mixture-of-Experts (MoE) models**, available in 0.6B, 1.7B, 4B, 8B, 14B, 32B and 30B-A3B, 235B-A22B."
65
+ msgstr "**全尺寸稠密与混合专家模型**:0.6B, 1.7B, 4B, 8B, 14B, 32B and 30B-A3B, 235B-A22B"
66
+
67
+ #: ../../Qwen/source/index.rst:17 1fdf12161cd14663b67b2c08f9219ddb
68
+ msgid "**Seamless switching between thinking mode** (for complex logical reasoning, math, and coding) and **non-thinking mode** (for efficient, general-purpose chat) **within a single model**, ensuring optimal performance across various scenarios."
69
+ msgstr "支持在**思考模式**(用于复杂逻辑推理、数学和编码)和 **非思考模式** (用于高效通用对话)之间**无缝切换**,确保在各种场景下的最佳性能。"
70
+
71
+ #: ../../Qwen/source/index.rst:18 189ff2a03ad249ef88202c34e9f8aa86
72
+ msgid "**Significantly enhancement in reasoning capabilities**, surpassing previous QwQ (in thinking mode) and Qwen2.5 instruct models (in non-thinking mode) on mathematics, code generation, and commonsense logical reasoning."
73
+ msgstr "**显著增强的推理能力**,在数学、代码生成和常识逻辑推理方面超越了之前的 QwQ(在思考模式下)和 Qwen2.5 指令模型(在非思考模式下)。"
74
+
75
+ #: ../../Qwen/source/index.rst:19 64ebcda0381148cb8edf8d92b49469ea
76
+ msgid "**Superior human preference alignment**, excelling in creative writing, role-playing, multi-turn dialogues, and instruction following, to deliver a more natural, engaging, and immersive conversational experience."
77
+ msgstr "**卓越的人类偏好对齐**,在创意写作、角色扮演、多轮对话和指令跟随方面表现出色,提供更自然、更吸引人和更具沉浸感的对话体验。"
78
+
79
+ #: ../../Qwen/source/index.rst:20 ec0ebb91f1ed491f8672aefef6307d85
80
+ msgid "**Expertise in agent capabilities**, enabling precise integration with external tools in both thinking and unthinking modes and achieving leading performance among open-source models in complex agent-based tasks."
81
+ msgstr "**擅长智能体能力**,可以在思考和非思考模式下精确集成外部工具,在复杂的基于代理的任务中在开源模型中表现领先。"
82
+
83
+ #: ../../Qwen/source/index.rst:21 526b161edf284e1b913aabc7e7fcc77c
84
+ msgid "**Support of 100+ languages and dialects** with strong capabilities for **multilingual instruction following** and **translation**."
85
+ msgstr "**支持 100 多种语言和方言**,具有强大的多语言理解、推理、指令跟随和生成能力。"
86
+
87
+ #: ../../Qwen/source/index.rst:23 79ed3f0e7da043bb8b53f510ed244814
88
+ msgid "For more information, please visit our:"
89
+ msgstr "想了解更多信息,欢迎访问:"
90
+
91
+ #: ../../Qwen/source/index.rst:25 b2e579ae57de4d2985ab1c350fdf2458
92
+ msgid "`Blog <https://qwenlm.github.io/>`__"
93
+ msgstr "`博客 <https://qwenlm.github.io/>`__"
94
+
95
+ #: ../../Qwen/source/index.rst:26 406389fe90064e879bd28665a021ee7e
96
+ msgid "`GitHub <https://github.com/QwenLM>`__"
97
+ msgstr "`GitHub <https://github.com/QwenLM>`__"
98
+
99
+ #: ../../Qwen/source/index.rst:27 714c64df6aed4e608571de0155199fef
100
+ msgid "`Hugging Face <https://huggingface.co/Qwen>`__"
101
+ msgstr "`Hugging Face <https://huggingface.co/Qwen>`__"
102
+
103
+ #: ../../Qwen/source/index.rst:28 214e12e0b1c04b268582b2c46d22334d
104
+ msgid "`ModelScope <https://modelscope.cn/organization/qwen>`__"
105
+ msgstr "`ModelScope <https://modelscope.cn/organization/qwen>`__"
106
+
107
+ #: ../../Qwen/source/index.rst:29 9c64e461dc3a440ab92d94887fe3d2d8
108
+ msgid "`Qwen3 Collection <https://huggingface.co/collections/Qwen/qwen3-67dd247413f0e2e4f653967f>`__"
109
+ msgstr ""
110
+
111
+ #: ../../Qwen/source/index.rst:31 c6056edc8a3a4a12bd3a75eeb210f7a2
112
+ msgid "Join our community by joining our `Discord <https://discord.gg/yPEP2vHTu4>`__ and `WeChat <https://github.com/QwenLM/Qwen/blob/main/assets/wechat.png>`__ group. We are looking forward to seeing you there!"
113
+ msgstr "加入社区,加入 `Discord <https://discord.gg/yPEP2vHTu4>`__ 和 `微信群 <https://github.com/QwenLM/Qwen/blob/main/assets/wechat.png>`__ 。很期待见到你们!"
114
+
115
+ #~ msgid "Web UI"
116
+ #~ msgstr "Web UI"
117
+
118
+ #~ msgid "Benchmark"
119
+ #~ msgstr "评测"
120
+
121
+ #~ msgid "Qwen2.5"
122
+ #~ msgstr ""
123
+
124
+ #~ msgid "Dense, easy-to-use, decoder-only language models, available in **0.5B**, **1.5B**, **3B**, **7B**, **14B**, **32B**, and **72B** sizes, and base and instruct variants."
125
+ #~ msgstr "易于使用的仅解码器稠密语言模型,提供 **0.5B** 、**1.5B** 、**3B** 、**7B** 、**14B** 、**32B** 和 **72B** 共7种参数规模的模型,并且有基模型和指令微调模型两种变体(其中“ B ”表示“十亿”, 72B 即为 720 亿)"
126
+
127
+ #~ msgid "Pretrained on our latest large-scale dataset, encompassing up to **18T** tokens."
128
+ #~ msgstr "利用我们最新的数据集进行预训练,包含多达 18T tokens (其中“ T ”表示“万亿”, 18T 即为 18 万亿)"
129
+
130
+ #~ msgid "Significant improvements in instruction following, generating long texts (over 8K tokens), understanding structured data (e.g, tables), and generating structured outputs especially JSON."
131
+ #~ msgstr "在遵循指令、生成长文本(超过 8K tokens )、理解结构化数据(例如,表格)以及生成结构化输出特别是 JSON 方面有了显著改进"
132
+
133
+ #~ msgid "More resilient to the diversity of system prompts, enhancing role-play implementation and condition-setting for chatbots."
134
+ #~ msgstr "更加适应多样化的系统提示,增强了角色扮演的实现和聊天机器人的背景设置。"
135
+
136
+ #~ msgid "Context length support up to **128K** tokens and can generate up to **8K** tokens."
137
+ #~ msgstr "支持最多达 **128K** tokens 的上下文长度,并能生成多达 **8K** tokens 的文本。"
138
+
139
+ #~ msgid "Multilingual support for over **29** languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more."
140
+ #~ msgstr "支持超过 **29** 种语言,包括中文、英文、法文、西班牙文、葡萄牙文、德文、意大利文、俄文、日文、韩文、越南文、泰文、阿拉伯文等。"
141
+
142
+ #~ msgid "`Qwen2.5 Collection <https://huggingface.co/collections/Qwen/qwen25-66e81a666513e518adb90d9e>`__"
143
+ #~ msgstr ""
144
+
docs/locales/zh_CN/LC_MESSAGES/inference/transformers.po ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-05-29 14:27+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.16.0\n"
18
+
19
+ #: ../../source/inference/transformers.md:1 c178ffb3888f441180ecb4fca79195fd
20
+ msgid "Transformers"
21
+ msgstr ""
22
+
23
+ #: ../../source/inference/transformers.md:3 c816184205fc456894a0b5b5f3dc4b80
24
+ msgid "Transformers is a library of pretrained natural language processing for inference and training. Developers can use Transformers to train models on their data, build inference applications, and generate texts with large language models."
25
+ msgstr "Transformers 是一个用于推理和训练的预训练自然语言处理库。开发者可以使用 Transformers 在自己的数据上训练模型、构建推理应用,并通过大型语言模型生成文本。"
26
+
27
+ #: ../../source/inference/transformers.md:6 373686a143e14f7a9fd059cddff449bf
28
+ msgid "Environment Setup"
29
+ msgstr "环境配置"
30
+
31
+ #: ../../source/inference/transformers.md:8 7dfb38faea8f4eeda6072046cead1636
32
+ msgid "`transformers>=4.51.0`"
33
+ msgstr ""
34
+
35
+ #: ../../source/inference/transformers.md:9 9d7e644e3ec840bead01f1ce246e9cd1
36
+ msgid "`torch>=2.6` is recommended"
37
+ msgstr "推荐使用 `torch>=2.6`"
38
+
39
+ #: ../../source/inference/transformers.md:10 06da43b05cd94312a35c83fd485e617e
40
+ msgid "GPU is recommended"
41
+ msgstr "推荐使用 GPU"
42
+
43
+ #: ../../source/inference/transformers.md:13 363ebf64fe2746ada9487ec3bf691ed8
44
+ msgid "Basic Usage"
45
+ msgstr "基本用法"
46
+
47
+ #: ../../source/inference/transformers.md:15 356e5bca4faa4492b7ce0646fcb9dc12
48
+ msgid "You can use the `pipeline()` interface or the `generate()` interface to generate texts with Qwen3 in transformers."
49
+ msgstr "您可以使用 `pipeline()` 接口或 `generate()` 接口在 transformers 中通过 Qwen3 生成文本。"
50
+
51
+ #: ../../source/inference/transformers.md:17 704e2d1659d94b6d911bd5e01ea63764
52
+ msgid "In general, the pipeline interface requires less boilerplate code, which is shown here. The following shows a basic example using pipeline for multi-turn conversations:"
53
+ msgstr "通常,pipeline 接口需要的样板代码更少,如下所示。以下展示了一个使用 pipeline 进行多轮对话的基本示例:"
54
+
55
+ #: ../../source/inference/transformers.md:44 2054af41b1de457a9f14ef6f8117772c
56
+ msgid "There are some important parameters creating the pipeline:"
57
+ msgstr "创建 pipeline 时有一些重要的参数:"
58
+
59
+ #: ../../source/inference/transformers.md:45 0127b56b938c496f91a8cc1642af1590
60
+ msgid "**Model**: `model_name_or_path` could be a model ID like `Qwen/Qwen3-8B` or a local path."
61
+ msgstr "**模型**:`model_name_or_path` 可以是像 `Qwen/Qwen3-8B` 这样的模型 ID,也可以是本地路径。"
62
+
63
+ #: ../../source/inference/transformers.md:47 374ac106d4374722a5428c492a1865f8
64
+ msgid "To download model files to a local directory, you could use"
65
+ msgstr "要将模型文件下载到本地目录,可以使用"
66
+
67
+ #: ../../source/inference/transformers.md:51 47239a7ef1124d22802c8f7d0d87b251
68
+ msgid "You can also download model files using ModelScope if you are in mainland China"
69
+ msgstr "如果您在中国大陆,还可以使用 ModelScope 下载模型文件"
70
+
71
+ #: ../../source/inference/transformers.md:55 e787e9221bdc4e6aaf7f98ed97e726da
72
+ msgid "**Device Placement**: `device_map=\"auto\"` will load the model parameters to multiple devices automatically, if available. It relies on the `accelerate` package. If you would like to use a single device, you can pass `device` instead of device_map. `device=-1` or `device=\"cpu\"` indicates using CPU, `device=\"cuda\"` indicates using the current GPU, and `device=\"cuda:1\"` or `device=1` indicates using the second GPU. Do not use `device_map` and `device` at the same time!"
73
+ msgstr "**设备分配**:如果可用,`device_map=\"auto\"` 将自动将模型参数加载到多个设备上。它依赖于 `accelerate` 包。如果您想使用单个设备,可以传递 `device` 而不是 `device_map`。`device=-1` 或 `device=\"cpu\"` 表示使用 CPU,`device=\"cuda\"` 表示使用当前 GPU,`device=\"cuda:1\"` 或 `device=1` 表示使用第二个 GPU。不要同时使用 `device_map` 和 `device`!"
74
+
75
+ #: ../../source/inference/transformers.md:60 91247cdab1f142559217047bf9d36024
76
+ msgid "**Compute Precision**: `torch_dtype=\"auto\"` will determine automatically the data type to use based on the original precision of the checkpoint and the precision your device supports. For modern devices, the precision determined will be `bfloat16`."
77
+ msgstr "**计算精度**:`torch_dtype=\"auto\"` 将根据检查点的原始精度和设备支持的精度自动确定要使用的数���类型。对于现代设备,确定的精度将是 `bfloat16`。"
78
+
79
+ #: ../../source/inference/transformers.md:63 65b419de7e784e8d8790aa319ad28c42
80
+ msgid "If you don't pass `torch_dtype=\"auto\"`, the default data type is `float32`, which will take double the memory and be slower in computation."
81
+ msgstr "如果您不传递 `torch_dtype=\"auto\"`,默认数据类型为 `float32`,这将占用两倍的内存并且计算速度较慢。"
82
+
83
+ #: ../../source/inference/transformers.md:66 7e6c5bcd15bd4c62a4a3ff9f4643bf8e
84
+ msgid "Calls to the text generation pipeline will use the generation configuration from the model file, e.g., `generation_config.json`. This configuration could be overridden by passing arguments directly to the call. The default is equivalent to"
85
+ msgstr "调用文本生成 pipeline 时,将使用模型文件中的生成配置,例如 `generation_config.json`。这些配置可以通过直接向调用传递参数来覆盖。默认配置等效于"
86
+
87
+ #: ../../source/inference/transformers.md:73 3bc839021fe14d9c999929da1ee45547
88
+ msgid "For the best practices in configuring generation parameters, please see the model card."
89
+ msgstr "有关配置生成参数的最佳实践,请参阅模型卡片。"
90
+
91
+ #: ../../source/inference/transformers.md:75 5cc87eccca0e4fb4bb67c2deafc72569
92
+ msgid "Thinking & Non-Thinking Mode"
93
+ msgstr "思考与非思考模式"
94
+
95
+ #: ../../source/inference/transformers.md:77 5f78a0a90ae341c2ab26b525d8f618bb
96
+ msgid "By default, Qwen3 model will think before response. It is also true for the `pipeline()` interface. To switch between thinking and non-thinking mode, two methods can be used"
97
+ msgstr "默认情况下,Qwen3 模型会在回复前进行思考,`pipeline()` 接口也是如此。要切换思考与非思考模式,可以使用以下两种方法:"
98
+
99
+ #: ../../source/inference/transformers.md:80 2055152940d54de7ad900f6bfd2b0186
100
+ msgid "Append a final assistant message, containing only `<think>\\n\\n</think>\\n\\n`. This method is stateless, meaning it will only work for that single turn. It will also strictly prevent the model from generating thinking content. For example,"
101
+ msgstr "追加一条仅包含 `<think>\\n\\n</think>\\n\\n` 的最终助手 (assistant) 消息。此方法是无状态的,意味着它仅对当前轮对话生效,并且会严格阻止模型生成思考内容。例如:"
102
+
103
+ #: ../../source/inference/transformers.md:97 8c9c833fa8004aecb65eef07212a140b
104
+ msgid "Add to the user (or the system) message, `/no_think` to disable thinking and `/think` to enable thinking. This method is stateful, meaning the model will follow the most recent instruction in multi-turn conversations."
105
+ msgstr "在用户 (user) 或系统 (system) 消息中添加 `/no_think` 以禁用思考、添加 `/think` 以启用思考。此方法是有状态的,意味着在多轮对话中,模型将遵循最近的指令。您还可以使用自然语言指令。"
106
+
107
+ #: ../../source/inference/transformers.md:113 957c3c1fa49a4b119c7fc78fa9419e45
108
+ msgid "Parsing Thinking Content"
109
+ msgstr "解析思考内容"
110
+
111
+ #: ../../source/inference/transformers.md:115 938849b04bf649918c233707e408d21a
112
+ msgid "If you would like a more structured assistant message format, you can use the following function to extract the thinking content into a field named `reasoning_content` which is similar to the format used by vLLM, SGLang, etc."
113
+ msgstr "如果您希望获得更结构化的助手消息格式,可以使用以下函数将思考内容提取到名为 `reasoning_content` 的字段中,该字段的格式类似于 vLLM、SGLang 等使用的格式。"
114
+
115
+ #: ../../source/inference/transformers.md:131 e46bd3b0ec974011b7c658ab29b2fdc1
116
+ msgid "Parsing Tool Calls"
117
+ msgstr "解析工具调用"
118
+
119
+ #: ../../source/inference/transformers.md:133 d3d893f89e4149db823e418a5bd2d773
120
+ msgid "For tool calling with Transformers, please refer to [our guide on Function Calling](../framework/function_call.md#hugging-face-transformers)."
121
+ msgstr "有关使用 Transformers 进行工具调用的信息,请参阅[函数调用指南](../framework/function_call.md#hugging-face-transformers)。"
122
+
123
+ #: ../../source/inference/transformers.md:135 304b7ec8d3d446b6ada27d48f128660d
124
+ msgid "Serving Quantized models"
125
+ msgstr "使用量化模型"
126
+
127
+ #: ../../source/inference/transformers.md:137 b5f3ee666c3c475ba5282fd3bb184bbc
128
+ msgid "Qwen3 comes with two types of pre-quantized models, FP8 and AWQ. The command serving those models are the same as the original models except for the name change:"
129
+ msgstr "Qwen3 提供了两种类型的预量化模型:FP8 和 AWQ。使用这些模型的命令与原始模型相同,只是名称有所更改:"
130
+
131
+ #: ../../source/inference/transformers.md:155 6e6eb31d2af94ce1bc9a44d973d6febc
132
+ msgid "FP8 computation is supported on NVIDIA GPUs with compute capability > 8.9, that is, Ada Lovelace, Hopper, and later GPUs."
133
+ msgstr "FP8 计算在计算能力 > 8.9 的 NVIDIA GPU 上受支持,即 Ada Lovelace、Hopper 及更新的 GPU。"
134
+
135
+ #: ../../source/inference/transformers.md:157 780916506f034d5bb663a2aa69083ee3
136
+ msgid "For better performance, make sure `triton` and a CUDA compiler compatible with the CUDA version of `torch` in your environment are installed."
137
+ msgstr "为了获得更好的性能,请确保安装了 `triton` 和与环境中 `torch` 的 CUDA 版本兼容的 CUDA 编译器。"
138
+
139
+ #: ../../source/inference/transformers.md:161 17ad788596ef464db2b333ec10c91742
140
+ msgid "As of 4.51.0, there are issues with Transformers when running those checkpoints **across GPUs**. The following method could be used to work around those issues:"
141
+ msgstr "在 4.51.0 版本中,在**跨 GPU**的情况下运行 FP8 存在一些与 Transformers 相关的问题。可以使用以下方法来解决这些问题:"
142
+
143
+ #: ../../source/inference/transformers.md:163 2e4c2a9ab6864d7ca8a0f477dc888f75
144
+ msgid "Set the environment variable `CUDA_LAUNCH_BLOCKING=1` before running the script; or"
145
+ msgstr "在运行脚本之前设置环境变量 `CUDA_LAUNCH_BLOCKING=1`;或者"
146
+
147
+ #: ../../source/inference/transformers.md:164 328f9a6a90094a3ca8c7f824ffbe641b
148
+ msgid "Uncomment [this line](https://github.com/huggingface/transformers/blob/0720e206c6ba28887e4d60ef60a6a089f6c1cc76/src/transformers/integrations/finegrained_fp8.py#L340) in your local installation of `transformers`."
149
+ msgstr "取消注释您本地安装的 `transformers` 中的[这一行](https://github.com/huggingface/transformers/blob/0720e206c6ba28887e4d60ef60a6a089f6c1cc76/src/transformers/integrations/finegrained_fp8.py#L340)。"
150
+
151
+ #: ../../source/inference/transformers.md:168 a8ab4a05e34e4fd1b816388ca1c4614f
152
+ msgid "Enabling Long Context"
153
+ msgstr "启用长上下文"
154
+
155
+ #: ../../source/inference/transformers.md:170 15c36696b02a45829c0158fc644af96f
156
+ msgid "The maximum context length in pre-training for Qwen3 models is 32,768 tokens. It can be extended to 131,072 tokens with RoPE scaling techniques. We have validated the performance with YaRN."
157
+ msgstr "Qwen3 模型在预训练中的最大上下文长度为 32,768 个 token。通过 RoPE 缩放技术,它可以扩展到 131,072 个 token。我们已使用 YaRN 验证了性能。"
158
+
159
+ #: ../../source/inference/transformers.md:174 ff0ec1adc3e647f4b5ecf29adc14a5c6
160
+ msgid "Transformers supports YaRN, which can be enabled either by modifying the model files or overriding the default arguments when loading the model."
161
+ msgstr "Transformers 支持 YaRN,可以通过修改模型文件或在加载模型时覆盖默认参数来启用。"
162
+
163
+ #: ../../source/inference/transformers.md:176 a28d0e27841343d7a3c94fd5f047b671
164
+ msgid "Modifying the model files: In the `config.json` file, add the rope_scaling fields:"
165
+ msgstr "修改模型文件:在 `config.json` 文件中,添加 rope_scaling 字段:"
166
+
167
+ #: ../../source/inference/transformers.md:187 50430e65309e453282eec582c6d74493
168
+ msgid "Overriding the default arguments:"
169
+ msgstr "覆盖默认参数:"
170
+
171
+ #: ../../source/inference/transformers.md:210 091b4560600b48aa9ba156da08c27fab
172
+ msgid "As of Transformers 4.52.3, it will use `max_position_embeddings/rope_scaling.original_max_position_embeddings` as the `rope_scaling.factor` regradless of the specified `rope_scaling.factor`. See [this issue](https://github.com/huggingface/transformers/issues/38224) for more information."
173
+ msgstr "在 Transformers 4.52.3 版本中,无论指定的 `rope_scaling.factor` 是多少,它都会使用 `max_position_embeddings/rope_scaling.original_max_position_embeddings` 作为 `rope_scaling.factor`。更多信息请参阅[此问题](https://github.com/huggingface/transformers/issues/38224 )。"
174
+
175
+ #: ../../source/inference/transformers.md:214 62f158e126984c04a39ad039d42a4dc0
176
+ msgid "Transformers implements static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.** We advise adding the `rope_scaling` configuration only when processing long contexts is required. It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0."
177
+ msgstr "Transformers 实现了静态 YaRN,这意味着无论输入长度如何,缩放因子保持不变,**这可能会对较短文本的性能产生影响。** 我们建议仅在需要处理长上下文时添加 `rope_scaling` 配置。还建议根据需要修改 `factor`。例如,如果您的应用程序的典型上下文长度为 65,536 个 token,则最好将 `factor` 设置为 2.0。"
178
+
179
+ #: ../../source/inference/transformers.md:220 1c816d18902b4fad8eaaa3598459cc65
180
+ msgid "Streaming Generation"
181
+ msgstr "流式输出"
182
+
183
+ #: ../../source/inference/transformers.md:222 2b79e8f552ae4399aa580e4b00ebc6bd
184
+ msgid "With the help of `TextStreamer`, you can modify your chatting with Qwen3 to streaming mode. It will print the response as being generated to the console or the terminal."
185
+ msgstr "借助 `TextStreamer` ,您可以将与 Qwen3 的对话切换到流式传输模式。下面是一个关于如何使用它的示例:"
186
+
187
+ #: ../../source/inference/transformers.md:242 113734a6f14141a9a11cb3536cd37471
188
+ msgid "Besides using `TextStreamer`, we can also use `TextIteratorStreamer` which stores print-ready text in a queue, to be used by a downstream application as an iterator:"
189
+ msgstr "除了使用 `TextStreamer` 之外,我们还可以使用 `TextIteratorStreamer` ,它将可打印的文本存储在一个队列中,以便下游应用程序作为迭代器来使用:"
190
+
191
+ #: ../../source/inference/transformers.md:271 51fb3a808ca7448694b0cab5582025e3
192
+ msgid "Batch Generation"
193
+ msgstr "批处理"
194
+
195
+ #: ../../source/inference/transformers.md:274 13ec723ad16648f593bdd5d75f125f93
196
+ msgid "Batching is not automatically a win for performance."
197
+ msgstr "批处理不总能提速。"
198
+
199
+ #: ../../source/inference/transformers.md:300 1afe856936ef4a19a386f4ab9704dd0e
200
+ msgid "FAQ"
201
+ msgstr "常见问题解答"
202
+
203
+ #: ../../source/inference/transformers.md:302 7175bda60e7a4796b9279b48116f819f
204
+ msgid "You may find distributed inference with Transformers is not as fast as you would imagine. Transformers with `device_map=\"auto\"` does not apply tensor parallelism, and it only uses one GPU at a time. For Transformers with tensor parallelism, please refer to [its documentation](https://huggingface.co/docs/transformers/v4.51.3/en/perf_infer_gpu_multi)."
205
+ msgstr "您可能会发现使用 Transformers 进行分布式推理的速度不如预期。Transformers 使用 `device_map=\"auto\"` 时并未应用张量并行 (Tensor Parallelism),且一次仅使用一个 GPU。如需支持张量并行的 Transformers,请参阅[其文档](https://huggingface.co/docs/transformers/v4.51.3/en/perf_infer_gpu_multi)。"
docs/locales/zh_CN/LC_MESSAGES/quantization/awq.po ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.17.0\n"
18
+
19
+ #: ../../Qwen/source/quantization/awq.md:1 363514c3e24c4d2aa54832e85acf34ef
20
+ msgid "AWQ"
21
+ msgstr "AWQ"
22
+
23
+ #: ../../Qwen/source/quantization/awq.md:4 36b5c0de1013499f9f1e41edf8fa28ca
24
+ msgid "To be updated for Qwen3."
25
+ msgstr "仍需为Qwen3更新。"
26
+
27
+ #: ../../Qwen/source/quantization/awq.md:7 9d6a80a82b044628bc9c911785ac9160
28
+ msgid "For quantized models, one of our recommendations is the usage of [AWQ](https://arxiv.org/abs/2306.00978) with [AutoAWQ](https://github.com/casper-hansen/AutoAWQ)."
29
+ msgstr "对于量化模型,我们推荐使用 [AWQ](https://arxiv.org/abs/2306.00978) 结合 [AutoAWQ](https://github.com/casper-hansen/AutoAWQ) "
30
+
31
+ #: ../../Qwen/source/quantization/awq.md:9 139542ed4b414cfb834b3fd81ea88d51
32
+ msgid "**AWQ** refers to Activation-aware Weight Quantization, a hardware-friendly approach for LLM low-bit weight-only quantization."
33
+ msgstr "**AWQ**即激活值感知的权重量化(Activation-aware Weight Quantization),是一种针对LLM的低比特权重量化的硬件友好方法。"
34
+
35
+ #: ../../Qwen/source/quantization/awq.md:11 9a2959bb9f984e36a299bc40abca9402
36
+ msgid "**AutoAWQ** is an easy-to-use Python library for 4-bit quantized models. AutoAWQ speeds up models by 3x and reduces memory requirements by 3x compared to FP16. AutoAWQ implements the Activation-aware Weight Quantization (AWQ) algorithm for quantizing LLMs."
37
+ msgstr "**AutoAWQ**是一个易于使用的工具包,用于4比特量化模型。相较于FP16,AutoAWQ能够将模型的运行速度提升3倍,并将内存需求降低至原来的三分之一。AutoAWQ实现了AWQ算法,可用于LLM的量化处理。"
38
+
39
+ #: ../../Qwen/source/quantization/awq.md:15 4f9fcd93d1f44b48869224c0f4e8b76a
40
+ msgid "In this document, we show you how to use the quantized model with Hugging Face `transformers` and also how to quantize your own model."
41
+ msgstr "在本文档中,我们将向您展示如何在Hugging Face `transformers`框架下使用量化模型,以及如何对您自己的模型进行量化"
42
+
43
+ #: ../../Qwen/source/quantization/awq.md:17 870ebc162f3749b48fe454df85aaaf4b
44
+ msgid "Usage of AWQ Models with Hugging Face transformers"
45
+ msgstr "在Hugging Face transformers中使用AWQ量化模型"
46
+
47
+ #: ../../Qwen/source/quantization/awq.md:19 cc7bd785c7ac45a4980fbda683699e43
48
+ msgid "Now, `transformers` has officially supported AutoAWQ, which means that you can directly use the quantized model with `transformers`. The following is a very simple code snippet showing how to run `Qwen2.5-7B-Instruct-AWQ` with the quantized model:"
49
+ msgstr "现在,`transformers`已经正式支持AutoAWQ,这意味着您可以直接在`transformers`中使用AWQ量化模型。以下是一个非常简单的代码片段,展示如何运行量化模型 `Qwen2.5-7B-Instruct-AWQ` :"
50
+
51
+ #: ../../Qwen/source/quantization/awq.md:56 47826d51abf54ad8a89ef9b91127a700
52
+ msgid "Usage of AWQ Models with vLLM"
53
+ msgstr "在vLLM中使用AWQ量化模型"
54
+
55
+ #: ../../Qwen/source/quantization/awq.md:58 b7235ae8f8344dd4a3d2029bbe7a40fc
56
+ msgid "vLLM has supported AWQ, which means that you can directly use our provided AWQ models or those quantized with `AutoAWQ` with vLLM. We recommend using the latest version of vLLM (`vllm>=0.6.1`) which brings performance improvements to AWQ models; otherwise, the performance might not be well-optimized."
57
+ msgstr "vLLM已支持AWQ,您可以直接使用我们提供的AWQ量化模型或使用`AutoAWQ`量化的模型。我们建议使用最新版的vLLM (`vllm>=0.6.1`),新版为AWQ量化模型提升了效率提;不然推理效率可能并为被良好优化(即效率可能较非量化模型低)。"
58
+
59
+ #: ../../Qwen/source/quantization/awq.md:61 940ce8fdb5da442b99af2bc1739911c6
60
+ msgid "Actually, the usage is the same with the basic usage of vLLM. We provide a simple example of how to launch OpenAI-API compatible API with vLLM and `Qwen2.5-7B-Instruct-AWQ`:"
61
+ msgstr "实际上,使用AWQ模型与vLLM的基本用法相同。我们提供了一个简单的示例,展示了如何通过vLLM启动与OpenAI API兼容的接口,并使用 `Qwen2.5-7B-Instruct-AWQ` 模型:"
62
+
63
+ #: ../../Qwen/source/quantization/awq.md:64 2d249915352049a6a8d5a06e1f4682ee
64
+ msgid "Run the following in a shell to start an OpenAI-compatible API service:"
65
+ msgstr "在终端中运行以下命令以开启OpenAI兼容API:"
66
+
67
+ #: ../../Qwen/source/quantization/awq.md:70 be7bfbb81698429cbfcbcd24d062fc08
68
+ msgid "Then, you can call the API as"
69
+ msgstr "随后,您可以这样调���API:"
70
+
71
+ #: ../../Qwen/source/quantization/awq.md:86 0dff7d5c7b044548a82e0ba68a043d80
72
+ msgid "or you can use the API client with the `openai` Python package as shown below:"
73
+ msgstr "或者你可以按照下面所示的方式,使用 `openai` Python包中的API客户端:"
74
+
75
+ #: ../../Qwen/source/quantization/awq.md:115 65f4d60502ee486382e9bda9a5a826bb
76
+ msgid "Quantize Your Own Model with AutoAWQ"
77
+ msgstr "使用AutoAWQ量化你的模型"
78
+
79
+ #: ../../Qwen/source/quantization/awq.md:117 c7c42af91c1a419194d65200bcfa2f26
80
+ #, fuzzy
81
+ msgid "If you want to quantize your own model to AWQ quantized models, we advise you to use AutoAWQ."
82
+ msgstr "如果您希望将自定义模型量化为AWQ量化模型,我们建议您使用AutoAWQ。推荐通过安装源代码来获取并安装该工具包的最新版本:"
83
+
84
+ #: ../../Qwen/source/quantization/awq.md:123 232e94883d044030b2193392788b9314
85
+ msgid "Suppose you have finetuned a model based on `Qwen2.5-7B`, which is named `Qwen2.5-7B-finetuned`, with your own dataset, e.g., Alpaca. To build your own AWQ quantized model, you need to use the training data for calibration. Below, we provide a simple demonstration for you to run:"
86
+ msgstr "假设你已经基于 `Qwen2.5-7B` 模型进行了微调,并将其命名为 `Qwen2.5-7B-finetuned` ,且使用的是你自己的数据集,比如Alpaca。若要构建你自己的AWQ量化模型,你需要使用训练数据进行校准。以下,我们将为你提供一个简单的演示示例以便运行:"
87
+
88
+ #: ../../Qwen/source/quantization/awq.md:141 5162195f32ee4ecba229aa137da1aba4
89
+ msgid "Then you need to prepare your data for calibration. What you need to do is just put samples into a list, each of which is a text. As we directly use our finetuning data for calibration, we first format it with ChatML template. For example,"
90
+ msgstr "接下来,您需要准备数据以进行校准。您需要做的就是将样本放入一个列表中,其中每个样本都是一段文本。由于我们直接使用微调数据来进行校准,所以我们首先使用ChatML模板对其进行格式化。例如:"
91
+
92
+ #: ../../Qwen/source/quantization/awq.md:153 0d4736e90e0242a8be15533de3aab6ff
93
+ msgid "where each `msg` is a typical chat message as shown below:"
94
+ msgstr "其中每个 `msg` 是一个典型的聊天消息,如下所示:"
95
+
96
+ #: ../../Qwen/source/quantization/awq.md:163 79d86630600945ac85dbe13d07987016
97
+ msgid "Then just run the calibration process by one line of code:"
98
+ msgstr "然后只需通过一行代码运行校准过程:"
99
+
100
+ #: ../../Qwen/source/quantization/awq.md:169 1ae219a50508465b98e3b3398e631681
101
+ msgid "Finally, save the quantized model:"
102
+ msgstr "最后,保存量化模型:"
103
+
104
+ #: ../../Qwen/source/quantization/awq.md:176 58316c1a4172418aba9f37925963e17f
105
+ msgid "Then you can obtain your own AWQ quantized model for deployment. Enjoy!"
106
+ msgstr "然后你就可以得到一个可以用于部署的AWQ量化模型。玩得开心!"
107
+
docs/locales/zh_CN/LC_MESSAGES/quantization/gptq.po ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-04-28 19:42+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.17.0\n"
18
+
19
+ #: ../../Qwen/source/quantization/gptq.md:1 c90397f810fb44a0abba8dd02f998f1c
20
+ msgid "GPTQ"
21
+ msgstr ""
22
+
23
+ #: ../../Qwen/source/quantization/gptq.md:4 b79afc46b0f9474fb0c83751625aefc5
24
+ msgid "To be updated for Qwen3."
25
+ msgstr "仍需为Qwen3更新。"
26
+
27
+ #: ../../Qwen/source/quantization/gptq.md:7 898494af2a944193880f27e2f90db4f4
28
+ msgid "[GPTQ](https://arxiv.org/abs/2210.17323) is a quantization method for GPT-like LLMs, which uses one-shot weight quantization based on approximate second-order information. In this document, we show you how to use the quantized model with Hugging Face `transformers` and also how to quantize your own model with [AutoGPTQ](https://github.com/AutoGPTQ/AutoGPTQ)."
29
+ msgstr "[GPTQ](https://arxiv.org/abs/2210.17323)是一种针对类GPT大型语言模型的量化方法,它基于近似二阶信息进行一次性权重量化。在本文档中,我们将向您展示如何使用 `transformers` 库加载并应用量化后的模型,同时也会指导您如何通过[AutoGPTQ](https://github.com/AutoGPTQ/AutoGPTQ)来对您自己的模型进行量化处理。"
30
+
31
+ #: ../../Qwen/source/quantization/gptq.md:10 11b82020735d4828a4182cefbf98aeb1
32
+ msgid "Usage of GPTQ Models with Hugging Face transformers"
33
+ msgstr "在Hugging Face transformers中使用GPTQ模型"
34
+
35
+ #: ../../Qwen/source/quantization/gptq.md:14 2e9481d850954772949dd33897e0b06b
36
+ msgid "To use the official Qwen2.5 GPTQ models with `transformers`, please ensure that `optimum>=1.20.0` and compatible versions of `transformers` and `auto_gptq` are installed."
37
+ msgstr ""
38
+
39
+ #: ../../Qwen/source/quantization/gptq.md:16 fe6662a312184d40b07d957f4c0888cc
40
+ msgid "You can do that by"
41
+ msgstr ""
42
+
43
+ #: ../../Qwen/source/quantization/gptq.md:22 9f0ad8e2a26145cf8bd9d60305566771
44
+ msgid "Now, `transformers` has officially supported AutoGPTQ, which means that you can directly use the quantized model with `transformers`. For each size of Qwen2.5, we provide both Int4 and Int8 GPTQ quantized models. The following is a very simple code snippet showing how to run `Qwen2.5-7B-Instruct-GPTQ-Int4`:"
45
+ msgstr "现在,`transformers` 正式支持了AutoGPTQ,这意味着您能够直接在`transformers`中使用量化后的模型。以下是一个非常简单的代码片段示例,展示如何运行 `Qwen2.5-7B-Instruct-GPTQ-Int4` (请注意,对于每种大小的Qwen2.5模型,我们都提供了Int4和Int8两种量化版本):"
46
+
47
+ #: ../../Qwen/source/quantization/gptq.md:60 855686b8990f403bba151d8498947f23
48
+ msgid "Usage of GPTQ Models with vLLM"
49
+ msgstr "在vLLM中使用GPTQ模型"
50
+
51
+ #: ../../Qwen/source/quantization/gptq.md:62 ad572c30a0904598b3cbeba7c38a607a
52
+ msgid "vLLM has supported GPTQ, which means that you can directly use our provided GPTQ models or those trained with `AutoGPTQ` with vLLM. If possible, it will automatically use the GPTQ Marlin kernel, which is more efficient."
53
+ msgstr "vLLM已支持GPTQ,您可以直接使用我们提供的GPTQ量化模型或使用`AutoGPTQ`量化的模型。我们建议使用最新版的vLLM。如有可能,其会自动使用效率更好的GPTQ Marlin实现。"
54
+
55
+ #: ../../Qwen/source/quantization/gptq.md:65 09050876d2c04aee9b619d28d4f5589c
56
+ msgid "Actually, the usage is the same with the basic usage of vLLM. We provide a simple example of how to launch OpenAI-API compatible API with vLLM and `Qwen2.5-7B-Instruct-GPTQ-Int4`:"
57
+ msgstr "实际上,使用GPTQ模型与vLLM的基本用法相同。我们提供了一个简单的示例,展示了如何通过vLLM启动与OpenAI API兼容的接口,并使用 `Qwen2.5-7B-Instruct-GPTQ-Int4` 模型:"
58
+
59
+ #: ../../Qwen/source/quantization/gptq.md:68 a31dd879cc444b5da8d16fb1705585a6
60
+ msgid "Run the following in a shell to start an OpenAI-compatible API service:"
61
+ msgstr "在终端中运行以下命令以开启OpenAI兼容API:"
62
+
63
+ #: ../../Qwen/source/quantization/gptq.md:74 9dfb41e03089473792928b05b1225de4
64
+ msgid "Then, you can call the API as"
65
+ msgstr "随后,您可以这样调用API:"
66
+
67
+ #: ../../Qwen/source/quantization/gptq.md:90 6b440bebe0d84118bb63ed9a7c169ab5
68
+ msgid "or you can use the API client with the `openai` Python package as shown below:"
69
+ msgstr "或者你可以按照下面所示的方式,使用 `openai` Python包中的API客户端:"
70
+
71
+ #: ../../Qwen/source/quantization/gptq.md:119 7ffaa1ca8b4740b98dc3f804348da523
72
+ msgid "Quantize Your Own Model with AutoGPTQ"
73
+ msgstr "使用AutoGPTQ量化你的模型"
74
+
75
+ #: ../../Qwen/source/quantization/gptq.md:121 40bd0b11507c4f06be5a5918d0dc3bdb
76
+ msgid "If you want to quantize your own model to GPTQ quantized models, we advise you to use AutoGPTQ. It is suggested installing the latest version of the package by installing from source code:"
77
+ msgstr "如果你想将自定义模型量化为GPTQ量化模型,我们建议你使用AutoGPTQ工具。推荐通过安装源代码的方式获取并安装最新版本的该软件包。"
78
+
79
+ #: ../../Qwen/source/quantization/gptq.md:130 d6ebb03d51bf4e0686ae17ce3f0a34db
80
+ msgid "Suppose you have finetuned a model based on `Qwen2.5-7B`, which is named `Qwen2.5-7B-finetuned`, with your own dataset, e.g., Alpaca. To build your own GPTQ quantized model, you need to use the training data for calibration. Below, we provide a simple demonstration for you to run:"
81
+ msgstr "假设你已经基于 `Qwen2.5-7B` 模型进行了微调,并将该微调后的模型命名为 `Qwen2.5-7B-finetuned` ,且使用的是自己的数据集,比如Alpaca。要构建你自己的GPTQ量化模型,你需要使用训练数据进行校准。以下是一个简单的演示示例,供你参考运行:"
82
+
83
+ #: ../../Qwen/source/quantization/gptq.md:161 9c1b27cc38764332891a8a13175663fc
84
+ msgid "However, if you would like to load the model on multiple GPUs, you need to use `max_memory` instead of `device_map`. Here is an example:"
85
+ msgstr "但是,如果你想使用多GPU来读取模型,你需要使用 `max_memory` 而不是 `device_map`。下面是一段示例代码:"
86
+
87
+ #: ../../Qwen/source/quantization/gptq.md:172 c2a9a50734854c19acf3e623597aee80
88
+ msgid "Then you need to prepare your data for calibration. What you need to do is just put samples into a list, each of which is a text. As we directly use our finetuning data for calibration, we first format it with ChatML template. For example,"
89
+ msgstr "接下来,你需要准备数据进行校准。你需要做的是将样本放入一个列表中,其中每个样本都是一段文本。由于我们直接使用微调数据进行校准,所以我们首先使用ChatML模板对它进行格式化处理。例如:"
90
+
91
+ #: ../../Qwen/source/quantization/gptq.md:188 7621f73d34d04dd791d2eda03edb0d06
92
+ msgid "where each `msg` is a typical chat message as shown below:"
93
+ msgstr "其中每个 `msg` 是一个典型的聊天消息,如下所示:"
94
+
95
+ #: ../../Qwen/source/quantization/gptq.md:198 293efa14ece74a0aa9cbf32ef21e6bcd
96
+ msgid "Then just run the calibration process by one line of code:"
97
+ msgstr "然后只需通过一行代码运行校准过程:"
98
+
99
+ #: ../../Qwen/source/quantization/gptq.md:209 919d7a77cc4a4ef084ee8e2240ff1797
100
+ msgid "Finally, save the quantized model:"
101
+ msgstr "最后,保存量化模型:"
102
+
103
+ #: ../../Qwen/source/quantization/gptq.md:216 b353bdf12d6148fdb0a77662f795ae7e
104
+ msgid "It is unfortunate that the `save_quantized` method does not support sharding. For sharding, you need to load the model and use `save_pretrained` from transformers to save and shard the model. Except for this, everything is so simple. Enjoy!"
105
+ msgstr "很遗憾, `save_quantized` 方法不支持模型分片。若要实现模型分片,您需要先加载模型,然后使用来自 `transformers` 库的 `save_pretrained` 方法来保存并分片模型。除此之外,一切操作都非常简单。祝您使用愉快!"
106
+
107
+ #: ../../Qwen/source/quantization/gptq.md:222 caea6f76804e40daa394ae2e2d52a6ce
108
+ msgid "Known Issues"
109
+ msgstr ""
110
+
111
+ #: ../../Qwen/source/quantization/gptq.md:224 07df69bd48d4445887b5c1fa09f2f0fb
112
+ msgid "Qwen2.5-72B-Instruct-GPTQ-Int4 cannot stop generation properly"
113
+ msgstr ""
114
+
115
+ #: ../../Qwen/source/quantization/gptq.md:226
116
+ #: ../../Qwen/source/quantization/gptq.md:235 a4f1c7b0cb5d49f2929ba5d1246e885d
117
+ #: d2dbf88d06974152943e6ec405419390
118
+ msgid "Model"
119
+ msgstr ""
120
+
121
+ #: ../../Qwen/source/quantization/gptq.md:226 cb9c0be91ecc46c3b6ecfa97a0a37dd7
122
+ msgid "Qwen2.5-72B-Instruct-GPTQ-Int4"
123
+ msgstr ""
124
+
125
+ #: ../../Qwen/source/quantization/gptq.md:227
126
+ #: ../../Qwen/source/quantization/gptq.md:236 c1fe04754a0642fa82ed425d6abaa487
127
+ #: f3ff85cbbc47459fb36b5ad0e38b4a1b
128
+ msgid "Framework"
129
+ msgstr ""
130
+
131
+ #: ../../Qwen/source/quantization/gptq.md:227 8a5a4fe9d7634cb1ac65025565c3593a
132
+ #, fuzzy
133
+ msgid "vLLM, AutoGPTQ (including Hugging Face transformers)"
134
+ msgstr "在Hugging Face transformers中使用GPTQ模型"
135
+
136
+ #: ../../Qwen/source/quantization/gptq.md:228
137
+ #: ../../Qwen/source/quantization/gptq.md:237 320d56294cc4490f8b30ac523388bc44
138
+ #: c04326d003f949a7b2b63c6c6cb20ac3
139
+ msgid "Description"
140
+ msgstr ""
141
+
142
+ #: ../../Qwen/source/quantization/gptq.md:228 22f80d0679dc426dbbfb21b90b993a27
143
+ msgid "Generation cannot stop properly. Continual generation after where it should stop, then repeated texts, either single character, a phrase, or paragraphs, are generated."
144
+ msgstr ""
145
+
146
+ #: ../../Qwen/source/quantization/gptq.md:229
147
+ #: ../../Qwen/source/quantization/gptq.md:238 255a7a8ac98b4d2da51f79f207be5901
148
+ #: 673d23bf488840a2a32a18cd657f334f
149
+ msgid "Workaround"
150
+ msgstr ""
151
+
152
+ #: ../../Qwen/source/quantization/gptq.md:229 c2171874ed804ffb826ac686128d7bff
153
+ msgid "The following workaround could be considered"
154
+ msgstr ""
155
+
156
+ #: ../../Qwen/source/quantization/gptq.md:230 a59d6759991640609371bf7afd81e0b8
157
+ msgid "Using the original model in 16-bit floating point"
158
+ msgstr ""
159
+
160
+ #: ../../Qwen/source/quantization/gptq.md:231 97134ed43ee3414199928d755c24544e
161
+ msgid "Using the AWQ variants or llama.cpp-based models for reduced chances of abnormal generation"
162
+ msgstr ""
163
+
164
+ #: ../../Qwen/source/quantization/gptq.md:233 7c30819dea6c4cfb8eee98d0dd217bf9
165
+ msgid "Qwen2.5-32B-Instruct-GPTQ-Int4 broken with vLLM on multiple GPUs"
166
+ msgstr ""
167
+
168
+ #: ../../Qwen/source/quantization/gptq.md:235 a4a641abd99a47049c1fd172e9cfa2be
169
+ msgid "Qwen2.5-32B-Instruct-GPTQ-Int4"
170
+ msgstr ""
171
+
172
+ #: ../../Qwen/source/quantization/gptq.md:236 70216327dda349cabf03412f5fbe3114
173
+ msgid "vLLM"
174
+ msgstr ""
175
+
176
+ #: ../../Qwen/source/quantization/gptq.md:237 8edf21882ff24358b736c73477cfba9d
177
+ msgid "Deployment on multiple GPUs and only garbled text like `!!!!!!!!!!!!!!!!!!` could be generated."
178
+ msgstr ""
179
+
180
+ #: ../../Qwen/source/quantization/gptq.md:238 10d9d8b3d8e74afea5ccd79bc698fb7c
181
+ msgid "Each of the following workaround could be considered"
182
+ msgstr ""
183
+
184
+ #: ../../Qwen/source/quantization/gptq.md:239 33d1632f26f9423c847d06af7a5d107d
185
+ msgid "Using the AWQ or GPTQ-Int8 variants"
186
+ msgstr ""
187
+
188
+ #: ../../Qwen/source/quantization/gptq.md:240 b27f1f32637349d09b8c74a2041a4d9b
189
+ msgid "Using a single GPU"
190
+ msgstr ""
191
+
192
+ #: ../../Qwen/source/quantization/gptq.md:241 fc27883584a04682b9e28b2ccf51dc0e
193
+ msgid "Using Hugging Face `transformers` if latency and throughput are not major concerns"
194
+ msgstr ""
195
+
196
+ #: ../../Qwen/source/quantization/gptq.md:244 5664e5bd63c845d49e8cfa75e789dfa3
197
+ msgid "Troubleshooting"
198
+ msgstr "问题排查"
199
+
200
+ #: ../../Qwen/source/quantization/gptq.md 06f2358881134920ab43f4256ad6300e
201
+ msgid "With `transformers` and `auto_gptq`, the logs suggest `CUDA extension not installed.` and the inference is slow."
202
+ msgstr "在使用 `transformers` 和 `auto_gptq` 时,日志提示 `CUDA extension not installed.` 并且推理速度缓慢。"
203
+
204
+ #: ../../Qwen/source/quantization/gptq.md:248 2d57d681b2d74c27b60523fa86676b6f
205
+ msgid "`auto_gptq` fails to find a fused CUDA kernel compatible with your environment and falls back to a plain implementation. Follow its [installation guide](https://github.com/AutoGPTQ/AutoGPTQ/blob/main/docs/INSTALLATION.md) to install a pre-built wheel or try installing `auto_gptq` from source."
206
+ msgstr "`auto_gptq` 未能找到与您的环境兼容的融合CUDA算子,因此退回到基础实现。请遵循其 [安装指南](https://github.com/AutoGPTQ/AutoGPTQ/blob/main/docs/INSTALLATION.md) 来安装预构建的 wheel 或尝试从源代码安装 `auto_gptq` 。"
207
+
208
+ #: ../../Qwen/source/quantization/gptq.md 95b57d1a962c4dc7aa02a69a403e2376
209
+ msgid "Self-quantized Qwen2.5-72B-Instruct-GPTQ with `vllm`, `ValueError: ... must be divisible by ...` is raised. The intermediate size of the self-quantized model is different from the official Qwen2.5-72B-Instruct-GPTQ models."
210
+ msgstr "`vllm` 使用自行量化的 Qwen2.5-72B-Instruct-GPTQ 时,会引发 `ValueError: ... must be divisible by ...` 错误。自量化的模型的 intermediate size 与官方的 Qwen2.5-72B-Instruct-GPTQ 模型不同。"
211
+
212
+ #: ../../Qwen/source/quantization/gptq.md:255 ecd9b51a549045949ff18fdb6226ddc8
213
+ #, python-brace-format
214
+ msgid "After quantization the size of the quantized weights are divided by the group size, which is typically 128. The intermediate size for the FFN blocks in Qwen2.5-72B is 29568. Unfortunately, {math}`29568 \\div 128 = 231`. Since the number of attention heads and the dimensions of the weights must be divisible by the tensor parallel size, it means you can only run the quantized model with `tensor_parallel_size=1`, i.e., one GPU card."
215
+ msgstr "量化后,量化权重的大小将被 group size(通常为128)整除。Qwen2-72B 中FFN块的中间大小为29568。不幸的是, {math}`29568 \\div 128 = 231` 。由于注意力头的数量和权重的维度必须能够被张量并行大小整除,这意味着你只能使用 `tensor_parallel_size=1` ,即一张 GPU 卡,来运行量化的模型。"
216
+
217
+ #: ../../Qwen/source/quantization/gptq.md:260 8b1c5e3934654679a2d85e3287cf9309
218
+ #, python-brace-format
219
+ msgid "A workaround is to make the intermediate size divisible by {math}`128 \\times 8 = 1024`. To achieve that, the weights should be padded with zeros. While it is mathematically equivalent before and after zero-padding the weights, the results may be slightly different in reality."
220
+ msgstr "一个解决方案是使中间大小能够被 {math}`128 \\times 8 = 1024` 整除。为了达到这一目的,应该使用零值对权重进行填充。虽然在数学上,在对权重进行零填充前后是等价的,但在现实中结果可能会略有不同。"
221
+
222
+ #: ../../Qwen/source/quantization/gptq.md:264 ae904f7ab91340c4a6831aef4de643ba
223
+ msgid "Try the following:"
224
+ msgstr "尝试以下方法:"
225
+
226
+ #: ../../Qwen/source/quantization/gptq.md:297 4cf8c516a2324e618d25333c84be9e6b
227
+ msgid "This will save the padded checkpoint to the specified directory. Then, copy other files from the original checkpoint to the new directory and modify the `intermediate_size` in `config.json` to `29696`. Finally, you can quantize the saved model checkpoint."
228
+ msgstr "这将会把填充后的检查点保存到指定的目录。然后,你需要从原始检查点复制其他文件到新目录,并将 `config.json` 中的 `intermediate_size` 修改为 `29696` 。最后,你可以量化保存的模型检查点。"
229
+
docs/locales/zh_CN/LC_MESSAGES/quantization/llama.cpp.po ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-05-07 19:51+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.17.0\n"
21
+
22
+ #: ../../source/quantization/llama.cpp.md:1 91e2a69dab7145e39b9e203302a2639e
23
+ msgid "llama.cpp"
24
+ msgstr ""
25
+
26
+ #: ../../source/quantization/llama.cpp.md:3 7ae5403049d44c0ca2396985312e1a36
27
+ msgid "Quantization is a major topic for local inference of LLMs, as it reduces the memory footprint. Undoubtably, llama.cpp natively supports LLM quantization and of course, with flexibility as always."
28
+ msgstr "量化(Quantization)是本地运行大规模语言模型的主要议题,因为它能减少内存占用。毫无疑问,llama.cpp原生支持大规模语言模型的量化,并且一如既往地保持了灵活性。"
29
+
30
+ #: ../../source/quantization/llama.cpp.md:6 ae64a4f0deb944d99dc9db527fb13770
31
+ msgid "At high-level, all quantization supported by llama.cpp is weight quantization: Model parameters are quantized into lower bits, and in inference, they are dequantized and used in computation."
32
+ msgstr "在高层次上,llama.cpp所支持的所有量化都是权重量化(weight quantization):模型参数被量化为低位(bit)数,在推理过程中,它们会被反量化(dequantize)并用于计算。"
33
+
34
+ #: ../../source/quantization/llama.cpp.md:9 384848aad7cb4457a6b39d80487ccfc4
35
+ msgid "In addition, you can mix different quantization data types in a single quantized model, e.g., you can quantize the embedding weights using a quantization data type and other weights using a different one. With an adequate mixture of quantization types, much lower quantization error can be attained with just a slight increase of bit-per-weight. The example program `llama-quantize` supports many quantization presets, such as Q4_K_M and Q8_0."
36
+ msgstr "此外,你可以在单一的量化模型中混合使用不同的量化数据类型,例如,你可以使用一种量化数据类型量化嵌入权重(embedding),而使用另一种量化其他权重。通过适当的量化类型组合,只需略微增加bpw (bit-per-weight, 位权比),就能达到更低的量化误差。示例程序`llama-quantize`支持许多量化预设,如Q4_K_M和Q8_0。"
37
+
38
+ #: ../../source/quantization/llama.cpp.md:13 0d6c25bebbf94dc8b1c0e9bec5788043
39
+ msgid "If you find the quantization errors still more than expected, you can bring your own scales, e.g., as computed by AWQ, or use calibration data to compute an importance matrix using `llama-imatrix`, which can then be used during quantization to enhance the quality of the quantized models."
40
+ msgstr "如果你发现量化误差仍然超出预期,你可以引入自己的量化尺度,例如由AWQ计算的,或者使用校准数据用`llama-imatrix`来计算一个“重要性矩阵”(importance matrix),然后在量化过程中使用以提高量化模型的质量。"
41
+
42
+ #: ../../source/quantization/llama.cpp.md:15 1543df272fe5426e94899b16cc1cd36e
43
+ #, python-brace-format
44
+ msgid "In this document, we demonstrate the common way to quantize your model and evaluate the performance of the quantized model. We will assume you have the example programs from llama.cpp at your hand. If you don't, check our guide [here](../run_locally/llama.cpp.html#getting-the-program){.external}."
45
+ msgstr "在本文档中,我们将展示量化和评估量化模型性能的常见方法。我们会假设你手头有llama.cpp的示例程序。如果没有,请查看我们的[指南](../run_locally/llama.cpp.html#getting-the-program){.external}。"
46
+
47
+ #: ../../source/quantization/llama.cpp.md:19 9245fc77ed6048e482ab7a046f8eb8cf
48
+ msgid "Getting the GGUF"
49
+ msgstr "获取GGUF"
50
+
51
+ #: ../../source/quantization/llama.cpp.md:21 05e869b2fa3e459f8b640a59b88470d5
52
+ msgid "Now, suppose you would like to quantize `Qwen3-8B`. You need to first make a GGUF file as shown below:"
53
+ msgstr "现在,假设你想量化`Qwen3-8B-Instruct`。你需要首先创建一个GGUF文件,如下所示:"
54
+
55
+ #: ../../source/quantization/llama.cpp.md:27 26b1f7e1a9004275a857c3be976c5e8b
56
+ msgid "Since Qwen3 are trained using the bfloat16 precision, the following should keep most information on supported machines:"
57
+ msgstr "由于 Qwen3 以 bfloat16 混合精度训练,以下方法在受支持的计算机上可保留完整参数信息:"
58
+
59
+ #: ../../source/quantization/llama.cpp.md:32 a2b26c45c99247f39ec8d90e92b7de07
60
+ msgid "Sometimes, it may be better to use fp32 as the start point for quantization. In that case, use"
61
+ msgstr "有时,可能最好将fp32作为量化的起点。在这种情况下,使用"
62
+
63
+ #: ../../source/quantization/llama.cpp.md:38 0d6321f7482a499f80747d78f2d01033
64
+ msgid "Quantizing the GGUF without Calibration"
65
+ msgstr "无校准量化GGUF"
66
+
67
+ #: ../../source/quantization/llama.cpp.md:40 807e22b6326346c99a29068b29aa2436
68
+ msgid "For the simplest way, you can directly quantize the model to lower-bits based on your requirements. An example of quantizing the model to 8 bits is shown below:"
69
+ msgstr "最简单的方法是,你可以根据需求直接将模型量化到低位数。下面是一个将模型量化到8 bit的例子:"
70
+
71
+ #: ../../source/quantization/llama.cpp.md:46 66cadafa9bc84365a53f870e8f0548cb
72
+ msgid "`Q8_0` is a code for a quantization preset. You can find all the presets in [the source code of `llama-quantize`](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/quantize.cpp). Look for the variable `QUANT_OPTIONS`. Common ones used for 8B models include `Q8_0`, `Q5_K_M`, and `Q4_K_M`. The letter case doesn't matter, so `q8_0` or `q4_K_m` are perfectly fine."
73
+ msgstr "`Q8_0`是一个量化预设的代号。你可以在[`llama-quantize`的源代码](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/quantize.cpp)中找到所有预设。寻找变量`QUANT_OPTIONS`。对于 8B 模型常用的包括`Q8_0`、`Q5_K_M`和`Q4_K_M`。字母大小写不重要,所以`q8_0`或`q4_K_m`都是可以接受的。"
74
+
75
+ #: ../../source/quantization/llama.cpp.md:52 d4cce644d247439ebf58c01f1916aabe
76
+ msgid "Now you can use the GGUF file of the quantized model with applications based on llama.cpp. Very simple indeed."
77
+ msgstr "现在,你可以使用基于llama.cpp的应用程序中的量化模型的GGUF文件。确实很简单。"
78
+
79
+ #: ../../source/quantization/llama.cpp.md:55 292de0cf1cfa48b1859c274185a456ac
80
+ msgid "However, the accuracy of the quantized model could be lower than expected occasionally, especially for lower-bit quantization. The program may even prevent you from doing that."
81
+ msgstr "然而,量化模型的准确性偶尔可能低于预期,特别是对于低位数量化。程序甚至可能阻止你这样做。"
82
+
83
+ #: ../../source/quantization/llama.cpp.md:58 fc9efc3991b04d1192f26ea93635aaef
84
+ msgid "There are several ways to improve quality of quantized models. A common way is to use a calibration dataset in the target domain to identify the weights that really matter and quantize the model in a way that those weights have lower quantization errors, as introduced in the next two methods."
85
+ msgstr "有几种方法可以提高量化模型的质量。一种常见的方法是在目标域中使用校准数据集来识别真正重要的权重,并以这些权重具有较低量化误差的方式量化模型,如下两种方法中将介绍。"
86
+
87
+ #: ../../source/quantization/llama.cpp.md:62 a1467369a0c04c0da45d555e43e42635
88
+ msgid "Quantizing the GGUF with AWQ Scale"
89
+ msgstr "使用AWQ尺度量化GGUF"
90
+
91
+ #: ../../source/quantization/llama.cpp.md:65 2cc212d09e8d4e8b912c24dd2a27f35a
92
+ msgid "To be updated for Qwen3."
93
+ msgstr "仍需为Qwen3更新。"
94
+
95
+ #: ../../source/quantization/llama.cpp.md:68 da955f0aaa564ec4b5584fe4fb1fbda0
96
+ msgid "To improve the quality of your quantized models, one possible solution is to apply the AWQ scale, following [this script](https://github.com/casper-hansen/AutoAWQ/blob/main/docs/examples.md#gguf-export). First, when you run `model.quantize()` with `autoawq`, remember to add `export_compatible=True` as shown below:"
97
+ msgstr "为了提高量化模型的质量,一种可能的解决方案是应用AWQ尺度,遵循[这个脚本](https://github.com/casper-hansen/AutoAWQ/blob/main/docs/examples.md#gguf-export)。首先,当你使用`autoawq`运行`model.quantize()`时,记得添加`export_compatible=True`,如下所示:"
98
+
99
+ #: ../../source/quantization/llama.cpp.md:81 1be192c485db4fcd876568e9faacac4b
100
+ msgid "The above code will not actually quantize the weights. Instead, it adjusts weights based on a dataset so that they are \"easier\" to quantize.[^AWQ]"
101
+ msgstr "上述代码实际上不会量化权重。相反,它会根据数据集调整权重,使它们“更容易”量化。[^AWQ]"
102
+
103
+ #: ../../source/quantization/llama.cpp.md:84 10aa1c71ed9d4553bab3d2bc5aba08e8
104
+ msgid "Then, when you run `convert-hf-to-gguf.py`, remember to replace the model path with the path to the new model:"
105
+ msgstr "然后,当你运行`convert-hf-to-gguf.py`时,记得将模型路径替换为新模型的路径:"
106
+
107
+ #: ../../source/quantization/llama.cpp.md:89 99b87ba88b84422983b60584515fc924
108
+ msgid "Finally, you can quantize the model as in the last example:"
109
+ msgstr "最后,你可以像最后一个例子那样量化模型:"
110
+
111
+ #: ../../source/quantization/llama.cpp.md:94 8c2b985fccf54302b8175a50f34304e8
112
+ msgid "In this way, it should be possible to achieve similar quality with lower bit-per-weight."
113
+ msgstr "这样,应该有可能以更低的bpw实现相似的质量。"
114
+
115
+ #: ../../source/quantization/llama.cpp.md:100 b35ae6045d8045d6a4f6cfe0b8a86f5e
116
+ msgid "Quantizing the GGUF with Importance Matrix"
117
+ msgstr "使用重要性矩阵量化GGUF"
118
+
119
+ #: ../../source/quantization/llama.cpp.md:102 2e5cafdf307d430d9e34e3bb2c60bbf2
120
+ msgid "Another possible solution is to use the \"important matrix\"[^imatrix], following [this](https://github.com/ggml-org/llama.cpp/tree/master/tools/imatrix)."
121
+ msgstr "另一个可能的解决方案是使用\"重要矩阵\"[^imatrix],参照[这里](https://github.com/ggml-org/llama.cpp/tree/master/tools/imatrix)。"
122
+
123
+ #: ../../source/quantization/llama.cpp.md:104 1aeee4c40d034cff890bc076983530e4
124
+ msgid "First, you need to compute the importance matrix data of the weights of a model (`-m`) using a calibration dataset (`-f`):"
125
+ msgstr "首先,你需要使用校准数据集(`-f`)计算模型权重的重要性矩阵数据(`-m`):"
126
+
127
+ #: ../../source/quantization/llama.cpp.md:109 b679568784524852a1736d3be54ac50f
128
+ msgid "The text is cut in chunks of length `--chunk` for computation. Preferably, the text should be representative of the target domain. The final results will be saved in a file named `Qwen3-8B-imatrix.dat` (`-o`), which can then be used:"
129
+ msgstr "文本被切割成长度为`--chunk`的块进行计算。最好,文本应代表目标领域。最终结果将保存在名为`qwen3-8b-imatrix.dat`(`-o`)的文件中,然后可以使用:"
130
+
131
+ #: ../../source/quantization/llama.cpp.md:117 4f13b845d25a4beea4f072de70b95c32
132
+ msgid "For lower-bit quantization mixtures for 1-bit or 2-bit, if you do not provide `--imatrix`, a helpful warning will be printed by `llama-quantize`."
133
+ msgstr "对于1 bit或2 bit的低位数量化混合,如果你不提供`--imatrix`,`llama-quantize`将打印出有用的警告。"
134
+
135
+ #: ../../source/quantization/llama.cpp.md:121 c3308e36443949e3be37bf1ceee2d56f
136
+ msgid "Perplexity Evaluation"
137
+ msgstr "困惑度(Perplexity)评估"
138
+
139
+ #: ../../source/quantization/llama.cpp.md:123 5a84b0a3e7e647ed8f453baf9f9309c8
140
+ msgid "`llama.cpp` provides an example program for us to calculate the perplexity, which evaluate how unlikely the given text is to the model. It should be mostly used for comparisons: the lower the perplexity, the better the model remembers the given text."
141
+ msgstr "`llama.cpp`为我们提供了一个示例程序来计算困惑度,这评估了给定文本对模型而言的“不可能”程度。它主要用于比较:困惑度越低,模型对给定文本的记忆越好。"
142
+
143
+ #: ../../source/quantization/llama.cpp.md:126 cf72d076477a42f497034e2f670c119d
144
+ msgid "To do this, you need to prepare a dataset, say \"wiki test\"[^wiki]. You can download the dataset with:"
145
+ msgstr "要做到这一点,你需要准备一个数据集,比如\"wiki测试集\"[^wiki]。你可以使用以下命令下载数据集:"
146
+
147
+ #: ../../source/quantization/llama.cpp.md:133 d16427f201af46c2bc8204d61b82f8b5
148
+ msgid "Then you can run the test with the following command:"
149
+ msgstr "然后你可以使用以下命令运行测试:"
150
+
151
+ #: ../../source/quantization/llama.cpp.md:137 56d6bd741ec64dee91a994c708620838
152
+ msgid "Wait for some time and you will get the perplexity of the model. There are some numbers of different kinds of quantization mixture [here](https://github.com/ggml-org/llama.cpp/blob/master/tools/perplexity/README.md). It might be helpful to look at the difference and grab a sense of how that kind of quantization might perform."
153
+ msgstr "稍等一段时间,你将得到模型的困惑度。[这里](https://github.com/ggml-org/llama.cpp/blob/master/tools/perplexity/README.md)提供了不同类型的量化模型的数值。观察差异可能有助于理解不同量化方式的潜在表现。"
154
+
155
+ #: ../../source/quantization/llama.cpp.md:144 589fad71ce69495fa259e51035baf046
156
+ msgid "Finally"
157
+ msgstr "结束语"
158
+
159
+ #: ../../source/quantization/llama.cpp.md:146 2ac61288357b43a3b6932b226a785bb1
160
+ msgid "In this guide, we demonstrate how to conduct quantization and evaluate the perplexity with llama.cpp. For more information, please visit the [llama.cpp GitHub repo](https://github.com/ggml-org/llama.cpp)."
161
+ msgstr "在本指南中,我们展示了如何使用llama.cpp进行量化和评估困惑度。更多信息,请访问[llama.cpp GitHub仓库](https://github.com/ggml-org/llama.cpp)。"
162
+
163
+ #: ../../source/quantization/llama.cpp.md:149 8cb576b8079e4dfeaca0ab06f7d9f4e4
164
+ #, fuzzy
165
+ msgid "We usually quantize the fp16 model to 4, 5, 6, and 8-bit models with different quantization mixtures, but sometimes a particular mixture just does not work, so we don't provide those in our Hugging Face Hub. However, others in the community may have success, so if you haven't found what you need in our repos, look around."
166
+ msgstr "我们通常将fp16模型量化为4、5、6和8位模型,采用不同的量化混合,但有时特定的混合就是不起作用,所以我们不在HuggingFace Hub中提供这些。但是,社区中的其他人可能会成功,因此,如果你在我们的仓库中没有找到所需的内容,请四处看看。"
167
+
168
+ #: ../../source/quantization/llama.cpp.md:152 1b2b1b45246c4539bc30b684b818676f
169
+ msgid "Enjoy your freshly quantized models!"
170
+ msgstr "享受你新鲜量化的模型吧!"
171
+
172
+ #: ../../source/quantization/llama.cpp.md:96 5d42d043024a4425a3b4d2d846c6aa59
173
+ msgid "If you are interested in what this means, refer to [the AWQ paper](https://arxiv.org/abs/2306.00978). Basically, important weights (called salient weights in the paper) are identified based on activations across data examples. The weights are scaled accordingly such that the salient weights are protected even after quantization."
174
+ msgstr "如果你对这意味着什么感兴趣,请参阅[AWQ论文](https://arxiv.org/abs/2306.00978)。基本上,根据数据实例上的激活,识别出重要的权重(在论文中称为显著权重)。相应地缩放权重,以便即使在量化后也能保护显著权重。"
175
+
176
+ #: ../../source/quantization/llama.cpp.md:119 8b25ee3804f24fa798a79299899ab860
177
+ msgid "Here, the importance matrix keeps record of how weights affect the output: the weight should be important is a slight change in its value causes huge difference in the results, akin to the [GPTQ](https://arxiv.org/abs/2210.17323) algorithm."
178
+ msgstr "在这里,重要性矩阵记录了权重如何影响输出:如果权重的微小变化导致结果的巨大差异,则该权重应该是重要的,类似于[GPTQ](https://arxiv.org/abs/2210.17323)算法。"
179
+
180
+ #: ../../source/quantization/llama.cpp.md:141 1fd3ddb3e40a47ffb4cc5a2604918ad7
181
+ msgid "It is not a good evaluation dataset for instruct models though, but it is very common and easily accessible. You probably want to use a dataset similar to your target domain."
182
+ msgstr "虽然它不是指导模型的良好评估数据集,但它非常常见且易于访问。你可能希望使用与目标领域相似的数据集。"
183
+
docs/locales/zh_CN/LC_MESSAGES/run_locally/llama.cpp.po ADDED
@@ -0,0 +1,671 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-04-29 16:34+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.17.0\n"
18
+
19
+ #: ../../source/run_locally/llama.cpp.md:1 982af2ecb7ee4933a0dc9541c000ff4d
20
+ msgid "llama.cpp"
21
+ msgstr "llama.cpp"
22
+
23
+ #: ../../source/run_locally/llama.cpp.md c1891b9c45ff48f0b0b350eedc1164ab
24
+ msgid "llama.cpp as a C++ library"
25
+ msgstr "llama.cpp作为C++库"
26
+
27
+ #: ../../source/run_locally/llama.cpp.md:6 e2ddc412959146498ce64b91c05c3ca6
28
+ msgid "Before starting, let's first discuss what is llama.cpp and what you should expect, and why we say \"use\" llama.cpp, with \"use\" in quotes. llama.cpp is essentially a different ecosystem with a different design philosophy that targets light-weight footprint, minimal external dependency, multi-platform, and extensive, flexible hardware support:"
29
+ msgstr "开始之前,让我们先谈谈什么是llama.cpp,您应该期待什么,以及为什么我们说带引号“使用”llama.cpp。本质上,llama.cpp是一个不同的生态系统,具有不同的设计理念,旨在实现轻量级、最小外部依赖、多平台以及广泛灵活的硬件支持:"
30
+
31
+ #: ../../source/run_locally/llama.cpp.md:8 70559daade4b447fa28ea689bef9e2b5
32
+ msgid "Plain C/C++ implementation without external dependencies"
33
+ msgstr "纯粹的C/C++实现,没有外部依赖"
34
+
35
+ #: ../../source/run_locally/llama.cpp.md:9 d070ffe26c1f47eda51a08029b95f0f4
36
+ msgid "Support a wide variety of hardware:"
37
+ msgstr "支持广泛的硬件:"
38
+
39
+ #: ../../source/run_locally/llama.cpp.md:10 f27c8b0b95eb4635a458312e82b71ed7
40
+ msgid "AVX, AVX2 and AVX512 support for x86_64 CPU"
41
+ msgstr "x86_64 CPU的AVX、AVX2和AVX512支持"
42
+
43
+ #: ../../source/run_locally/llama.cpp.md:11 c09f100de65641c98c17a8c9fa927766
44
+ msgid "Apple Silicon via Metal and Accelerate (CPU and GPU)"
45
+ msgstr "通过Metal和Accelerate支持Apple Silicon(CPU和GPU)"
46
+
47
+ #: ../../source/run_locally/llama.cpp.md:12 b17e1127c1c74536bc9c61507832f7f6
48
+ msgid "NVIDIA GPU (via CUDA), AMD GPU (via hipBLAS), Intel GPU (via SYCL), Ascend NPU (via CANN), and Moore Threads GPU (via MUSA)"
49
+ msgstr "NVIDIA GPU(通过CUDA)、AMD GPU(通过hipBLAS)、Intel GPU(通过SYCL)、昇腾NPU(通过CANN)和摩尔线程GPU(通过MUSA)"
50
+
51
+ #: ../../source/run_locally/llama.cpp.md:13 8743a89578bd45afa1a17448258be6d2
52
+ msgid "Vulkan backend for GPU"
53
+ msgstr "GPU的Vulkan后端"
54
+
55
+ #: ../../source/run_locally/llama.cpp.md:14 89e6275312504236829fd6eb4f910217
56
+ msgid "Various quantization schemes for faster inference and reduced memory footprint"
57
+ msgstr "多种量化方案以加快推理速度并减少内存占用"
58
+
59
+ #: ../../source/run_locally/llama.cpp.md:15 c120b7fcdb184ceb869abb70bac6a1ab
60
+ msgid "CPU+GPU hybrid inference to partially accelerate models larger than the total VRAM capacity"
61
+ msgstr "CPU+GPU混合推理,以加速超过总VRAM容量的模型"
62
+
63
+ #: ../../source/run_locally/llama.cpp.md:17 bc4a92209a1d4a06bfc727b84be29090
64
+ msgid "It's like the Python frameworks `torch`+`transformers` or `torch`+`vllm` but in C++. However, this difference is crucial:"
65
+ msgstr "它就像 Python 框架 `torch`+`transformers` 或 `torch`+`vllm` 的组合,但用的是 C++。然而,这一差异至关重要:"
66
+
67
+ #: ../../source/run_locally/llama.cpp.md:19 a30d578f68aa43ae8479a0082cbd2d93
68
+ msgid "Python is an interpreted language: The code you write is executed line-by-line on-the-fly by an interpreter. You can run the example code snippet or script with an interpreter or a natively interactive interpreter shell. In addition, Python is learner friendly, and even if you don't know much before, you can tweak the source code here and there."
69
+ msgstr "Python 是一种解释型语言:编写的代码会被解释器逐行实时执行。你可以使用解释器或原生交互式解释器终端来运行示例代码片段或脚本。此外,Python 对学习者非常友好,即使你之前了解不多,也可能修改源代码。"
70
+
71
+ #: ../../source/run_locally/llama.cpp.md:23 5140d7332d874816bbf9ee3ceea88e37
72
+ msgid "C++ is a compiled language: The source code you write needs to be compiled beforehand, and it is translated to machine code and an executable program by a compiler. The overhead from the language side is minimal. You do have source code for example programs showcasing how to use the library. But it is not very easy to modify the source code if you are not verse in C++ or C."
73
+ msgstr "C++ 是一种编译型语言:你编写的源代码需要预先编译,由编译器将其转换为机器码和可执行程序,来自语言层面的开销微乎其微。llama.cpp也提供���示例程序的源代码,展示了如何使用该库。但是,如果你不精通 C++ 或 C 语言,修改源代码并不容易。"
74
+
75
+ #: ../../source/run_locally/llama.cpp.md:29 33262bc591a844159f033b5fe36324dd
76
+ msgid "To use llama.cpp means that you use the llama.cpp library in your own program, like writing the source code of [Ollama](https://ollama.com/), [LM Studio](https://lmstudio.ai/), [GPT4ALL](https://www.nomic.ai/gpt4all), [llamafile](https://llamafile.ai/) etc. But that's not what this guide is intended or could do. Instead, here we introduce how to use the `llama-cli` example program, in the hope that you know that llama.cpp does support Qwen2.5 models and how the ecosystem of llama.cpp generally works."
77
+ msgstr "真正使用 llama.cpp 意味着在自己的程序中使用 llama.cpp 库,就像编写 [Ollama](https://ollama.com/)、[LM Studio](https://lmstudio.ai/)、[GPT4ALL](https://www.nomic.ai/gpt4all)、[llamafile](https://llamafile.ai/) 等的源代码。但这并不是本指南的目的或所能做的。相反,这里我们介绍如何使用 `llama-cli` 示例程序,希望你能了解到 llama.cpp 支持 Qwen2.5 模型以及 llama.cpp 生态系统的一般工作原理。"
78
+
79
+ #: ../../source/run_locally/llama.cpp.md:34 ed26c043c56143bb87185ff669d6d8cf
80
+ msgid "In this guide, we will show how to \"use\" [llama.cpp](https://github.com/ggml-org/llama.cpp) to run models on your local machine, in particular, the `llama-cli` and the `llama-server` example program, which comes with the library."
81
+ msgstr "在这份指南中,我们将讨论如何“使用” [llama.cpp](https://github.com/ggml-org/llama.cpp) 在您的本地机器上运行模型,特别是随库提供的 `llama-cli` 和 `llama-server` 示例程序。"
82
+
83
+ #: ../../source/run_locally/llama.cpp.md:36 f2e1113691cc4c18b6bd46bdf8ea09ac
84
+ msgid "The main steps are:"
85
+ msgstr "主要步骤如下:"
86
+
87
+ #: ../../source/run_locally/llama.cpp.md:37 8e663f68bd6b407a840c8e1748865021
88
+ msgid "Get the programs"
89
+ msgstr "获取程序"
90
+
91
+ #: ../../source/run_locally/llama.cpp.md:38 26e13906aeca465bbf9a0f3f2333c955
92
+ msgid "Get the Qwen3 models in GGUF[^GGUF] format"
93
+ msgstr "获取 GGUF[^GGUF] 格式的 Qwen3 模型"
94
+
95
+ #: ../../source/run_locally/llama.cpp.md:39 3e904b0aec454270b7eca787f0fd0371
96
+ msgid "Run the program with the model"
97
+ msgstr "使用模型运行程序"
98
+
99
+ #: ../../source/run_locally/llama.cpp.md:42 c4288c0e92f049dd9445f2b004aad048
100
+ msgid "llama.cpp supports Qwen3 and Qwen3MoE from version `b5092`."
101
+ msgstr "llama.cpp 自版本 `b5092` 支持 Qwen3 和 Qwen3MoE 。"
102
+
103
+ #: ../../source/run_locally/llama.cpp.md:45 1088c7e273504ee8b1ea5c88464f9460
104
+ msgid "Getting the Program"
105
+ msgstr "获取程序"
106
+
107
+ #: ../../source/run_locally/llama.cpp.md:47 768fb32dd36442eb9d03612cee4f7e78
108
+ msgid "You can get the programs in various ways. For optimal efficiency, we recommend compiling the programs locally, so you get the CPU optimizations for free. However, if you don't have C++ compilers locally, you can also install using package managers or downloading pre-built binaries. They could be less efficient but for non-production example use, they are fine."
109
+ msgstr "你可以通过多种方式获得 llama.cpp 中的程序。为了达到最佳效率,我们建议你本地编译程序,这样可以零成本享受CPU优化。但是,如果你的本地环境没有C++编译器,也可以使用包管理器安装或者下载预编译的二进制文件。虽然它们可能效率较低,但对于非生产用途的例子来说,它们已经足够好用了。"
110
+
111
+ #: ../../source/run_locally/llama.cpp.md 023a89efd9914b62a95a70abbabe4fe5
112
+ msgid "Compile Locally"
113
+ msgstr "本地编译"
114
+
115
+ #: ../../source/run_locally/llama.cpp.md:56 154aaf9730724f7c8f8cd80b01ea5b41
116
+ msgid "Here, we show the basic command to compile `llama-cli` locally on **macOS** or **Linux**. For Windows or GPU users, please refer to [the guide from llama.cpp](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md)."
117
+ msgstr "这里,我们将展示在 **macOS** 或 **Linux** 上本地编译 `llama-cli` 的基本命令。对于 Windows 用户或 GPU 用户,请参考[llama.cpp的指南](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md)。"
118
+
119
+ #: ../../source/run_locally/llama.cpp.md 5d61b0f1887b497599be5723e08602a5
120
+ msgid "Installing Build Tools"
121
+ msgstr "安装构建工具"
122
+
123
+ #: ../../source/run_locally/llama.cpp.md:63 772ed9c6cdfc4e28b35e0c50c9bc1051
124
+ msgid "To build locally, a C++ compiler and a build system tool are required. To see if they have been installed already, type `cc --version` or `cmake --version` in a terminal window."
125
+ msgstr "要进行本地构建,你需要一个C++编译器和一个构建系统工具。在终端窗口中输入`cc --version`或`cmake --version`,看看这些工具是否已经安装好了。"
126
+
127
+ #: ../../source/run_locally/llama.cpp.md:65 f271663e625a439695399a11779cb03e
128
+ msgid "If installed, the build configuration of the tool will be printed to the terminal, and you are good to go!"
129
+ msgstr "如果已安装,工具的构建配置信息将被打印到终端,那么你就可以开始了!"
130
+
131
+ #: ../../source/run_locally/llama.cpp.md:66 774a4a0edb1444cebdde08038581c294
132
+ msgid "If errors are raised, you need to first install the related tools:"
133
+ msgstr "如果出现错误,说明你需要先安装相关工具:"
134
+
135
+ #: ../../source/run_locally/llama.cpp.md:67 6e1c6860a47d49e9bcc625eb8b3be542
136
+ msgid "On macOS, install with the command `xcode-select --install`"
137
+ msgstr "在macOS上,使用命令`xcode-select --install`来安装。"
138
+
139
+ #: ../../source/run_locally/llama.cpp.md:68 186197e49f2542f4837c442b1529d739
140
+ msgid "On Ubuntu, install with the command `sudo apt install build-essential`. For other Linux distributions, the command may vary; the essential packages needed for this guide are `gcc` and `cmake`."
141
+ msgstr "在Ubuntu上,使用命令`sudo apt install build-essential`来安装。对于其他Linux发行版,命令可能会有所不同;本指南所需的基本包是`gcc`和`cmake`。"
142
+
143
+ #: ../../source/run_locally/llama.cpp.md a3d68cbcf5834203bc8fd5892edbc7dc
144
+ msgid "Compiling the Program"
145
+ msgstr "编译程序"
146
+
147
+ #: ../../source/run_locally/llama.cpp.md:75 1be0da28ab7f4d46bcde3311153d5f0b
148
+ msgid "For the first step, clone the repo and enter the directory:"
149
+ msgstr "第一步是克隆仓库并进入该目录:"
150
+
151
+ #: ../../source/run_locally/llama.cpp.md:81 3c38e7800b984d63906d139d915cad3e
152
+ msgid "Then, build llama.cpp using CMake:"
153
+ msgstr "随后,使用 CMake 执行 llama.cpp 构建:"
154
+
155
+ #: ../../source/run_locally/llama.cpp.md:87 584374ec3d74489180ad99dd99aceaea
156
+ msgid "The first command will check the local environment and determine which backends and features should be included. The second command will actually build the programs."
157
+ msgstr "第一条命令将检查本地环境并确定需要包含的推理后端与特性。第二条命令将实际构建程序文件。"
158
+
159
+ #: ../../source/run_locally/llama.cpp.md:90 f728bdbb8e234fbaab608a956c31463e
160
+ msgid "To shorten the time, you can also enable parallel compiling based on the CPU cores you have, for example:"
161
+ msgstr "为了缩短时间,你还可以根据你的CPU核心数开启并行编译,例如:"
162
+
163
+ #: ../../source/run_locally/llama.cpp.md:94 7fc43a28aadf4ab7aef94979d350c3e4
164
+ msgid "This will build the programs with 8 parallel compiling jobs."
165
+ msgstr "这将以8个并行编译任务来构建程序。"
166
+
167
+ #: ../../source/run_locally/llama.cpp.md:96 89a5aaa7baa6455e9662a8e5e8204fd0
168
+ msgid "The built programs will be in `./build/bin/`."
169
+ msgstr "结果将存于 `./build/bin/` 。"
170
+
171
+ #: ../../source/run_locally/llama.cpp.md 8073a459b60f4c5a994f10a61c7b9655
172
+ msgid "Package Managers"
173
+ msgstr "软件包管理器"
174
+
175
+ #: ../../source/run_locally/llama.cpp.md:101 6883e24e533a4e028ceda9ac23037cfe
176
+ msgid "For **macOS** and **Linux** users, `llama-cli` and `llama-server` can be installed with package managers including Homebrew, Nix, and Flox."
177
+ msgstr "对于**macOS**和**Linux**用户,`llama-cli` 和 `llama-server` 可以通过包括 Homebrew、Nix 和 Flox 在内的软件包管理器进行安装。"
178
+
179
+ #: ../../source/run_locally/llama.cpp.md:103 d59800138ade43daaf35404b86c4c1e0
180
+ msgid "Here, we show how to install `llama-cli` and `llama-server` with Homebrew. For other package managers, please check the instructions [here](https://github.com/ggml-org/llama.cpp/blob/master/docs/install.md)."
181
+ msgstr "在这里,我们展示如何使用 Homebrew 安装 `llama-cli` 和 `llama-server` 。对于其他软件包管理器的安装,请查阅[这里的指南](https://github.com/ggml-org/llama.cpp/blob/master/docs/install.md)。"
182
+
183
+ #: ../../source/run_locally/llama.cpp.md:106 09a865816ad04e0cb739ff081f6a3c5e
184
+ msgid "Installing with Homebrew is very simple:"
185
+ msgstr "使用 Homebrew 安装非常简单:"
186
+
187
+ #: ../../source/run_locally/llama.cpp.md:108 ec9e701fec054699882486d33cc6759d
188
+ msgid "Ensure that Homebrew is available on your operating system. If you don't have Homebrew, you can install it as in [its website](https://brew.sh/)."
189
+ msgstr "请确保您的操作系统上已安装有 Homebrew。如果没有,您可以按照[官网](https://brew.sh/)上的指导进行安装。"
190
+
191
+ #: ../../source/run_locally/llama.cpp.md:111 6828ec93205945358c02caa71b30db14
192
+ msgid "Second, you can install the pre-built binaries, `llama-cli` and `llama-server` included, with a single command:"
193
+ msgstr "其次,您只需一条命令即可安装预先编译好的二进制文件,其中包括 `llama-cli` 和 `llama-server` :"
194
+
195
+ #: ../../source/run_locally/llama.cpp.md:116 735fa54f0a68459eb0a66c4b4b14ef2e
196
+ msgid "Note that the installed binaries might not be built with the optimal compile options for your hardware, which can lead to poor performance. They also don't support GPU on Linux systems."
197
+ msgstr "请注意,安装的二进制文件可能并未针对您的硬件优化编译选项,这可能导致性能不佳。此外,在 Linux 系统上它们也不支持 GPU。"
198
+
199
+ #: ../../source/run_locally/llama.cpp.md 6a7aa0679f0f4ff08378e7085b5d9ca5
200
+ msgid "Binary Release"
201
+ msgstr "二进制文件"
202
+
203
+ #: ../../source/run_locally/llama.cpp.md:122 747170630f41428fb98cfb26c0b2cbb4
204
+ msgid "You can also download pre-built binaries from [GitHub Releases](https://github.com/ggml-org/llama.cpp/releases). Please note that those pre-built binaries files are architecture-, backend-, and os-specific. If you are not sure what those mean, you probably don't want to use them and running with incompatible versions will most likely fail or lead to poor performance."
205
+ msgstr "您还可以从[GitHub Release](https://github.com/ggml-org/llama.cpp/releases)下载预构建的二进制文件。请注意,这些预构建的二进制文件是特定于架构、后端和操作系统的。如果您不确定这些意味着什么,可能您并不想使用它们。使用不兼容的版本很可能导致运行失败或性能不佳。"
206
+
207
+ #: ../../source/run_locally/llama.cpp.md:126 4d9c79d4a17544f8a82733204568b9e5
208
+ msgid "The file name is like `llama-<version>-bin-<os>-<feature>-<arch>.zip`."
209
+ msgstr "文件名类似于`llama-<version>-bin-<os>-<feature>-<arch>.zip`。"
210
+
211
+ #: ../../source/run_locally/llama.cpp.md:128 9128b08da0aa4389b67870a64e80326b
212
+ msgid "There are three simple parts:"
213
+ msgstr "分为三个简单部分:"
214
+
215
+ #: ../../source/run_locally/llama.cpp.md:129 4e94cb63609a4cfb84a44730f2e45ec1
216
+ msgid "`<version>`: the version of llama.cpp. The latest is preferred, but as llama.cpp is updated and released frequently, the latest may contain bugs. If the latest version does not work, try the previous release until it works."
217
+ msgstr "`<version>`:llama.cpp的版本。建议使用最新版本,但鉴于llama.cpp频繁更新和发布,最新版本可能包含bug。如果最新版本无法正常工作,请尝试之前的版本直到找到能正常工作的为止。"
218
+
219
+ #: ../../source/run_locally/llama.cpp.md:130 da97ae4a462c4b29a68a16f99d52b5a6
220
+ msgid "`<os>`: the operating system. `win` for Windows; `macos` for macOS; `linux` for Linux."
221
+ msgstr "`<os>`:操作系统。`win`代表Windows;`macos`代表macOS;`linux`代表Linux。"
222
+
223
+ #: ../../source/run_locally/llama.cpp.md:131 a181b5105d9b4a3190c8bb4fc78647c6
224
+ msgid "`<arch>`: the system architecture. `x64` for `x86_64`, e.g., most Intel and AMD systems, including Intel Mac; `arm64` for `arm64`, e.g., Apple Silicon or Snapdragon-based systems."
225
+ msgstr "`<arch>`:系统架构。`x64`对应`x86_64`,例如大多数Intel和AMD系统,包括Intel Mac;`arm64`对应`arm64`,例如Apple Silicon或基于Snapdragon的系统。"
226
+
227
+ #: ../../source/run_locally/llama.cpp.md:133 cc2af4ec4e6f4d2fafbf3b022280097b
228
+ msgid "The `<feature>` part is somewhat complicated for Windows:"
229
+ msgstr "`<feature>`部分对于Windows来说有些复杂:"
230
+
231
+ #: ../../source/run_locally/llama.cpp.md:134 fd08c220cf414c48a6a776c69170ffa1
232
+ msgid "Running on CPU"
233
+ msgstr "在CPU上运行"
234
+
235
+ #: ../../source/run_locally/llama.cpp.md:135 2e0d36b4509e4a229ecf594f759092e0
236
+ msgid "x86_64 CPUs: We suggest try the `avx2` one first."
237
+ msgstr "x86_64 CPU:我们建议首先尝试`avx2`。"
238
+
239
+ #: ../../source/run_locally/llama.cpp.md:136 57dbb29cef6f4962b76760fac98def5c
240
+ msgid "`noavx`: No hardware acceleration at all."
241
+ msgstr "`noavx`:完全无AVX硬件加速。"
242
+
243
+ #: ../../source/run_locally/llama.cpp.md:137 a2ecf0f937994dbba85e1ca6c8423ea3
244
+ msgid "`avx2`, `avx`, `avx512`: SIMD-based acceleration. Most modern desktop CPUs should support avx2, and some CPUs support `avx512`."
245
+ msgstr "`avx2`,`avx`,`avx512`:基于SIMD的加速。大多数现代桌面CPU应该支持AVX2,部分CPU支持AVX512。"
246
+
247
+ #: ../../source/run_locally/llama.cpp.md:138 85a4552c023a4ec0967e5f3127f3bf1f
248
+ msgid "`openblas`: Relying on OpenBLAS for acceleration for prompt processing but not generation."
249
+ msgstr "`openblas`:依赖OpenBLAS加速提示词(prompt)处理,但不涉及生成过程。"
250
+
251
+ #: ../../source/run_locally/llama.cpp.md:139 5b0605a7a543494d985a78bb94d9d995
252
+ msgid "arm64 CPUs: We suggest try the `llvm` one first."
253
+ msgstr "arm64 CPU:我们建议首先尝试`llvm`。"
254
+
255
+ #: ../../source/run_locally/llama.cpp.md:140 5800b70afa0d46fca439d90f6def1c36
256
+ msgid "[`llvm` and `msvc`](https://github.com/ggml-org/llama.cpp/pull/7191) are different compilers"
257
+ msgstr "[`llvm`和`msvc`](https://github.com/ggml-org/llama.cpp/pull/7191)是不同的编译器"
258
+
259
+ #: ../../source/run_locally/llama.cpp.md:141 091caad783814d16ac4a4aaefd43f360
260
+ msgid "Running on GPU: We suggest try the `cu<cuda_verison>` one for NVIDIA GPUs, `kompute` for AMD GPUs, and `sycl` for Intel GPUs first. Ensure that you have related drivers installed."
261
+ msgstr "在GPU上运行:我们建议NVIDIA GPU先尝试`cu<cuda_verison>`,AMD GPU先尝试`kompute`,Intel GPU先尝试`sycl`。请确保已安装相关驱动程序。"
262
+
263
+ #: ../../source/run_locally/llama.cpp.md:142 cb77636288d84a6ab7e6659d813d184e
264
+ msgid "[`vulcan`](https://github.com/ggml-org/llama.cpp/pull/2059): support certain NVIDIA and AMD GPUs"
265
+ msgstr "[`vulcan`](https://github.com/ggml-org/llama.cpp/pull/2059):支持某些NVIDIA和AMD GPU"
266
+
267
+ #: ../../source/run_locally/llama.cpp.md:143 3dcbdb057df64027af6da72b016a3ed1
268
+ msgid "[`kompute`](https://github.com/ggml-org/llama.cpp/pull/4456): support certain NVIDIA and AMD GPUs"
269
+ msgstr "[`kompute`](https://github.com/ggml-org/llama.cpp/pull/4456):支持某些NVIDIA和AMD GPU"
270
+
271
+ #: ../../source/run_locally/llama.cpp.md:144 0fdc7d54cbd4422ab690df1ac14f8052
272
+ msgid "[`sycl`](https://github.com/ggml-org/llama.cpp/discussions/5138): Intel GPUs, oneAPI runtime is included"
273
+ msgstr "[`sycl`](https://github.com/ggml-org/llama.cpp/discussions/5138):Intel GPU,包含oneAPI运行时"
274
+
275
+ #: ../../source/run_locally/llama.cpp.md:145 79941a71446c42eaa2375088cf24c41d
276
+ msgid "`cu<cuda_verison>`: NVIDIA GPUs, CUDA runtime is not included. You can download the `cudart-llama-bin-win-cu<cuda_version>-x64.zip` and unzip it to the same directory if you don't have the corresponding CUDA toolkit installed."
277
+ msgstr "`cu<cuda_verison>`:NVIDIA GPU,未包含CUDA运行时。如果您没有安装相应的CUDA工具包,可以下载`cudart-llama-bin-win-cu<cuda_version>-x64.zip`并将其解压到同一目录中。"
278
+
279
+ #: ../../source/run_locally/llama.cpp.md:147 0cdf63d30fbc4aa3a94c25d7f7cf5824
280
+ msgid "You don't have much choice for macOS or Linux."
281
+ msgstr "对于macOS或Linux,您的选择不多。"
282
+
283
+ #: ../../source/run_locally/llama.cpp.md:148 fdc3d523acac4789b7921e614fbc30a3
284
+ msgid "Linux: only one prebuilt binary, `llama-<version>-bin-linux-x64.zip`, supporting CPU."
285
+ msgstr "Linux:仅有一个预构建的二进制文件`llama-<version>-bin-linux-x64.zip`,支持CPU。"
286
+
287
+ #: ../../source/run_locally/llama.cpp.md:149 af122ff340be459188638f019712eed1
288
+ msgid "macOS: `llama-<version>-bin-macos-x64.zip` for Intel Mac with no GPU support; `llama-<version>-bin-macos-arm64.zip` for Apple Silicon with GPU support."
289
+ msgstr "macOS:对于Intel Mac,使用`llama-<version>-bin-macos-x64.zip`(不支持GPU);对于Apple Silicon,使用`llama-<version>-bin-macos-arm64.zip`(支持GPU)。"
290
+
291
+ #: ../../source/run_locally/llama.cpp.md:151 a943b5242b7c40ce951c73a1781fc310
292
+ msgid "After downloading the `.zip` file, unzip them into a directory and open a terminal at that directory."
293
+ msgstr "下载`.zip`文件后,将其解压到一个目录中,并在该目录下打开终端。"
294
+
295
+ #: ../../source/run_locally/llama.cpp.md:156 beb40484138f4256b0553f5a6b2e0475
296
+ msgid "Getting the GGUF"
297
+ msgstr "获取 GGUF"
298
+
299
+ #: ../../source/run_locally/llama.cpp.md:158 54c848283fca422fb532af37cbe05e11
300
+ msgid "GGUF[^GGUF] is a file format for storing information needed to run a model, including but not limited to model weights, model hyperparameters, default generation configuration, and tokenizer."
301
+ msgstr "GGUF[^GGUF] 是一种文件格式,用于存储运行模型所需的信息,包括但不限于模型权重、模型超参数、默认生成配置和tokenzier。"
302
+
303
+ #: ../../source/run_locally/llama.cpp.md:160 e32110eeef8c4b9db68a739e09739ac1
304
+ msgid "You can use the official Qwen GGUFs from our Hugging Face Hub or prepare your own GGUF file."
305
+ msgstr "您可以使用我们 Hugging Face Hub 上的官方 Qwen GGUF 文件,或者自己准备 GGUF 文件。"
306
+
307
+ #: ../../source/run_locally/llama.cpp.md:162 bfacc2373da24a18bb9e2ebd7b290065
308
+ msgid "Using the Official Qwen3 GGUFs"
309
+ msgstr "使用官方 Qwen3 GGUF"
310
+
311
+ #: ../../source/run_locally/llama.cpp.md:164 8da7612136d14b67a20fbcc70828c043
312
+ msgid "We provide a series of GGUF models in our Hugging Face organization, and to search for what you need you can search the repo names with `-GGUF`."
313
+ msgstr "在我们的 Hugging Face 组织中,我们提供了一系列 GGUF 模型。要查找您需要的模型,可以在仓库名称中搜索 `-GGUF`。"
314
+
315
+ #: ../../source/run_locally/llama.cpp.md:166 dece3c73889d448ba9817e7a49dd932f
316
+ msgid "Download the GGUF model that you want with `huggingface-cli` (you need to install it first with `pip install huggingface_hub`):"
317
+ msgstr "使用 `huggingface-cli` 下载您想要的 GGUF 模型(首先需要通过 `pip install huggingface_hub` 进行安装):"
318
+
319
+ #: ../../source/run_locally/llama.cpp.md:171 3b23d1e4d7d347e09cf5faeec61b82a8
320
+ msgid "For example:"
321
+ msgstr "比如:"
322
+
323
+ #: ../../source/run_locally/llama.cpp.md:176 4c6758f24a5143ce8da71d3b19f1f95e
324
+ msgid "This will download the Qwen3-8B model in GGUF format quantized with the scheme Q4_K_M."
325
+ msgstr "这将下载采用 Q4_K_M 方案量化的 GGUF 格式的 Qwen3-8B model 模型。"
326
+
327
+ #: ../../source/run_locally/llama.cpp.md:178 234ea7b4b5a047a0ac20ba11857dbdc5
328
+ msgid "Preparing Your Own GGUF"
329
+ msgstr "准备您自己的 GGUF"
330
+
331
+ #: ../../source/run_locally/llama.cpp.md:180 f74e9a53f77446e6b0cc27e9026e6165
332
+ msgid "Model files from Hugging Face Hub can be converted to GGUF, using the `convert-hf-to-gguf.py` Python script. It does require you to have a working Python environment with at least `transformers` installed."
333
+ msgstr "可以使用 `convert-hf-to-gguf.py` Python 脚本将来自 Hugging Face Hub 的模型文件转换为 GGUF。这确实需要您拥有一个工作中的 Python 环境,并至少安装了 `transformers`。"
334
+
335
+ #: ../../source/run_locally/llama.cpp.md:183 ced933a20489466d98bfc3ef484baa3a
336
+ msgid "Obtain the source file if you haven't already:"
337
+ msgstr "如果尚未获取,请先获取源文件:"
338
+
339
+ #: ../../source/run_locally/llama.cpp.md:189 eb7dfdb39e034b318981c84cd112ac4e
340
+ msgid "Suppose you would like to use Qwen3-8B you can make a GGUF file for the fp16 model as shown below:"
341
+ msgstr "假设您想使用 Qwen3-8B,可以按照以下方式为 fp16 模型制作 GGUF 文件:"
342
+
343
+ #: ../../source/run_locally/llama.cpp.md:193 3baf125807e541399ced8f2cbdd9d338
344
+ msgid "The first argument to the script refers to the path to the HF model directory or the HF model name, and the second argument refers to the path of your output GGUF file. Remember to create the output directory before you run the command."
345
+ msgstr "脚本的第一个参数指的是 HF 模型目录或 HF 模型名称的路径,第二个参数指的是输出 GGUF 文件的路径。在运行命令前,请记得创建输出目录。"
346
+
347
+ #: ../../source/run_locally/llama.cpp.md:196 a090bc60c62a41eead46c08d67ea8e7b
348
+ msgid "The fp16 model could be a bit heavy for running locally, and you can quantize the model as needed. We introduce the method of creating and quantizing GGUF files in [this guide](../quantization/llama.cpp). You can refer to that document for more information."
349
+ msgstr "fp16 模型对于本地运行可能有些重,您可以根据需要对模型进行量化。我们在 [这份指南](../quantization/llama.cpp) 中介绍了创建和量化 GGUF 文件的方法。您可以参考该文档获取更多信息。"
350
+
351
+ #: ../../source/run_locally/llama.cpp.md:201 d4e0affd46394ed08217eba6cde11e61
352
+ msgid "Run Qwen with llama.cpp"
353
+ msgstr "使用 llama.cpp 运行 Qwen"
354
+
355
+ #: ../../source/run_locally/llama.cpp.md:204 9352e362c2a640a6984fa65f073dadf4
356
+ msgid "Regarding switching between thinking and non-thinking modes, while the soft switch is always available, the hard switch implemented in the chat template is not exposed in llama.cpp. The quick workaround is to pass [a custom chat template](../../source/assets/qwen3_nonthinking.jinja) equivalent to always `enable_thinking=False` via `--chat-template-file`."
357
+ msgstr "关于在思考模式和非思考模式之间切换,虽然软开关始终可用,但在聊天模板中实现的硬开关并未在 llama.cpp 中暴露。快速的解决方法是通过 `--chat-template-file` 传递一个等效于始终设置 `enable_thinking=False` 的[自定义聊天模板](../../source/assets/qwen3_nonthinking.jinja)。"
358
+
359
+ #: ../../source/run_locally/llama.cpp.md:210 76c238d78e7247d0a71d75961415ed9e
360
+ msgid "llama-cli"
361
+ msgstr ""
362
+
363
+ #: ../../source/run_locally/llama.cpp.md:212 4e4e1212c8b84613ad0da20c8e555aac
364
+ msgid "[llama-cli](https://github.com/ggml-org/llama.cpp/tree/master/tools/main) is a console program which can be used to chat with LLMs. Simple run the following command where you place the llama.cpp programs:"
365
+ msgstr "[llama-cli](https://github.com/ggml-org/llama.cpp/tree/master/tools/main) 是一个可用于与大型语言模型聊天的控制台程序。只需在放置 llama.cpp 程序的位置运行以下命令:"
366
+
367
+ #: ../../source/run_locally/llama.cpp.md:218 076c752f47bc46f1b0cbbf6425146f95
368
+ msgid "Here are some explanations to the above command:"
369
+ msgstr "以下是对上述命令的一些解释:"
370
+
371
+ #: ../../source/run_locally/llama.cpp.md:219 5f672fa5712c4bd5830c0b9aef7ae1de
372
+ msgid "**Model**: llama-cli supports using model files from local path, remote URL, or Hugging Face hub."
373
+ msgstr "**模型**:llama-cli 支持从本地路径、远程 URL 或 Hugging Face Hub 使用模型文件。"
374
+
375
+ #: ../../source/run_locally/llama.cpp.md:220 0be28620c8b94dc89edef6d6f153dd81
376
+ msgid "`-hf Qwen/Qwen3-8B-GGUF:Q8_0` in the above indicates we are using the model file from Hugging Face hub"
377
+ msgstr "上面的 `-hf Qwen/Qwen3-8B-GGUF:Q8_0` 表示我们使用的是来自 Hugging Face Hub 的模型文件。"
378
+
379
+ #: ../../source/run_locally/llama.cpp.md:221 53c0fb1b23794f59984dd71b9a2816c8
380
+ msgid "To use a local path, pass `-m qwen3-8b-q8_0.gguf` instead"
381
+ msgstr "要使用本地路径,传递 `-m qwen3-8b-q8_0.gguf` 即可。"
382
+
383
+ #: ../../source/run_locally/llama.cpp.md:222 0223c894c4f74e2d85a4b59212f81165
384
+ msgid "To use a remote URL, pass `-mu https://hf.co/Qwen/Qwen3-8B-GGUF/resolve/main/qwen3-8b-Q8_0.gguf?download=true` instead"
385
+ msgstr "要使用远程 URL,传递 `-mu https://hf.co/Qwen/Qwen3-8B-GGUF/resolve/main/qwen3-8b-Q8_0.gguf?download=true` 即可。"
386
+
387
+ #: ../../source/run_locally/llama.cpp.md:224 289230690cf14c909121197e999359fd
388
+ msgid "**Speed Optimization**:"
389
+ msgstr "**速度优化**:"
390
+
391
+ #: ../../source/run_locally/llama.cpp.md:225 1cbdfffaecc64d9cb7257ba9983505bd
392
+ msgid "CPU: llama-cli by default will use CPU and you can change `-t` to specify how many threads you would like it to use, e.g., `-t 8` means using 8 threads."
393
+ msgstr "CPU:llama-cli 默认会使用 CPU,您可以通过更改 `-t` 来指定希望使用的线程数,例如 `-t 8` 表示使用 8 个线程。"
394
+
395
+ #: ../../source/run_locally/llama.cpp.md:226 29434d4331ee4edebaa04b2aded1c558
396
+ msgid "GPU: If the programs are built with GPU support, you can use `-ngl`, which allows offloading some layers to the GPU for computation. If there are multiple GPUs, it will offload to all the GPUs. You can use `-dev` to control the devices used and `-sm` to control which kinds of parallelism is used. For example, `-ngl 99 -dev cuda0,cuda1 -sm row` means offload all layers to GPU 0 and GPU1 using the split mode row. Adding `-fa` may also speed up the generation."
397
+ msgstr "GPU:如果程序包含 GPU 支持,您可以使用 `-ngl`,它允许将一些层卸载到 GPU 进行计算。如果有多个 GPU,它会卸载到所有 GPU 上。您可以使用 `-dev` 控制使用的设备,并使用 `-sm` 控制使用的并行类型。例如,`-ngl 99 -dev cuda0,cuda1 -sm row` 表示使用 row 切分将所有层卸载到 GPU 0 和 GPU 1。添加 `-fa` 也可能加速生成。"
398
+
399
+ #: ../../source/run_locally/llama.cpp.md:232 260ef13ac441480db43d88e837c4b428
400
+ msgid "**Sampling Parameters**: llama.cpp supports [a variety of sampling methods](https://github.com/ggml-org/llama.cpp/tree/master/tools/main#generation-flags) and has default configuration for many of them. It is recommended to adjust those parameters according to the actual case and the recommended parameters from Qwen3 modelcard could be used as a reference. If you encounter repetition and endless generation, it is recommended to pass in addition `--presence-penalty` up to `2.0`."
401
+ msgstr "**采样参数**:llama.cpp 支持[多种采样方法](https://github.com/ggml-org/llama.cpp/tree/master/tools/main#generation-flags),并对其中许多方法有默认配置。建议根据实际情况调整这些参数,Qwen3 模型卡片中推荐的参数可作为参考。如果您遇到重复和无尽生成的情况,建议额外传递 `--presence-penalty`,最大值为 `2.0`。"
402
+
403
+ #: ../../source/run_locally/llama.cpp.md:236 7adb408bb15d4f1a94704ccef38985b5
404
+ msgid "**Context Management**: llama.cpp adopts the \"rotating\" context management by default. The `-c` controls the maximum context length (default 4096, 0 means loaded from model), and `-n` controls the maximum generation length each time (default -1 means infinite until ending, -2 means until context full). When the context is full but the generation doesn't end, the first `--keep` tokens (default 0, -1 means all) from the initial prompt is kept, and the first half of the rest is discarded. Then, the model continues to generate based on the new context tokens. You can set `--no-context-shift` to prevent this rotating behavior and the generation will stop once `-c` is reached."
405
+ msgstr "**上下文管理**:llama.cpp 默认采用“轮换”上下文管理方式。`-c` 控制最大上下文长度(默认值 4096,0 表示从模型加载),`-n` 控制每次生成的最大长度(默认值 -1 表示无限生成直到结束,-2 表示直到上下文满)。当上下文已满但生成未结束时,初始提示中的前 `--keep` 个 token(默认值 0,-1 表示全部)会被保留,其余部分的前半部分会被丢弃。然后,模型基于新的上下文 token 继续生成。您可以设置 `--no-context-shift` 来防止这种轮换行为,一旦达到 `-c`,生成就会停止。"
406
+
407
+ #: ../../source/run_locally/llama.cpp.md:242 7482a8749a8f48538ec10c7555c610be
408
+ msgid "llama.cpp supports YaRN, which can be enabled by `-c 131072 --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768`."
409
+ msgstr "llama.cpp 支持 YaRN,可以通过 `-c 131072 --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768` 启用。"
410
+
411
+ #: ../../source/run_locally/llama.cpp.md:243 6348ba3506f44f9ebd560f06cf3a221e
412
+ msgid "**Chat**: `--jinja` indicates using the chat template embedded in the GGUF which is preferred and `--color` indicates coloring the texts so that user input and model output can be better differentiated. If there is a chat template, like in Qwen3 models, llama-cli will enter chat mode automatically. To stop generation or exit press \"Ctrl+C\". You can use `-sys` to add a system prompt."
413
+ msgstr "**聊天**:`--jinja` 表示使用嵌入在 GGUF 中的聊天模板(推荐),`--color` 表示对文本进行着色,以便更好地区分用户输入和模型输出。如果有聊天模板(如 Qwen3 模型中),llama-cli 将自动进入聊天模式。要停止生成或退出,请按 \"Ctrl+C\"。您可以使用 `-sys` 添加系统提示。"
414
+
415
+ #: ../../source/run_locally/llama.cpp.md:249 4a1967a6131349e8a3ea16830b43994c
416
+ msgid "llama-server"
417
+ msgstr ""
418
+
419
+ #: ../../source/run_locally/llama.cpp.md:251 8633e2b491b44b5e9affa24651305d51
420
+ msgid "[llama-server](https://github.com/ggml-org/llama.cpp/tree/master/tools/server) is a simple HTTP server, including a set of LLM REST APIs and a simple web front end to interact with LLMs using llama.cpp."
421
+ msgstr "[llama-server](https://github.com/ggml-org/llama.cpp/tree/master/tools/server) 是一个简单的 HTTP 服务器,包含一组 LLM REST API 和一个简单的 Web 前端,用于通过 llama.cpp 与大型语言模型交互。"
422
+
423
+ #: ../../source/run_locally/llama.cpp.md:253 ef67ce21ceb049b8ada65370e31c56ba
424
+ msgid "The core command is similar to that of llama-cli. In addition, it supports thinking content parsing and tool call parsing."
425
+ msgstr "其核心命令与 llama-cli 类似。此外,它还支持思考内容解析和工具调用解析。"
426
+
427
+ #: ../../source/run_locally/llama.cpp.md:260 375210d2d2b440a482880a080082b7b6
428
+ msgid "By default, the server will listen at `http://localhost:8080` which can be changed by passing `--host` and `--port`. The web front end can be assessed from a browser at `http://localhost:8080/`. The OpenAI compatible API is at `http://localhost:8080/v1/`."
429
+ msgstr "默认情况下,服务器将在 `http://localhost:8080` 监听,可以通过传递 `--host` 和 `--port` 更改。Web 前端可以通过浏览器访问 `http://localhost:8080/`。兼容 OpenAI 的 API 位于 `http://localhost:8080/v1/`。"
430
+
431
+ #: ../../source/run_locally/llama.cpp.md:265 067e74dbd5b64c51bd0fbf795867f643
432
+ msgid "What's More"
433
+ msgstr "还有更多"
434
+
435
+ #: ../../source/run_locally/llama.cpp.md:267 47d05b10224e453e98b3a83ff1ed3a97
436
+ msgid "If you still find it difficult to use llama.cpp, don't worry, just check out other llama.cpp-based applications. For example, Qwen3 has already been officially part of Ollama and LM Studio, which are platforms for your to search and run local LLMs."
437
+ msgstr "如果你仍然觉得使用`llama-cli`有困难,别担心,可以尝试其他基于llama.cpp的应用程序。例如,Qwen3已经成为Ollama和LM Studio的官方组成部分,它们是用于搜索和运行本地LLM的平台。"
438
+
439
+ #: ../../source/run_locally/llama.cpp.md:270 fd6b04dbca6348b99702fbbbc2f427f1
440
+ msgid "Have fun!"
441
+ msgstr "玩得开心!"
442
+
443
+ #: ../../source/run_locally/llama.cpp.md:3 35adceca5d514edf9bfc686a8722a38f
444
+ msgid "GPT-Generated Unified Format"
445
+ msgstr ""
446
+
447
+ #~ msgid "Previously, Qwen2 models generate nonsense like `GGGG...` with `llama.cpp` on GPUs. The workaround is to enable flash attention (`-fa`), which uses a different implementation, and offload the whole model to the GPU (`-ngl 80`) due to broken partial GPU offloading with flash attention."
448
+ #~ msgstr "曾有一段时间,在 GPU 上用 `llama.cpp` 运行 Qwen2 模型会生成类似 `GGGG...` 的胡言乱语。一个权宜之计是开启 flash attention (`-fa`) 并将全模型加载到 GPU 上 (`-ngl 80`) 。前者使用不同的算法实现,后者避免触发 flash attention 在模型一部分 GPU 加载时的异常。"
449
+
450
+ #~ msgid "Both should be no longer necessary after `b3370`, but it is still recommended enabling both for maximum efficiency."
451
+ #~ msgstr "自版本 `b3370` 起,以上方案已非必需。但考虑最佳效率,仍建议使用两项参数。"
452
+
453
+ #~ msgid "![llama-cli conversation start](../assets/imgs/llama-cli-cnv-start.png)"
454
+ #~ msgstr ""
455
+
456
+ #~ msgid "llama-cli conversation start"
457
+ #~ msgstr "llama-cli 对话开始"
458
+
459
+ #~ msgid "![llama-cli conversation chat](../assets/imgs/llama-cli-cnv-chat.png)"
460
+ #~ msgstr ""
461
+
462
+ #~ msgid "llama-cli conversation chat"
463
+ #~ msgstr "llama-cli 对话聊天"
464
+
465
+ #~ msgid "![llama-cli interactive first](../assets/imgs/llama-cli-if.png)"
466
+ #~ msgstr ""
467
+
468
+ #~ msgid "llama-cli interactive first"
469
+ #~ msgstr "llama-cli 互动模式用户优先"
470
+
471
+ #~ msgid "![llama-cli interactive](../assets/imgs/llama-cli-i.png)"
472
+ #~ msgstr ""
473
+
474
+ #~ msgid "llama-cli interactive"
475
+ #~ msgstr "llama-cli 互动模式"
476
+
477
+ #~ msgid "The main output is as follows: ![llama-cli](../assets/imgs/llama-cli.png)"
478
+ #~ msgstr "主要输出如下所示: ![llama-cli](../assets/imgs/llama-cli.png)"
479
+
480
+ #~ msgid "llama-cli"
481
+ #~ msgstr ""
482
+
483
+ #~ msgid "![llama-cli mid](../assets/imgs/llama-cli-mid.png)"
484
+ #~ msgstr ""
485
+
486
+ #~ msgid "llama-cli mid"
487
+ #~ msgstr "llama-cli 中间"
488
+
489
+ #~ msgid "Get the `llama-cli` program"
490
+ #~ msgstr "获取 `llama-cli` 程序"
491
+
492
+ #~ msgid "Remember that `llama-cli` is an example program, not a full-blown application. Sometimes it just does not work in the way you would like. This guide could also get quite technical sometimes. If you would like a smooth experience, check out the application mentioned above, which are much easier to \"use\"."
493
+ #~ msgstr "请记住,`llama-cli` 只是一个示例程序,并非完整应用。有时候它可能无法完全按照您的期望运行。本指南有时会涉及一些技术细节。如果您希望获得流畅的体验,请尝试上述提到的应用,它们使用起来会更加便捷。"
494
+
495
+ #~ msgid "Then use `make`:"
496
+ #~ msgstr "然后运行 `make` 命令:"
497
+
498
+ #~ msgid "The command will only compile the parts needed for `llama-cli`. On macOS, it will enable Metal and Accelerate by default, so you can run with GPUs. On Linux, you won't get GPU support by default, but SIMD-optimization is enabled if available."
499
+ #~ msgstr "该命令只会编译`llama-cli`所需的部件。在macOS上,默认情况下会启用Metal和Accelerate,因此你可以使用GPU运行。在Linux上,默认情况下你无法获得GPU支持,但如果可用,会启用CPU SIMD优化。"
500
+
501
+ #~ msgid "There are other [example programs](https://github.com/ggerganov/llama.cpp/tree/master/tools) in llama.cpp. You can build them at once with simply (it may take some time):"
502
+ #~ msgstr "在llama.cpp中还有其他的[示例程序](https://github.com/ggerganov/llama.cpp/tree/master/tools),你可以一次构建它们(可能需要一些时间):"
503
+
504
+ #~ msgid "or you can also compile only the one you need, for example:"
505
+ #~ msgstr "你也可以只编译你需要的,例如:"
506
+
507
+ #~ msgid "Running the Model"
508
+ #~ msgstr "运行模型"
509
+
510
+ #~ msgid "Due to random sampling and source code updates, the generated content with the same command as given in this section may be different from what is shown in the examples."
511
+ #~ msgstr "由于随机采样和源代码更新,使用本节中给出的相同命令生成的内容可能与示例中显示的不同。"
512
+
513
+ #~ msgid "`llama-cli` provide multiple \"mode\" to \"interact\" with the model. Here, we demonstrate three ways to run the model, with increasing difficulty."
514
+ #~ msgstr "`llama-cli` 提供多种“模式”来与模型进行“交互”。在这里,我们展示三种运行模型的方法,使用难度逐渐增加。"
515
+
516
+ #~ msgid "Conversation Mode"
517
+ #~ msgstr "对话模式"
518
+
519
+ #~ msgid "For users, to achieve chatbot-like experience, it is recommended to commence in the conversation mode"
520
+ #~ msgstr "对于普通用户来说,为了获得类似聊天机器人的体验,建议从对话模式开始。"
521
+
522
+ #~ msgid "The program will first print metadata to the screen until you see the following:"
523
+ #~ msgstr "程序首先会在屏幕上打印元数据,直到你看到以下内容:"
524
+
525
+ #~ msgid "Now, the model is waiting for your input, and you can chat with the model:"
526
+ #~ msgstr "现在,模型正在等待你的输入,你可以与模型进行对话:"
527
+
528
+ #~ msgid "That's something, isn't it? You can stop the model generation anytime by Ctrl+C or Command+. However, if the model generation is ended and the control is returned to you, pressing the combination will exit the program."
529
+ #~ msgstr "这很有趣,对吧?你可以随时通过 Ctrl+C 或 Command+. 来停止模型生成。但是,如果模型生成结束并且控制权返回给你,按下组合键将会退出程序。"
530
+
531
+ #~ msgid "So what does the command we used actually do? Let's explain a little:"
532
+ #~ msgstr "那么,我们使用的命令实际上做了什么呢?让我们来解释一下:"
533
+
534
+ #~ msgid "-m or --model"
535
+ #~ msgstr "-m 或 --model"
536
+
537
+ #~ msgid "Model path, obviously."
538
+ #~ msgstr "显然,这是模型路径。"
539
+
540
+ #~ msgid "-co or --color"
541
+ #~ msgstr "-co 或 --color"
542
+
543
+ #~ msgid "Colorize output to distinguish prompt and user input from generations. Prompt text is dark yellow; user text is green; generated text is white; error text is red."
544
+ #~ msgstr "为输出着色以区分提示词、用户输入和生成的文本。提示文本为深黄色;用户文本为绿色;生成的文本为白色;错误文本为红色。"
545
+
546
+ #~ msgid "-cnv or --conversation"
547
+ #~ msgstr "-cnv 或 --conversation"
548
+
549
+ #~ msgid "Run in conversation mode. The program will apply the chat template accordingly."
550
+ #~ msgstr "在对话模式下运行。程序将相应地应用聊天模板。"
551
+
552
+ #~ msgid "-p or --prompt"
553
+ #~ msgstr "-p 或 --prompt"
554
+
555
+ #~ msgid "In conversation mode, it acts as the system message."
556
+ #~ msgstr "在对话模式下,它作为系统提示。"
557
+
558
+ #~ msgid "-fa or --flash-attn"
559
+ #~ msgstr "-fa 或 --flash-attn"
560
+
561
+ #~ msgid "Enable Flash Attention if the program is compiled with GPU support."
562
+ #~ msgstr "如果程序编译时支持 GPU,则启用Flash Attention注意力实现。"
563
+
564
+ #~ msgid "-ngl or --n-gpu-layers"
565
+ #~ msgstr "-ngl 或 --n-gpu-layers"
566
+
567
+ #~ msgid "Layers to the GPU for computation if the program is compiled with GPU support."
568
+ #~ msgstr "如果程序编译时支持 GPU,则将这么多层分配给 GPU 进行计算。"
569
+
570
+ #~ msgid "-n or --predict"
571
+ #~ msgstr "-n 或 --predict"
572
+
573
+ #~ msgid "Number of tokens to predict."
574
+ #~ msgstr "要预测的token数量。"
575
+
576
+ #~ msgid "You can also explore other options by"
577
+ #~ msgstr "你也可以通过以下方式探索其他选项:"
578
+
579
+ #~ msgid "Interactive Mode"
580
+ #~ msgstr "互动模式"
581
+
582
+ #~ msgid "The conversation mode hides the inner workings of LLMs. With interactive mode, you are made aware how LLMs work in the way to completion or continuation. The workflow is like"
583
+ #~ msgstr "对话模式隐藏了大型语言模型(LLMs)的内部机制。在互动模式下,你可以直观地了解LLMs如何完成或继续生成文本。工作流程如下"
584
+
585
+ #~ msgid "Give the model an initial prompt, and the model generates a completion."
586
+ #~ msgstr "给模型一个初始提示,模型会生成续写文本。"
587
+
588
+ #~ msgid "Interrupt the model generation any time or wait until the model generates a reverse prompt or an eos token."
589
+ #~ msgstr "随时中断模型生成,或者等到模型生成反向提示(reverse prompt)或结束token(eos token)。"
590
+
591
+ #~ msgid "Append new texts (with optional prefix and suffix), and then let the model continues the generation."
592
+ #~ msgstr "添加新文本(可选前缀和后缀),然后让模型继续生成。"
593
+
594
+ #~ msgid "Repeat Step 2. and Step 3."
595
+ #~ msgstr "重复步骤2和步骤3。"
596
+
597
+ #~ msgid "This workflow requires a different set of options, since you have to mind the chat template yourselves. To proper run the Qwen2.5 models, try the following:"
598
+ #~ msgstr "此工作流程需要一组不同的选项,因为你必须自己管理聊天模板。为了正确运行Qwen2.5模型,请尝试以下操作:"
599
+
600
+ #~ msgid "We use some new options here:"
601
+ #~ msgstr "我们在这里使用了一些新的选项:"
602
+
603
+ #~ msgid "-sp or --special"
604
+ #~ msgstr "-sp 或 --special"
605
+
606
+ #~ msgid "Show the special tokens."
607
+ #~ msgstr "显示特殊token。"
608
+
609
+ #~ msgid "-i or --interactive"
610
+ #~ msgstr "-i 或 --interactive"
611
+
612
+ #~ msgid "Enter interactive mode. You can interrupt model generation and append new texts."
613
+ #~ msgstr "进入互动模式。你可以中断模型生成并添加新文本。"
614
+
615
+ #~ msgid "-if or --interactive-first"
616
+ #~ msgstr "-if 或 --interactive-first"
617
+
618
+ #~ msgid "Immediately wait for user input. Otherwise, the model will run at once and generate based on the prompt."
619
+ #~ msgstr "立即等待用户输入。否则,模型将立即运行并根据提示生成文本。"
620
+
621
+ #~ msgid "In interactive mode, it is the contexts based on which the model predicts the continuation."
622
+ #~ msgstr "在互动模式下,这是模型续写用的上文。"
623
+
624
+ #~ msgid "--in-prefix"
625
+ #~ msgstr ""
626
+
627
+ #~ msgid "String to prefix user inputs with."
628
+ #~ msgstr "用户输入附加的前缀字符串。"
629
+
630
+ #~ msgid "--in-suffix"
631
+ #~ msgstr ""
632
+
633
+ #~ msgid "String to suffix after user inputs with."
634
+ #~ msgstr "用户输入附加的后缀字符串。"
635
+
636
+ #~ msgid "The result is like this:"
637
+ #~ msgstr "结果如下:"
638
+
639
+ #~ msgid "We use `prompt`, `in-prefix`, and `in-suffix` together to implement the chat template (ChatML-like) used by Qwen2.5 with a system message. So the experience is very similar to the conversation mode: you just need to type in the things you want to ask the model and don't need to worry about the chat template once the program starts. Note that, there should not be a new line after user input according to the template, so remember to end your input with `/`."
640
+ #~ msgstr "我们将 `prompt`、`in-prefix` 和 `in-suffix` 结合起来实现Qwen2.5使用的包含系统消息的聊天模板(类似ChatML)。这样的,体验与对话模式非常相似:你只需输入想要询问模型的内容,在程序启动后无需担心聊天模板。请注意,根据模板,用户输入后不应有换行符,所以请以 `/` 结束输入。"
641
+
642
+ #~ msgid "Advanced Usage"
643
+ #~ msgstr "高级用法"
644
+
645
+ #~ msgid "Interactive mode can achieve a lot more flexible workflows, under the condition that the chat template is maintained properly throughout. The following is an example:"
646
+ #~ msgstr "互动模式可以实现更灵活的工作流程,前提是整个过程中正确维护聊天模板。以下是一个示例:"
647
+
648
+ #~ msgid "In the above example, I set `--reverse-prompt` to `\"LLM\"` so that the generation is interrupted whenever the model generates `\"LLM\"`[^rp]. The in prefix and in suffix are also set to empty so that I can add content exactly I want. After every generation of `\"LLM\"`, I added the part `\"...not what you think...\"` which are not likely to be generated by the model. Yet the model can continue generation just as fluent, although the logic is broken the second time around. I think it's fun to play around."
649
+ #~ msgstr "在上面的例子中,我将 `--reverse-prompt` 设置为 `\"LLM\"`,以便每当模型生成 `\"LLM\"` 时中断生成过程[^rp]。前缀和后缀也被设置为空,这样我可以精确地添加想要的内容。每次生成 `\"LLM\"` 后,我添加了 `\"...not what you think...\"` 的部分,这部分不太可能由模型生成。然而,模型仍能继续流畅生成,尽管第二次逻辑被破坏。这很有趣,值得探索。"
650
+
651
+ #~ msgid "Non-interactive Mode"
652
+ #~ msgstr "非交互模式"
653
+
654
+ #~ msgid "You can also use `llama-cli` for text completion by using just the prompt. However, it also means you have to format the input properly and only one turn can be generated."
655
+ #~ msgstr "你还可以仅使用提示词,通过`llama-cli`完成文本续写。但这也意味着你需要正确格式化输入,并且只能生成一次回应。"
656
+
657
+ #~ msgid "The following is an example:"
658
+ #~ msgstr "以下是一个示例:"
659
+
660
+ #~ msgid "The main output is as follows:"
661
+ #~ msgstr "主要步骤如下:"
662
+
663
+ #~ msgid "In fact, you can start completion anywhere you want, even in the middle of an assistant message:"
664
+ #~ msgstr "实际上,你可以从任何你想要的地方开始续写,即使是在assistant消息的中间:"
665
+
666
+ #~ msgid "Now you can use `llama-cli` in three very different ways! Try talk to Qwen2.5 and share your experience with the community!"
667
+ #~ msgstr "现在你可以用三种截然不同的方式使用`llama-cli`了!试试和Qwen2.5对话,然后与社区分享你的体验吧!"
668
+
669
+ #~ msgid "There are some gotchas in using `--reverse-prompt` as it matches tokens instead of strings. Since the same string can be tokenized differently in different contexts in BPE tokenization, some reverse prompts are never matched even though the string does exist in generation."
670
+ #~ msgstr "`--reverse-prompt`在匹配时针对的是token而非字符串,因此使用时有一些需要注意的地方。由于BPE tokenizer在不同上下文中对相同字符串的tokenization结果可能不同,所以某些反向提示符即使在生成的文本中存在,也可能永远无法匹配成功。"
671
+
docs/locales/zh_CN/LC_MESSAGES/run_locally/mlx-lm.po ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Qwen \n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2025-04-29 16:34+0800\n"
11
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language: zh_CN\n"
14
+ "Language-Team: zh_CN <LL@li.org>\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=utf-8\n"
18
+ "Content-Transfer-Encoding: 8bit\n"
19
+ "Generated-By: Babel 2.17.0\n"
20
+
21
+ #: ../../source/run_locally/mlx-lm.md:1 47d6da370d364ad6a80f76d5d1f8a80d
22
+ msgid "MLX LM"
23
+ msgstr ""
24
+
25
+ #: ../../source/run_locally/mlx-lm.md:4 f11e8701708e48559587dd3a8404be92
26
+ msgid "To be updated for Qwen3."
27
+ msgstr "仍需为Qwen3更新。"
28
+
29
+ #: ../../source/run_locally/mlx-lm.md:7 9ff094754ecc40b79c3bc6737d1264dc
30
+ #, fuzzy
31
+ msgid "[mlx-lm](https://github.com/ml-explore/mlx-examples/tree/main/llms) helps you run LLMs locally on Apple Silicon. It is available at macOS. It has already supported Qwen models and this time, we have also provided checkpoints that you can directly use with it."
32
+ msgstr "[mlx-lm](https://github.com/ml-explore/mlx-examples/tree/main/llms)能让你在Apple Silicon上运行大型语言模型,适用于MacOS。mlx-lm已支持Qwen模型,此次我们提供直接可用的模型文件。"
33
+
34
+ #: ../../source/run_locally/mlx-lm.md:11 df3a6d381ce44151b810ee2ca012c6d3
35
+ msgid "Prerequisites"
36
+ msgstr "准备工作"
37
+
38
+ #: ../../source/run_locally/mlx-lm.md:13 2f6092faf4904990a208b2cecdc623b4
39
+ msgid "The easiest way to get started is to install the `mlx-lm` package:"
40
+ msgstr "首先需要安装`mlx-lm`包:"
41
+
42
+ #: ../../source/run_locally/mlx-lm.md:15 8ae883c84d7b435293dab8502884cec6
43
+ msgid "with `pip`:"
44
+ msgstr "使用`pip`:"
45
+
46
+ #: ../../source/run_locally/mlx-lm.md:21 0cd594d753fa478ca025271dca9af3b5
47
+ msgid "with `conda`:"
48
+ msgstr "使用`conda`:"
49
+
50
+ #: ../../source/run_locally/mlx-lm.md:27 a82de876ad354ca5ae7eb2cc9fad0f1e
51
+ #, fuzzy
52
+ msgid "Running with Qwen MLX Files"
53
+ msgstr "使用Qwen MLX模型文件"
54
+
55
+ #: ../../source/run_locally/mlx-lm.md:29 36d5c803c391420fabc5640f57a6509b
56
+ msgid "We provide model checkpoints with `mlx-lm` in our Hugging Face organization, and to search for what you need you can search the repo names with `-MLX`."
57
+ msgstr "我们已在Hugging Face提供了适用于`mlx-lm`的模型文件,请搜索带`-MLX`的存储库。"
58
+
59
+ #: ../../source/run_locally/mlx-lm.md:31 916de6911595431f9ebf5cc3eec51fe3
60
+ msgid "Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents."
61
+ msgstr "这里我们展示了一个代码样例,其中使用了`apply_chat_template`来应用对话模板。"
62
+
63
+ #: ../../source/run_locally/mlx-lm.md:52 299ccc7dc4984f5e97c58b58a6216d69
64
+ msgid "Make Your MLX files"
65
+ msgstr "自行制作MLX格式模型"
66
+
67
+ #: ../../source/run_locally/mlx-lm.md:54 433503979d404191b934cf5e1ed7f655
68
+ #, fuzzy
69
+ msgid "You can make MLX files with just one command:"
70
+ msgstr "仅用一条命令即可制作mlx格式模型"
71
+
72
+ #: ../../source/run_locally/mlx-lm.md:60 b2302dcae1074aff87fe3a1ec49c15f0
73
+ msgid "where"
74
+ msgstr "参数含义分别是"
75
+
76
+ #: ../../source/run_locally/mlx-lm.md:62 cbb011f4b76346cca7369b0d7538f899
77
+ msgid "`--hf-path`: the model name on Hugging Face Hub or the local path"
78
+ msgstr "`--hf-path`: Hugging Face Hub上的模型名或本地路径"
79
+
80
+ #: ../../source/run_locally/mlx-lm.md:63 16348ddca1e34966a51cb192d1c7d064
81
+ msgid "`--mlx-path`: the path for output files"
82
+ msgstr "`--mlx-path`: 输出模型文件的存储路径"
83
+
84
+ #: ../../source/run_locally/mlx-lm.md:64 34f6d5f01dcb4381ade2da35c75ea566
85
+ msgid "`-q`: enable quantization"
86
+ msgstr "`-q`: 启用量化"
87
+
88
+ #~ msgid "MLX-LM"
89
+ #~ msgstr ""
90
+
docs/locales/zh_CN/LC_MESSAGES/run_locally/ollama.po ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-04-29 16:34+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.17.0\n"
18
+
19
+ #: ../../source/run_locally/ollama.md:1 66b5f4776d0a45ec9a7ed2c147a6323e
20
+ msgid "Ollama"
21
+ msgstr "Ollama"
22
+
23
+ #: ../../source/run_locally/ollama.md:4 1a60e4f166184588802505205b51ea7a
24
+ msgid "To be updated for Qwen3."
25
+ msgstr "仍需为Qwen3更新。"
26
+
27
+ #: ../../source/run_locally/ollama.md:7 06925624447242879d12bcbc3be61ce6
28
+ #, fuzzy
29
+ msgid "[Ollama](https://ollama.com/) helps you run LLMs locally with only a few commands. It is available at macOS, Linux, and Windows. Now, Qwen2.5 is officially on Ollama, and you can run it with one command:"
30
+ msgstr "[Ollama](https://ollama.com/)帮助您通过少量命令即可在本地运行LLM。它适用于MacOS、Linux和Windows操作系统。现在,Qwen2.5正式上线Ollama,您只需一条命令即可运行它:"
31
+
32
+ #: ../../source/run_locally/ollama.md:15 1180461df89c41c586d499daf5c6e0a0
33
+ msgid "Next, we introduce more detailed usages of Ollama for running Qwen2.5 models."
34
+ msgstr "接着,我们介绍在Ollama使用Qwen2.5模型的更多用法"
35
+
36
+ #: ../../source/run_locally/ollama.md:17 816ea502f0be44bcab371fd76e486618
37
+ msgid "Quickstart"
38
+ msgstr "快速开始"
39
+
40
+ #: ../../source/run_locally/ollama.md:19 c6d1c533593b495da62c73c8434636f8
41
+ msgid "Visit the official website [Ollama](https://ollama.com/) and click download to install Ollama on your device. You can also search models on the website, where you can find the Qwen2.5 models. Except for the default one, you can choose to run Qwen2.5-Instruct models of different sizes by:"
42
+ msgstr "访问官方网站[Ollama](https://ollama.com/),点击`Download`以在您的设备上安装Ollama。您还可以在网站上搜索模型,在这里您可以找到Qwen2.5系列模型。除了默认模型之外,您可以通过以下方式选择运行不同大小的Qwen2.5-Instruct模型:"
43
+
44
+ #: ../../source/run_locally/ollama.md:23 9f87565dcf4b44b8adce249c1863adbd
45
+ msgid "`ollama run qwen2.5:0.5b`"
46
+ msgstr ""
47
+
48
+ #: ../../source/run_locally/ollama.md:24 dcd5286c72a2440fb0fc7bfd210dd8d9
49
+ msgid "`ollama run qwen2.5:1.5b`"
50
+ msgstr ""
51
+
52
+ #: ../../source/run_locally/ollama.md:25 d2c13d08cad34893804497095676ddd4
53
+ msgid "`ollama run qwen2.5:3b`"
54
+ msgstr ""
55
+
56
+ #: ../../source/run_locally/ollama.md:26 e4a8e4cbd090469e9094afae3abe30f7
57
+ msgid "`ollama run qwen2.5:7b`"
58
+ msgstr ""
59
+
60
+ #: ../../source/run_locally/ollama.md:27 a97beb23d6074c2db90428b717ab61dd
61
+ msgid "`ollama run qwen2.5:14b`"
62
+ msgstr ""
63
+
64
+ #: ../../source/run_locally/ollama.md:28 049274657be149b4976d722cd608eb09
65
+ msgid "`ollama run qwen2.5:32b`"
66
+ msgstr ""
67
+
68
+ #: ../../source/run_locally/ollama.md:29 baec60a5ed5047e3bd080aa96cfc577b
69
+ msgid "`ollama run qwen2.5:72b`"
70
+ msgstr ""
71
+
72
+ #: ../../source/run_locally/ollama.md:32 2f9ef84694f5446f87db2333336f93c9
73
+ msgid "`ollama` does not host base models. Even though the tag may not have the instruct suffix, they are all instruct models."
74
+ msgstr "`ollama`并不托管基模型。即便模型标签不带instruct后缀,实际也是instruct模型。"
75
+
76
+ #: ../../source/run_locally/ollama.md:36 9545d728b8aa4163a66accdb54694caf
77
+ msgid "Run Ollama with Your GGUF Files"
78
+ msgstr "用Ollama运行你自己的GGUF文件"
79
+
80
+ #: ../../source/run_locally/ollama.md:38 f5a073220da84c19975adcce41f76d5c
81
+ msgid "Sometimes you don't want to pull models and you just want to use Ollama with your own GGUF files. Suppose you have a GGUF file of Qwen2.5, `qwen2.5-7b-instruct-q5_0.gguf`. For the first step, you need to create a file called `Modelfile`. The content of the file is shown below:"
82
+ msgstr "有时您可能不想拉取模型,而是希望直接使用自己的GGUF文件来配合Ollama。假设您有一个名为`qwen2.5-7b-instruct-q5_0.gguf`的Qwen2.5的GGUF文件。在第一步中,您需要创建一个名为`Modelfile`的文件。该文件的内容如下所示:"
83
+
84
+ #: ../../source/run_locally/ollama.md:101 15e36d92505e4e21a2fe5dd07c5861e7
85
+ #, fuzzy
86
+ msgid "Then create the Ollama model by running:"
87
+ msgstr "然后通过运行下列命令来创建一个ollama模型"
88
+
89
+ #: ../../source/run_locally/ollama.md:107 4087d4c583fe44acb1456ca2412f8c85
90
+ #, fuzzy
91
+ msgid "Once it is finished, you can run your Ollama model by:"
92
+ msgstr "完成后,你即可运行你的ollama模型:"
93
+
94
+ #: ../../source/run_locally/ollama.md:113 083503ce2e9d48eab757e8a4cf805d8d
95
+ msgid "Tool Use"
96
+ msgstr "工具调用"
97
+
98
+ #: ../../source/run_locally/ollama.md:115 b7635c6f3ccc4294a2ba4a45f17ae163
99
+ #, fuzzy
100
+ msgid "Tool use is now supported Ollama and you should be able to run Qwen2.5 models with it. For more details, see our [function calling guide](../framework/function_call)."
101
+ msgstr "Ollama现已支持工具调用,Qwen2.5也已适配。更多详情,请参阅我们的[函数调用指南](../framework/function_call)"
102
+
docs/locales/zh_CN/LC_MESSAGES/training/axolotl.po ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-06-13 17:22+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.16.0\n"
21
+
22
+ #: ../../source/training/axolotl.md:1 1b87b5a4226b45abbb6838abc839c77f
23
+ msgid "Axolotl"
24
+ msgstr ""
25
+
26
+ #: ../../source/training/axolotl.md:3 71774faa415944dda99259d64acab46d
27
+ msgid "This guide will help you get started with post-training (SFT, RLHF, RM, PRM) for Qwen3 / Qwen3_MOE using Axolotl, and covers optimizations to enable for better performance."
28
+ msgstr "本指南将帮助您使用 Axolotl 开始对 Qwen3 / Qwen3_MOE 进行后训练(SFT、RLHF、RM、PRM),并涵盖为提升性能而启用的优化。"
29
+
30
+ #: ../../source/training/axolotl.md:5 61072e56be004db9b403c1b2bf3f6f86
31
+ msgid "Requirements"
32
+ msgstr "要求"
33
+
34
+ #: ../../source/training/axolotl.md:7 3ed2a27ad94a49d18b049abfceab7cc9
35
+ msgid "**GPU:** NVIDIA Ampere (or newer) for `bf16` and `Flash Attention`, or AMD GPU"
36
+ msgstr "**GPU:** 适用于 `bf16` 和 `Flash Attention` 的 NVIDIA Ampere(或更新架构),或 AMD GPU"
37
+
38
+ #: ../../source/training/axolotl.md:8 e1b73a01085240da99d05fcf69fcebec
39
+ msgid "**Python:** ≥3.11"
40
+ msgstr ""
41
+
42
+ #: ../../source/training/axolotl.md:9 dbe2c77d93064b8eb28e4d4351131887
43
+ msgid "**CUDA:** ≥12.4 (for NVIDIA GPUs)"
44
+ msgstr "**CUDA:** ≥12.4(适用于 NVIDIA GPU)"
45
+
46
+ #: ../../source/training/axolotl.md:11 58c6d64b99cd4158ae6f2cc924dbac68
47
+ msgid "Installation"
48
+ msgstr "安装"
49
+
50
+ #: ../../source/training/axolotl.md:13 9156474750754164bf51347eccd7537c
51
+ msgid "You can install Axolotl using PyPI, Conda, Git, Docker, or launch a cloud environment."
52
+ msgstr "您可以使用 PyPI、Conda、Git、Docker 安装 Axolotl,或者启动云环境。"
53
+
54
+ #: ../../source/training/axolotl.md:16 24099b25e9fa4632b8467c7df11710bb
55
+ msgid "Install PyTorch *before* installing Axolotl to ensure CUDA compatibility."
56
+ msgstr "在安装 Axolotl *之前* 安装 PyTorch,以确保 CUDA 兼容性。"
57
+
58
+ #: ../../source/training/axolotl.md:19 da17abd4fa654026826ec65f4e34714b
59
+ msgid "For the latest instructions, see the official [Axolotl Installation Guide](https://docs.axolotl.ai/docs/installation.html)."
60
+ msgstr "有关最新说明,请参阅官方 [Axolotl 安装指南](https://docs.axolotl.ai/docs/installation.html)。"
61
+
62
+ #: ../../source/training/axolotl.md:21 55210f52b4ba40a5aa3c5ba311a2ab3b
63
+ msgid "Quickstart"
64
+ msgstr "快速入门"
65
+
66
+ #: ../../source/training/axolotl.md:23 46428d800a7542a48360ca78bbb35f56
67
+ msgid "SFT"
68
+ msgstr "SFT(监督微调)"
69
+
70
+ #: ../../source/training/axolotl.md:25 34e7a9b5842b467f933f469465518b0d
71
+ msgid "We have provided a sample YAML config for SFT with Qwen/Qwen3-32B: [SFT 32B QLoRA config](https://github.com/axolotl-ai-cloud/axolotl/blob/v0.9.2/examples/qwen3/32b-qlora.yaml)."
72
+ msgstr "我们提供了一个使用 Qwen/Qwen3-32B 进行 SFT 的示例 YAML 配置文件:[SFT 32B QLoRA 配置](https://github.com/axolotl-ai-cloud/axolotl/blob/v0.9.2/examples/qwen3/32b-qlora.yaml)。"
73
+
74
+ #: ../../source/training/axolotl.md:37 2baa43f76e164e31a1a49d76cafe98a0
75
+ msgid "To train a smaller model, edit the `base_model` in your config:"
76
+ msgstr "要训练较小的模型,请编辑配置文件中的 `base_model`:"
77
+
78
+ #: ../../source/training/axolotl.md:44 34b2753404214dd5a082c4cd707a1e4f
79
+ msgid "Qwen3 works with all Axolotl features including `Flash Attention`, `bf16`, `LoRA`, `torch_compile`, and `QLoRA`."
80
+ msgstr "Qwen3 可以使用所有 Axolotl 功能,包括 `Flash Attention`、`bf16`、`LoRA`、`torch_compile` 和 `QLoRA`。"
81
+
82
+ #: ../../source/training/axolotl.md:46 a17d3d2763fd4296ba39aa1f8389c0ff
83
+ msgid "To run on more than single GPU, please take a look at the [Multi-GPU Training Guide](https://docs.axolotl.ai/docs/multi-gpu.html) or [Multi-node Training Guide](https://docs.axolotl.ai/docs/multi-node.html)."
84
+ msgstr "如需在多块 GPU 上运行,请参阅 [多 GPU 训练指南](https://docs.axolotl.ai/docs/multi-gpu.html) 或 [多节点训练指南](https://docs.axolotl.ai/docs/multi-node.html)。"
85
+
86
+ #: ../../source/training/axolotl.md:48 87bdbf06d6984fbf801182a9c7c5e223
87
+ msgid "RLHF"
88
+ msgstr "RLHF(基于人类反馈的强化学习)"
89
+
90
+ #: ../../source/training/axolotl.md:50 0803e7e908024353aa83e561576947cd
91
+ msgid "See the [RLHF Guide](https://docs.axolotl.ai/docs/rlhf.html) for required dataset formats and examples for each method."
92
+ msgstr "请参阅 [RLHF 指南](https://docs.axolotl.ai/docs/rlhf.html),了解每种方法所需的数据集格式和示例。"
93
+
94
+ #: ../../source/training/axolotl.md:52 2c8dd42aca9e40bca82e2ba55ebbc431
95
+ msgid "RM/PRM"
96
+ msgstr "RM/PRM"
97
+
98
+ #: ../../source/training/axolotl.md:54 237c06d3dc314873908ceb044e20f86d
99
+ msgid "Please refer to the [Reward Modelling Guide](https://docs.axolotl.ai/docs/reward_modelling.html) for required dataset formats and config examples."
100
+ msgstr "请参阅 [奖励建模指南](https://docs.axolotl.ai/docs/reward_modelling.html),了解所需的数据集格式和配置示例。"
101
+
102
+ #: ../../source/training/axolotl.md:56 d9ab3c73710e40c2b16872cb2f83825a
103
+ msgid "Dataset"
104
+ msgstr "数据集"
105
+
106
+ #: ../../source/training/axolotl.md:58 27d95366d2ab4355bcbe9dd3925ea98b
107
+ msgid "By default, the example config uses the `mlabonne/FineTome-100k` dataset (from HuggingFace Hub). You can substitute any dataset of your own."
108
+ msgstr ""msgstr "默认情况下,示例配置使用 `mlabonne/FineTome-100k` 数据集(来自 HuggingFace Hub)。您可以替换为您自己的任何数据集。"
109
+
110
+ #: ../../source/training/axolotl.md:60 0820890dd0684961842626ae8f3c204d
111
+ msgid "SFT Dataset Format"
112
+ msgstr "SFT 数据集格式"
113
+
114
+ #: ../../source/training/axolotl.md:62 9c7cc72200eb48e4b5cf6eaae4adf176
115
+ msgid "Axolotl handles various SFT dataset formats, but the current **recommended** format (for use with `chat_template`) is the OpenAI Messages format:"
116
+ msgstr "Axolotl 支持多种 SFT 数据集格式,但当前**推荐**的格式(用于 `chat_template`)是 OpenAI Messages 格式:"
117
+
118
+ #: ../../source/training/axolotl.md:81 8747795235ae444ebd02f9edeb5e2ee6
119
+ msgid "Use this in your config:"
120
+ msgstr "在您的配置中使用以下内容:"
121
+
122
+ #: ../../source/training/axolotl.md:89 dff75c48b8714b33a518e51198394e90
123
+ msgid "You can also load datasets from multiple sources: HuggingFace Hub, local files, directories, S3, GCS, Azure, etc."
124
+ msgstr "您还可以从多个来源加载数据集:HuggingFace Hub、本地文件、目录、S3、GCS、Azure 等。"
125
+
126
+ #: ../../source/training/axolotl.md:91 de3c2c02c6b74de48b65cc85e4770280
127
+ msgid "See the [Dataset Loading Guide](https://docs.axolotl.ai/docs/dataset_loading.html) for more details."
128
+ msgstr "更多详细信息,请参阅[数据集加载指南](https://docs.axolotl.ai/docs/dataset_loading.html)。"
129
+
130
+ #: ../../source/training/axolotl.md:93 c0d462f8add64d4eb08c94e8abd88901
131
+ msgid "To load different dataset formats, refer to the [SFT Dataset Formats Guide](https://docs.axolotl.ai/docs/dataset-formats/#supervised-fine-tuning-sft)."
132
+ msgstr "要加载不同的数据集格式,请参阅[SFT 数据集格式指南](https://docs.axolotl.ai/docs/dataset-formats/#supervised-fine-tuning-sft)。"
133
+
134
+ #: ../../source/training/axolotl.md:95 78bfd0e6be834fb59053c8b79d3e01a2
135
+ msgid "Optimizations"
136
+ msgstr "性能优化"
137
+
138
+ #: ../../source/training/axolotl.md:97 3b2c2c7c1c344278a858d11e5ee85c68
139
+ msgid "With Qwen3/Qwen3_MOE, you can leverage Axolotl's custom optimizations for improved speed and reduced memory usage:"
140
+ msgstr "通过 Qwen3/Qwen3_MOE,您可以利用 Axolotl 的自定义优化来提升速度并减少内存使用:"
141
+
142
+ #: ../../source/training/axolotl.md:99 5f8736c8f64b4179b17c3817544e6592
143
+ msgid "[Cut Cross Entropy](https://docs.axolotl.ai/docs/custom_integrations.html#cut-cross-entropy)"
144
+ msgstr ""
145
+
146
+ #: ../../source/training/axolotl.md:100 0fc18a82a08944fcbd116650149c25a2
147
+ msgid "[Liger Kernels](https://docs.axolotl.ai/docs/custom_integrations.html#liger-kernels)"
148
+ msgstr ""
149
+
150
+ #: ../../source/training/axolotl.md:101 8e1d0b958b5c46fc9586d48ce6fe1f5b
151
+ msgid "(LoRA/QLoRA only): [LoRA Kernels Optimization](https://docs.axolotl.ai/docs/lora_optims.html)"
152
+ msgstr "(仅限 LoRA/QLoRA):[LoRA Kernels 优化](https://docs.axolotl.ai/docs/lora_optims.html)"
153
+
154
+ #: ../../source/training/axolotl.md:103 ef45fbcf05234378b002101dd5f2aeea
155
+ msgid "Additional Suggestions"
156
+ msgstr "附加建议"
157
+
158
+ #: ../../source/training/axolotl.md:105 f2a5feccb57147f6bbc089d81a76a661
159
+ msgid "Troubleshooting"
160
+ msgstr "故障排除"
161
+
162
+ #: ../../source/training/axolotl.md:107 0923468a1b75473c9e859969bc4636df
163
+ msgid "Ensure your CUDA version matches your GPU and PyTorch version."
164
+ msgstr "确保您的 CUDA 版本与您的 GPU 和 PyTorch 版本匹配。"
165
+
166
+ #: ../../source/training/axolotl.md:108 ead86946b9ac4cad8e676dcc9151b6f6
167
+ msgid "If running into out-of-memory issues, try reducing your batch size, enable the optimizations above, or reduce sequence length."
168
+ msgstr "如果遇到内存不足的问题,可以尝试减少批处理大小、启用上述优化或缩短序列长度。"
169
+
170
+ #: ../../source/training/axolotl.md:109 4a0c5c6c372e40dbbafb625dd721c283
171
+ msgid "Qwen3 MoE may have slower training due to the upstream transformer's handling of MoE layers."
172
+ msgstr "由于上游 Transformer 对 MoE 层的处理,Qwen3 MoE 的训练速度可能会较慢。"
173
+
174
+ #: ../../source/training/axolotl.md:110 d9d43aa50a044428ab2b6ee60e801e62
175
+ msgid "For help, check the help channel on [Axolotl Discord](https://discord.gg/7m9sfhzaf3) or create a Discussion on [Axolotl GitHub](https://github.com/axolotl-ai-cloud/axolotl)."
176
+ msgstr "如需帮助,请查看 [Axolotl Discord](https://discord.gg/7m9sfhzaf3) ���的帮助频道,或者在 [Axolotl GitHub](https://github.com/axolotl-ai-cloud/axolotl) 上创建讨论。"
177
+
178
+ #: ../../source/training/axolotl.md:112 1d754e492c05455098ccadb7898d84d2
179
+ msgid "Links"
180
+ msgstr "外部链接"
181
+
182
+ #: ../../source/training/axolotl.md:114 616dfc422c534617910f19025d01f66f
183
+ msgid "[Axolotl Documentation](https://docs.axolotl.ai/)"
184
+ msgstr ""
185
+
186
+ #: ../../source/training/axolotl.md:115 5128337d00fb4437bb80829fca7472d1
187
+ msgid "[Axolotl Discord](https://discord.gg/7m9sfhzaf3)"
188
+ msgstr ""
189
+
190
+ #: ../../source/training/axolotl.md:116 1478f8dbb7e2475b9b45bf20ffc19a23
191
+ msgid "[Axolotl GitHub](https://github.com/axolotl-ai-cloud/axolotl)"
192
+ msgstr ""
193
+
194
+ #: ../../source/training/axolotl.md:117 0aff5c30b6584517935a568adc11b2db
195
+ msgid "[Axolotl Website](https://axolotl.ai)"
196
+ msgstr ""
docs/locales/zh_CN/LC_MESSAGES/training/llama_factory.po ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team, Alibaba Group.
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-06-13 17:22+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language-Team: LANGUAGE <LL@li.org>\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=utf-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Generated-By: Babel 2.16.0\n"
16
+
17
+ #: ../../source/training/llama_factory.md:1 d0b05b307a764e27badd1e3851ee03ec
18
+ msgid "LLaMA-Factory"
19
+ msgstr ""
20
+
21
+ #: ../../source/training/llama_factory.md:4 72877ac996694cc9b526edd4e9c1dc0b
22
+ msgid "To be updated for Qwen3."
23
+ msgstr "仍需为Qwen3更新。"
24
+
25
+ #: ../../source/training/llama_factory.md:7 61f6ef7f9ec1444fb656b86ab4a43985
26
+ msgid "Here we provide a script for supervised finetuning Qwen2.5 with [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory). This script for supervised finetuning (SFT) has the following features:"
27
+ msgstr "我们将介绍如何使用 [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) 微调 Qwen2.5 模型。本脚本包含如下特点:"
28
+
29
+ #: ../../source/training/llama_factory.md:11 93803890d14b43028177b43a909ce704
30
+ msgid "Support single-GPU and multi-GPU training;"
31
+ msgstr "支持单卡和多卡分布式训练"
32
+
33
+ #: ../../source/training/llama_factory.md:12 e3576e61279e4419a9ddd3f6947bd0b7
34
+ msgid "Support full-parameter tuning, LoRA, Q-LoRA, Dora."
35
+ msgstr "支持全参数微调、LoRA、Q-LoRA 和 DoRA 。"
36
+
37
+ #: ../../source/training/llama_factory.md:14 54303164dd1940e1808ab0ddb944c951
38
+ msgid "In the following, we introduce more details about the usage of the script."
39
+ msgstr "下文将介绍更多关于脚本的用法。"
40
+
41
+ #: ../../source/training/llama_factory.md:17 0b976ba2d67645b2b07fa974d1e064c4
42
+ msgid "Installation"
43
+ msgstr "安装"
44
+
45
+ #: ../../source/training/llama_factory.md:19 bc2440d2953642258f37115052921826
46
+ msgid "Before you start, make sure you have installed the following packages:"
47
+ msgstr "开始之前,确保你已经安装了以下代码库:"
48
+
49
+ #: ../../source/training/llama_factory.md:21 d628d70296b94969912c03c18461e22c
50
+ msgid "Follow the instructions of [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory), and build the environment."
51
+ msgstr "根据 [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) 官方指引构建好你的环境"
52
+
53
+ #: ../../source/training/llama_factory.md:24 d1bc1de0521342e2adb683560a52e05b
54
+ msgid "Install these packages (Optional):"
55
+ msgstr "安装下列代码库(可选):"
56
+
57
+ #: ../../source/training/llama_factory.md:31 dc2b9c3ca4da4d4597a47105ec1fd5b0
58
+ msgid "If you want to use [FlashAttention-2](https://github.com/Dao-AILab/flash-attention), make sure your CUDA is 11.6 and above."
59
+ msgstr "如你使用[FlashAttention-2](https://github.com/Dao-AILab/flash-attention),请确保你的CUDA版本在11.6以上。"
60
+
61
+ #: ../../source/training/llama_factory.md:35 c4924b4b72fe4b1a9a50f73b667b9506
62
+ msgid "Data Preparation"
63
+ msgstr "准备数据"
64
+
65
+ #: ../../source/training/llama_factory.md:37 6195396b9f7549a9950684a17efa4516
66
+ msgid "LLaMA-Factory provides several training datasets in `data` folder, you can use it directly. If you are using a custom dataset, please prepare your dataset as follows."
67
+ msgstr "LLaMA-Factory 在 `data` 文件夹中提供了多个训练数据集,您可以直接使用它们。如果您打算使用自定义数据集,请按照以下方式准备您的数据集。"
68
+
69
+ #: ../../source/training/llama_factory.md:41 6af76880ee36417ebda92078367d98fd
70
+ msgid "Organize your data in a **json** file and put your data in `data` folder. LLaMA-Factory supports dataset in `alpaca` or `sharegpt` format."
71
+ msgstr "请将您的数据以 **json** 格式进行组织,并将数据放入 `data` 文件夹中。LLaMA-Factory 支持以 `alpaca` 或 `sharegpt` 格式的数据集。"
72
+
73
+ #: ../../source/training/llama_factory.md:45 e15403384b33491aae4d4176bec80372
74
+ msgid "The dataset in `alpaca` format should follow the below format:"
75
+ msgstr "`alpaca` 格式的数据集应遵循以下格式:"
76
+
77
+ #: ../../source/training/llama_factory.md:62 3c96d003cbbb4c9d84f2f7b167ac7769
78
+ msgid "The dataset in `sharegpt` format should follow the below format:"
79
+ msgstr "`sharegpt` 格式的数据集应遵循以下格式:"
80
+
81
+ #: ../../source/training/llama_factory.md:83 3a63faa0b27b4eed8a749f0c2a675be0
82
+ msgid "Provide your dataset definition in `data/dataset_info.json` in the following format ."
83
+ msgstr "在 `data/dataset_info.json` 文件中提供您的数据集定义,并采用以下格式:"
84
+
85
+ #: ../../source/training/llama_factory.md:86 0a137feb4ce546a0b3088df3351ca062
86
+ msgid "For `alpaca` format dataset, the columns in `dataset_info.json` should be:"
87
+ msgstr "对于 `alpaca` 格式的数据集,其 `dataset_info.json` 文件中的列应为:"
88
+
89
+ #: ../../source/training/llama_factory.md:102 ea7871bf433a4d28923766a9d2c6f3d3
90
+ msgid "For `sharegpt` format dataset, the columns in `dataset_info.json` should be:"
91
+ msgstr "对于 `sharegpt` 格式的数据集,`dataset_info.json` 文件中的列应该包括:"
92
+
93
+ #: ../../source/training/llama_factory.md:123 6663d2ca92084df0a554790ea925cfc0
94
+ msgid "Training"
95
+ msgstr "训练"
96
+
97
+ #: ../../source/training/llama_factory.md:125 572abdbf356649b99438f85a507139f7
98
+ msgid "Execute the following training command:"
99
+ msgstr "执行下列命令:"
100
+
101
+ #: ../../source/training/llama_factory.md:165 83648e36173f48d99dbf7bb8540039e9
102
+ msgid "and enjoy the training process. To make changes to your training, you can modify the arguments in the training command to adjust the hyperparameters. One argument to note is `cutoff_len`, which is the maximum length of the training data. Control this parameter to avoid OOM error."
103
+ msgstr "并享受训练过程。若要调整您的训练,您可以通过修改训练命令中的参数来调整超参数。其中一个需要注意的参数是 `cutoff_len` ,它代表训练数据的最大长度。通过控制这个参数,可以避免出现OOM(内存溢出)错误。"
104
+
105
+ #: ../../source/training/llama_factory.md:171 c23adcde6f2846399e3f93e6248e5e70
106
+ msgid "Merge LoRA"
107
+ msgstr "合并LoRA"
108
+
109
+ #: ../../source/training/llama_factory.md:173 59e54104161841ff965c92211ff2cb8d
110
+ msgid "If you train your model with LoRA, you probably need to merge adapter parameters to the main branch. Run the following command to perform the merging of LoRA adapters."
111
+ msgstr "如果你使用 LoRA 训练模型,可能需要将adapter参数合并到主分支中。请运行以下命令以执行 LoRA adapter 的合并操作。"
112
+
113
+ #: ../../source/training/llama_factory.md:188 cbdc1761ad20462d9e6318105f5bc6c9
114
+ msgid "Conclusion"
115
+ msgstr "结语"
116
+
117
+ #: ../../source/training/llama_factory.md:190 bbf0315dc269432dba1a08679398477a
118
+ msgid "The above content is the simplest way to use LLaMA-Factory to train Qwen. Feel free to dive into the details by checking the official repo!"
119
+ msgstr "上述内容是使用LLaMA-Factory训练Qwen的最简单方法。 欢迎通过查看官方仓库深入了解详细信息!"
120
+
docs/locales/zh_CN/LC_MESSAGES/training/ms_swift.po ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2024, Qwen Team
2
+ # This file is distributed under the same license as the Qwen package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Qwen \n"
7
+ "Report-Msgid-Bugs-To: \n"
8
+ "POT-Creation-Date: 2025-06-13 17:22+0800\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language: zh_CN\n"
12
+ "Language-Team: zh_CN <LL@li.org>\n"
13
+ "Plural-Forms: nplurals=1; plural=0;\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=utf-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Generated-By: Babel 2.16.0\n"
18
+
19
+ #: ../../source/training/ms_swift.md:1 498aef3956544f9b97c7a47c66997ea2
20
+ msgid "MS-SWIFT"
21
+ msgstr "MS-SWIFT"
22
+
23
+ #: ../../source/training/ms_swift.md:3 0a0330c78d8549d1be55501fdc352a15
24
+ msgid "ModelScope SWIFT (**ms-swift**) is the large model and multimodal large model training and deployment framework provided by the [ModelScope community](https://modelscope.cn/)."
25
+ msgstr "ModelScope SWIFT (**ms-swift**) 是由 `ModelScope 社区 [ModelScope community](https://modelscope.cn/) 提供的大模型和多模态大模型训练部署框架。"
26
+
27
+ #: ../../source/training/ms_swift.md:5 6e980c27ae67400ca12c11fedf439af8
28
+ msgid "GitHub repository: [ms-swift](https://github.com/modelscope/ms-swift)"
29
+ msgstr "GitHub 仓库:[ms-swift](https://github.com/modelscope/ms-swift)"
30
+
31
+ #: ../../source/training/ms_swift.md:7 43999693226b4bc1ba78d7f8addaa01d
32
+ msgid "Features of using ms-swift for training LLM:"
33
+ msgstr "使用 ms-swift 训练大语言模型的特性:"
34
+
35
+ #: ../../source/training/ms_swift.md:9 b76a71cc42244cccaf2b699e41ee9c7f
36
+ msgid "**Model Types**: Supports 500+ plain-text large models and 200+ multimodal large models, covering the entire process from training to deployment."
37
+ msgstr "**模型类型**:支持 500+ 纯文本大模型和 200+ 多模态大模型,覆盖从训练到部署全流程。"
38
+
39
+ #: ../../source/training/ms_swift.md:10 f9a00d8a4789418abc700fd6774d784b
40
+ msgid "**Hardware Support**: Compatible with CPUs, RTX series GPUs, T4/V100, A10/A100/H100, Ascend NPUs, MPS, and more."
41
+ msgstr "**硬件支持**:兼容 CPU、RTX 系列 GPU、T4/V100、A10/A100/H100、Ascend NPU、MPS 等。"
42
+
43
+ #: ../../source/training/ms_swift.md:11 ead5a56786bf46b3a94582164537526a
44
+ msgid "**Training Methods**: Supports full-parameter fine-tuning, LoRA, QLoRA, DoRA, and other techniques."
45
+ msgstr "**训练方法**:支持全参数微调、LoRA、QLoRA、DoRA 等技术。"
46
+
47
+ #: ../../source/training/ms_swift.md:12 31ad671d19de412e9ad5dd76b933e615
48
+ msgid "**Distributed Training**: Supports distributed training technologies such as DDP, device_map, DeepSpeed ZeRO-2/ZeRO-3, FSDP, and integrates parallelism techniques from Megatron, including Tensor Parallelism, Pipeline Parallelism, Sequence Parallelism, and Expert Parallelism."
49
+ msgstr "**分布式训练**:支持分布式训练技术,如 DDP、device_map、DeepSpeed ZeRO-2/ZeRO-3、FSDP,并集成 Megatron 的并行技术,包括张量并行、流水线并行、序列并行和专家并行。"
50
+
51
+ #: ../../source/training/ms_swift.md:13 0d6d437bf4fb4485ba4a3b1ad166558e
52
+ msgid "**RLHF Training**: Supports human alignment methods like DPO, GRPO, DAPO, RM, PPO, KTO, etc., for both plain-text and multimodal large models."
53
+ msgstr "**RLHF 训练**:支持纯文本和多模态大模型的人类对齐方法,如 DPO、GRPO、DAPO、RM、PPO、KTO 等。"
54
+
55
+ #: ../../source/training/ms_swift.md:15 76bf873aaf8f495ca929ae422763046b
56
+ msgid "This article will demonstrate runnable training demos and provide the format for custom datasets. It includes how to use ms-swift for SFT and GRPO on Qwen3-8B, as well as using Megatron-SWIFT (ms-swift's integration of Megatron-LM) for SFT on Qwen3-30B-A3B. Through expert parallelism technology, MoE model training can be accelerated by nearly 10 times."
57
+ msgstr "本文将介绍可运行的训练示例,并提供自定义数据集的格式。内容包括如何使用 ms-swift 对 Qwen3-8B 进行 SFT 和 GRPO,以及使用 Megatron-SWIFT(ms-swift 集成的 Megatron-LM)对 Qwen3-30B-A3B 进行 SFT。通过专家并行技术,MoE 模型的训练速度可以提升近 10 倍。"
58
+
59
+ #: ../../source/training/ms_swift.md:17 1d166ff43c03452780ae38d1c6cd91e9
60
+ msgid "Before starting fine-tuning, ensure your environment is properly set up."
61
+ msgstr "在开始微调之前,请确保您的环境已正确配置。"
62
+
63
+ #: ../../source/training/ms_swift.md:32 8b5caa854cf641c489310f747ed205ba
64
+ msgid "Supervised Fine-Tuning (SFT)"
65
+ msgstr "监督微调 (SFT)"
66
+
67
+ #: ../../source/training/ms_swift.md:34 ../../source/training/ms_swift.md:206
68
+ #: 4ec49f5d7a1b4a9a9851cafafe9c7623
69
+ msgid "Data Preparation"
70
+ msgstr "数据准备"
71
+
72
+ #: ../../source/training/ms_swift.md:36 c71be51476e04ab0884cd908b042e263
73
+ msgid "The custom dataset format for SFT using ms-swift is as follows (the system field is optional). You can organize it into formats such as JSON, JSONL, or CSV. Specify `--dataset <dataset_path>` in the training script."
74
+ msgstr "使用 ms-swift 进行 SFT 的自定义数据集格式如下(system 字段是可选的)。您可以将其组织为 JSON、JSONL 或 CSV 格式。在训练脚本中指定 `--dataset <dataset_path>`。"
75
+
76
+ #: ../../source/training/ms_swift.md:38 5de2bd424af14c52b7d73385caca6fba
77
+ msgid "For complete dataset formatting guidelines, see: [Custom Dataset Documentation](https://swift.readthedocs.io/en/latest/Customization/Custom-dataset.html)"
78
+ msgstr "有关完整的数据集格式指南,请参考[自定义数据集文档](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html)。"
79
+
80
+ #: ../../source/training/ms_swift.md:40 a6a72b65b49f4aa2948a3092e070bee9
81
+ msgid "General format"
82
+ msgstr "通用格式"
83
+
84
+ #: ../../source/training/ms_swift.md:48 3e18752803b24196a4e2e307f2418469
85
+ msgid "Format with think"
86
+ msgstr "带有思考内容格式"
87
+
88
+ #: ../../source/training/ms_swift.md:56 48aafb23741045c49e62aa67837ebb28
89
+ msgid "If you want to train using data without a chain of thought but retain the model's reasoning ability, there are two approaches to minimize disruption during fine-tuning:"
90
+ msgstr "如果您想使用不含思维链的数据进行训练,同时保留模型的推理能力,可以通过以下两种方法尽量减少微调期间的干扰:"
91
+
92
+ #: ../../source/training/ms_swift.md:58 ff2352eac1fd4e57987b02b2b2b294e4
93
+ msgid "**Option 1**: During training, specify `--loss_scale ignore_empty_think` to ignore the loss calculation for `<think>\\n\\n</think>\\n\\n`, preventing the loss of reasoning ability. Refer to the training script [here](https://github.com/modelscope/ms-swift/blob/main/examples/train/think_model/qwen3_demo1.sh). The custom dataset format is as follows:"
94
+ msgstr "**选项 1**:在训练期间,指定 `--loss_scale ignore_empty_think`,以忽略对 `<think>\\n\\n</think>\\n\\n` 的损失计算,从而避免推理能力的丧失。训练脚本请参考[这里](https://github.com/modelscope/ms-swift/blob/main/examples/train/think_model/qwen3_demo1.sh)。自定义数据集格式如下:"
95
+
96
+ #: ../../source/training/ms_swift.md:67 fb0799da5fad46129d4682ffb2003f8e
97
+ msgid "**Option 2**: Add `/no_think` to the query in the dataset to avoid the loss of reasoning ability. Refer to the training script [here](https://github.com/modelscope/ms-swift/blob/main/examples/train/think_model/qwen3_demo2.sh). The custom dataset format is as follows:"
98
+ msgstr "**选项 2**:在数据集的查询中添加 `/no_think`,以避免推理能力的丧失。训练脚本请参考[这里](https://github.com/modelscope/ms-swift/blob/main/examples/train/think_model/qwen3_demo2.sh)。自定义数据集格式如下:"
99
+
100
+ #: ../../source/training/ms_swift.md:76 70f3b79067e34c989d6c3235179eff69
101
+ msgid "30-Minute Self-Cognition Fine-Tuning"
102
+ msgstr "30分钟自我认知微调"
103
+
104
+ #: ../../source/training/ms_swift.md:78 371e5bc107494dcd90a52569328a520d
105
+ msgid "This section introduces a 30-minute self-cognition fine-tuning process for the Qwen3-8B model. The required GPU memory is 22GB, and it can be run on the A10 provided by [ModelScope's free compute resources](https://modelscope.cn/my/mynotebook)."
106
+ msgstr "本节将介绍30分钟对 Qwen3-8B 进行自我认知微调。所需GPU显存为 22GB,可以在 ModelScope 提供的[免费算力](https://modelscope.cn/my/mynotebook) A10 中运行。"
107
+
108
+ #: ../../source/training/ms_swift.md:80 18dff1bfb142418c85d00c3a2f520661
109
+ msgid "After training, the model will identify itself as \"swift-robot,\" trained by \"swift,\" instead of its original self-cognition as \"Qwen,\" trained by Alibaba Cloud."
110
+ msgstr "训练后,模型将不再认为自己是由“阿里云”训练的“Qwen”,而是由“swift”训练的“swift-robot”。"
111
+
112
+ #: ../../source/training/ms_swift.md:82 2bf7287254bb432b9c29adc4f79014de
113
+ msgid "If you need to train in an offline environment, you can manually download the model and dataset and specify `--model <model-path>` and `--dataset <dataset-dir>`. The dataset can be found on [Modelscope Hub](https://modelscope.cn/datasets/swift/self-cognition)."
114
+ msgstr "如果需要在离线环境下进行训练,可以手动下载模型和数据集,并指定 `--model <model-path>` 和 `--dataset <dataset-dir>`。数据集可以在 [Modelscope Hub](https://modelscope.cn/datasets/swift/self-cognition) 上找到。"
115
+
116
+ #: ../../source/training/ms_swift.md:84 b4dcc1d366304d0abbfa994d76646547
117
+ msgid "For the meaning of each parameter in the training script, please refer to the [Command-line parameters documentation](https://swift.readthedocs.io/en/latest/Instruction/Command-line-parameters.html)."
118
+ msgstr "关于训练脚本中各参数的含义,请参考[命令行参数文档](https://swift.readthedocs.io/en/latest/Instruction/Command-line-parameters.html)。"
119
+
120
+ #: ../../source/training/ms_swift.md:114 185248e719634f389f7e85be89cbe7d0
121
+ msgid "After fine-tuning, you can use the following script to test the fine-tuning results. Note that the `--adapters` section needs to be modified to the directory path of the last saved checkpoint:"
122
+ msgstr "微调完成后,可以使��以下脚本来测试微调结果。注意,`--adapters` 部分需要修改为最后保存检查点的目录路径:"
123
+
124
+ #: ../../source/training/ms_swift.md:134 dd18bd5b0c9d4c8094e6b2c0b6c17ddc
125
+ msgid "By default, ms-swift will use the ModelScope community to download models and datasets. If you want to use the HuggingFace community, you need to additionally specify `--use_hf true`."
126
+ msgstr "默认情况下,ms-swift 会使用 ModelScope 社区下载模型和数据集。如果想使用 HuggingFace 社区,则需要额外指定 `--use_hf true`。"
127
+
128
+ #: ../../source/training/ms_swift.md:136 0ad518fadd134498ad3a393397c6d2ae
129
+ msgid "Merge LoRA weights:"
130
+ msgstr "合并 LoRA 权重:"
131
+
132
+ #: ../../source/training/ms_swift.md:144 4c72b93b992a40d89d27857096f9ac94
133
+ msgid "Push the model to ModelScope/HuggingFace:"
134
+ msgstr "推送模型到 ModelScope/HuggingFace:"
135
+
136
+ #: ../../source/training/ms_swift.md:157 a10da08e671a464fa20ec51056dd16ef
137
+ msgid "If you want to use multiple GPUs for training, the following provides a demo for multi-GPU training:"
138
+ msgstr "如果要使用多 GPU 进行训练,以下提供了多 GPU 训练的示例:"
139
+
140
+ #: ../../source/training/ms_swift.md:191 a287c14468ed4625ad50eb75770e4481
141
+ msgid "Reinforcement Learning (RL)"
142
+ msgstr ""
143
+
144
+ #: ../../source/training/ms_swift.md:193 007251dabc634a469f47dbdc443f44e5
145
+ msgid "ms-swift supports RLHF methods such as DPO, GRPO, DAPO, PPO, KTO, and more. This section will focus on an example of using ms-swift to perform GRPO training for Qwen3-8B."
146
+ msgstr "ms-swift 支持 DPO、GRPO、DAPO、PPO、KTO 等 RLHF 方法。本章将着重介绍使用 ms-swift 对 Qwen3-8B 进行 GRPO 训练。"
147
+
148
+ #: ../../source/training/ms_swift.md:195 6747ebd5490a42fa9bbe39c71d42de64
149
+ msgid "For detailed RLHF support information, please refer to: [Supported Features](https://swift.readthedocs.io/en/latest/Instruction/Pre-training-and-Fine-tuning.html)."
150
+ msgstr "有关详细的 RLHF 支持信息,请参考[支持的功能](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E9%A2%84%E8%AE%AD%E7%BB%83%E4%B8%8E%E5%BE%AE%E8%B0%83.html)。"
151
+
152
+ #: ../../source/training/ms_swift.md:197 c40c7e8842a94cf7b8abb7006010b343
153
+ msgid "Environment Setup"
154
+ msgstr "环境设置"
155
+
156
+ #: ../../source/training/ms_swift.md:199 b397dfabde0c4e099cb07fd0c3ab6630
157
+ msgid "In addition to installing the ms-swift related dependencies introduced above, the following dependencies also need to be installed:"
158
+ msgstr "除了安装上述介绍的 ms-swift 相关依赖项外,还需要安装以下依赖项:"
159
+
160
+ #: ../../source/training/ms_swift.md:208 06221d66d22741b49bb4ef2831dc0242
161
+ msgid "The dataset format for GRPO training using ms-swift is similar to that of SFT, except that the assistant part of the last round is not required. If using accuracy as a reward, a `solution` column is needed to calculate the accuracy."
162
+ msgstr "使用 ms-swift 进行 GRPO 训练的数据集格式与 SFT 类似,但不需要最后一轮的 assistant 部分。如果使用 accuracy 作为奖励,则需要一个 `solution` 列来计算准确率。"
163
+
164
+ #: ../../source/training/ms_swift.md:210 fb274880c62c4cad8243cbbed73f2adc
165
+ msgid "Example Dataset Formats:"
166
+ msgstr "示例数据集格式:"
167
+
168
+ #: ../../source/training/ms_swift.md:218 5de2bd424af14c52b7d73385caca6fba
169
+ msgid "For dataset preparation for other RLHF algorithms, see: [Custom Dataset Documentation](https://swift.readthedocs.io/en/latest/Customization/Custom-dataset.html#rlhf)."
170
+ msgstr "关于其他 RLHF 算法的数据集准备,请参考[自定义数据集文档](https://swift.readthedocs.io/zh-cn/latest/Customization/%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E9%9B%86.html#rlhf)。"
171
+
172
+ #: ../../source/training/ms_swift.md:220 31d062ff29e14c53ad92ca6d5ab81c23
173
+ msgid "Notes on Dataset Requirements:"
174
+ msgstr "数据集要求的注意事项:"
175
+
176
+ #: ../../source/training/ms_swift.md:222 f6e1dbba72e9450984df10e9da1f4f4c
177
+ msgid "**Reward Function Calculation**: The dataset format depends on the reward function being used. Additional columns may be required to support specific reward calculations. For instance:"
178
+ msgstr "**奖励函数计算**:数据集格式取决于所使用的奖励函数。可能需要额外的列来支持特定的奖励计算。例如:"
179
+
180
+ #: ../../source/training/ms_swift.md:224 5b6d41c5b1734f1a87358fb5416c5888
181
+ msgid "When using the built-in accuracy or cosine similarity reward, the dataset must include a `solution` column to calculate the accuracy of the responses."
182
+ msgstr "当使用内置的 accuracy 或 cosine 奖励时,数据集必须包含一个 `solution` 列以计算回复的准确性。"
183
+
184
+ #: ../../source/training/ms_swift.md:225 e1937a75effa48ffb42a3d463926c1b0
185
+ msgid "Other columns in the dataset will be passed as `**kwargs` to the reward function for additional customization."
186
+ msgstr "数据集中的其他列将作为 `**kwargs` 传递给奖励函数以实现进一步的自定义。"
187
+
188
+ #: ../../source/training/ms_swift.md:227 63ee17a7a6b041a88daee17b96928659
189
+ msgid "**Customizing the Reward Function**: To adapt the reward function to your specific needs, you can refer to the following resource: [External Reward Plugin](https://github.com/modelscope/ms-swift/tree/main/examples/train/grpo/plugin). This plugin provides examples and templates for implementing custom reward functions."
190
+ msgstr "**自定义奖励函数**:为了根据您的具体需求调整奖励函数,可以参考链接[外部奖励插件](https://github.com/modelscope/ms-swift/tree/main/examples/train/grpo/plugin)。该插件提供了实现自定义奖励函数的示例和模板。"
191
+
192
+ #: ../../source/training/ms_swift.md:229 05da2d673c94453cb2bee6c99e46c825
193
+ msgid "During the training process, we use vLLM to accelerate the sampling process. By setting `num_infer_workers=8`, we deploy a vLLM engine for each device to speed up the sampling process."
194
+ msgstr "在训练过程中,我们使用 vLLM 加速采样过程。通过设置 `num_infer_workers=8` ,我们为每个设备部署一个 vLLM 引擎以加快采样速度。"
195
+
196
+ #: ../../source/training/ms_swift.md:270 5fe351e5c4f84018988f72da7c78005a
197
+ msgid "Megatron-SWIFT"
198
+ msgstr "Megatron-SWIFT"
199
+
200
+ #: ../../source/training/ms_swift.md:272 b4dcc1d366304d0abbfa994d76646547
201
+ msgid "ms-swift incorporates Megatron parallelism techniques to accelerate the training of large models. The supported models can be found in the [Supported Models Documentation](https://swift.readthedocs.io/en/latest/Instruction/Supported-models-and-datasets.html)."
202
+ msgstr "ms-swift 引入了 Megatron 并行技术以加速大模型的训练。支持的模型可以在[支持的模型文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.html)中找到。"
203
+
204
+ #: ../../source/training/ms_swift.md:274 cacc805e7bae4869b249768ba0807ae1
205
+ msgid "For environment preparation and the conversion between HF and MCore model weights, you can refer to the [Megatron-SWIFT Training Documentation](https://swift.readthedocs.io/en/latest/Instruction/Megatron-SWIFT-Training.html). These topics will not be elaborated here."
206
+ msgstr "关于环境准备以及 HF 和 MCore 模型权重的转换,可以参考[Megatron-SWIFT训练文档](https://swift.readthedocs.io/zh-cn/latest/Instruction/Megatron-SWIFT%E8%AE%AD%E7%BB%83.html)。这里不展开介绍。"
207
+
208
+ #: ../../source/training/ms_swift.md:276 e4b6d48e1f5440ddbc5602e6860f7971
209
+ msgid "We will use Alibaba Cloud DLC to start the training The training environment consists of 2 machines with 8 * 80GiB A800 GPUs. For more information on multi-node startup methods, refer to [here](https://github.com/modelscope/ms-swift/tree/main/examples/train/multi-node)."
210
+ msgstr "我们将使用阿里云 DLC 启动训练。训练环境由2台配备8卡 80GiB A800 GPU 组成。关于多节点启动方法的更多信息,请参考[这里](https://github.com/modelscope/ms-swift/tree/main/examples/train/multi-node)。"
211
+
212
+ #: ../../source/training/ms_swift.md:316 62fd695e82d54817ae7e0a59ea0e0381
213
+ msgid "The custom dataset format is the same as `swift sft`, which can be found in the previous section. Simply specify `--dataset <dataset_path>`."
214
+ msgstr "自定义数据集格式与 `swift sft` 相同,详见之前章节。只需指定 `--dataset <dataset_path>` 即可。"
215
+
216
+ #: ../../source/training/ms_swift.md:318 bd84ae8eeaf248ffb43acb334e7626e7
217
+ msgid "The following is a comparison of training speed and GPU memory usage between `megatron sft` and `swift sft` for full-parameter fine-tuning of the Qwen3-30B-A3B model:"
218
+ msgstr "使用 `megatron sft` 和 `swift sft` 在对 Qwen3-30B-A3B 模型进行全参数微调的训练速度和 GPU 显存使用对比情况如下:"
219
+
220
+ #: ../../source/training/ms_swift.md 6e220a7c28b14bcd85fd9af5804ab91e
221
+ msgid "Megatron-LM"
222
+ msgstr "Megatron-LM"
223
+
224
+ #: ../../source/training/ms_swift.md d5ab9738de6241f5837c0d94ef9108d4
225
+ msgid "DeepSpeed-ZeRO2"
226
+ msgstr "DeepSpeed-ZeRO2"
227
+
228
+ #: ../../source/training/ms_swift.md 301a5de6123c442b8ffa6711f4910363
229
+ msgid "DeepSpeed-ZeRO3"
230
+ msgstr "DeepSpeed-ZeRO3"
231
+
232
+ #: ../../source/training/ms_swift.md 35818d0633704fd3a70482e77a32f892
233
+ msgid "Training Speed"
234
+ msgstr "训练速度"
235
+
236
+ #: ../../source/training/ms_swift.md 6b8176dc1e724ccfbcea6ab0fec3f2d8
237
+ msgid "9.6s/it"
238
+ msgstr "9.6s/it"
239
+
240
+ #: ../../source/training/ms_swift.md c344266bde2c4703bad8f2cd5b19a2ef
241
+ msgid "-"
242
+ msgstr ""
243
+
244
+ #: ../../source/training/ms_swift.md 468b05aed5be4fcf9593ba2ad6545868
245
+ msgid "91.2s/it"
246
+ msgstr "91.2s/it"
247
+
248
+ #: ../../source/training/ms_swift.md ffcfa71deee14901a6e96f3424251197
249
+ msgid "GPU Memory Usage"
250
+ msgstr "显存使用"
251
+
252
+ #: ../../source/training/ms_swift.md 6c68f675c1c343debbebd40e725aa3af
253
+ msgid "16 * 60GiB"
254
+ msgstr "16 * 60GiB"
255
+
256
+ #: ../../source/training/ms_swift.md 76e6265fbb52487fa8b3a8e5dd04e9bd
257
+ msgid "OOM"
258
+ msgstr "OOM"
259
+
260
+ #: ../../source/training/ms_swift.md 676f4cc38dba4dd5b69e76186a6dc3a1
261
+ msgid "16 * 80GiB"
262
+ msgstr "16 * 80GiB"
263
+
264
+ #: ../../source/training/ms_swift.md:325 ebfe245e509c4d17aa0977330d1b7668
265
+ msgid "Conclusion"
266
+ msgstr "总结"
267
+
268
+ #: ../../source/training/ms_swift.md:327 0cd0194d11994c899616a43b9650c0b6
269
+ msgid "The above is the best practice for training Qwen3 series models using ms-swift. If you encounter any difficulties during use, please join the discussion in [this issue](https://github.com/modelscope/ms-swift/issues/4030)."
270
+ msgstr "以上为使用 ms-swift 训练 Qwen3 系列模型的最佳实践。如果在使用过程中遇到任何困难,请在[此 issue](https://github.com/modelscope/ms-swift/issues/4030)中参与讨论。"
271
+
docs/locales/zh_CN/LC_MESSAGES/training/unsloth.po ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-07-28 10:50+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.17.0\n"
21
+
22
+ #: ../../source/training/unsloth.md:1 857a9b310ad247a981ec378e5c624e94
23
+ msgid "Unsloth"
24
+ msgstr ""
25
+
26
+ #: ../../source/training/unsloth.md:3 c75c1a88b89448cea8385c1269709dc0
27
+ #, python-format
28
+ msgid "This guide will teach you how to easily train Qwen3 models with Unsloth. Unsloth simplifies local model training, handling everything from loading and quantization to training, evaluation, running, and deployment with inference engines (Ollama, llama.cpp, vLLM). **Train Qwen** models 2× faster using 70% less VRAM."
29
+ msgstr "本指南将教您如何使用 Unsloth 轻松训练 Qwen3 模型。Unsloth 简化了本地模型训练,涵盖了从加载、量化到训练、评估、运行以及通过推理引擎(如 Ollama、llama.cpp、vLLM)进行部署的所有内容。**训练 Qwen** 模型的速度提升 2 倍,同时使用减少 70% 的显存(VRAM)。"
30
+
31
+ #: ../../source/training/unsloth.md:5 6ce37469f8434d82b0a1a807e2cc67ff
32
+ msgid "**GitHub repo:** [Unsloth](https://github.com/unslothai/unsloth)"
33
+ msgstr "**GitHub 仓库:** [Unsloth](https://github.com/unslothai/unsloth)"
34
+
35
+ #: ../../source/training/unsloth.md:7 702fad6892df4185a3a130827d8c10bd
36
+ msgid "⭐ Key Features"
37
+ msgstr "⭐ 主要特性"
38
+
39
+ #: ../../source/training/unsloth.md:8 7f46ea01deec495ba94b88c72fa5d557
40
+ msgid "Supports full fine-tuning, pretraining, LoRA, QLoRA, 8-bit training & more"
41
+ msgstr "支持全量微调、预训练、LoRA、QLoRA、8-bit 训练等"
42
+
43
+ #: ../../source/training/unsloth.md:9 9d8a9bc65e6d4c6ba9bd4c25d1c07a4b
44
+ msgid "Single and multi-GPU support (Linux, Windows, Colab, Kaggle; NVIDIA GPUs, soon AMD & Intel)"
45
+ msgstr "支持单 GPU 和多 GPU(Linux、Windows、Colab、Kaggle;NVIDIA GPU,即将支持 AMD 和 Intel)"
46
+
47
+ #: ../../source/training/unsloth.md:10 2c4fb728cbf443c9b69c58594202fff4
48
+ msgid "Compatible with all transformer models: TTS, multimodal, STT, BERT, RL"
49
+ msgstr "兼容所有 Transformer 模型:TTS、多模态、STT、BERT、RL"
50
+
51
+ #: ../../source/training/unsloth.md:11 0a81b3f4ee664e2f9d3683d986e3a8e3
52
+ msgid "RLHF support: GRPO, DPO, DAPO, RM, PPO, KTO, etc."
53
+ msgstr "支持 RLHF:GRPO、DPO、DAPO、RM、PPO、KTO 等"
54
+
55
+ #: ../../source/training/unsloth.md:12 30784cc59fff4cb39b180ea2fae50064
56
+ msgid "Hand-written Triton kernels and a manual backprop engine ensure no accuracy degradation (0% approximation)."
57
+ msgstr "手写 Triton 内核和手动反向传播引擎确保无精度损失(0% 近似)。"
58
+
59
+ #: ../../source/training/unsloth.md:14 ad482aa635484a67896a0cfa126037a8
60
+ msgid "Quickstart"
61
+ msgstr "快速入门"
62
+
63
+ #: ../../source/training/unsloth.md:15 884abdd5143c4f8b9e30a8831493e48f
64
+ msgid "**Local Installation (Linux recommended):**"
65
+ msgstr "**本地安装(推荐 Linux):**"
66
+
67
+ #: ../../source/training/unsloth.md:21 38492db20dcb4119b6712c633b05e090
68
+ msgid "You can view Unsloth’s full [installation instructions here.](https://docs.unsloth.ai/get-started/installing-+-updating)"
69
+ msgstr "您可以在此处查看 Unsloth 的完整[安装说明\[英文\]](https://docs.unsloth.ai/get-started/installing-+-updating)。"
70
+
71
+ #: ../../source/training/unsloth.md:23 1fe28bbc6e9d418dbe6d870714d2e8dd
72
+ msgid "Fine-tuning Qwen3 with Unsloth"
73
+ msgstr "使用 Unsloth 微调 Qwen3"
74
+
75
+ #: ../../source/training/unsloth.md:24 863559c6be5d4b8b9535ccf005d7f4ac
76
+ #, python-format
77
+ msgid "Unsloth makes Qwen3 fine-tuning 2× faster, uses 70% less VRAM, with 8× longer contexts. Qwen3 (14B) fits in a free 16 GB Colab Tesla T4 GPU."
78
+ msgstr "Unsloth 使 Qwen3 的微调速度提升 2 倍,显存(VRAM)使用减少 70%,并支持 8 倍更长的上下文。Qwen3(14B)可轻松运行在免费的 16 GB 显存 Colab Tesla T4 GPU 上。"
79
+
80
+ #: ../../source/training/unsloth.md:26 34d66ac952624c9e8978e1969fd27633
81
+ #, python-format
82
+ msgid "To retain Qwen3's reasoning capabilities, use a 75% reasoning to 25% non-reasoning dataset ratio (e.g., NVIDIA’s math‑reasoning dataset + Maxime’s FineTome)."
83
+ msgstr "为了保留 Qwen3 的推理能力,建议使用 75% 推理类数据与 25% 非推理类数据的组合(例如,NVIDIA 的数学推理数据集 + Maxime 的 FineTome 数据集)。"
84
+
85
+ #: ../../source/training/unsloth.md:28 c316c959303040ca952d24729f8fc0a4
86
+ msgid "For more details, see Unsloth’s full [Qwen3 fine-tuning guide](https://docs.unsloth.ai/basics/qwen3-how-to-run-and-fine-tune#fine-tuning-qwen3-with-unsloth)."
87
+ msgstr "更多详细信息,请参阅 Unsloth 完整的[Qwen3 微调指南\[英文\]](https://docs.unsloth.ai/basics/qwen3-how-to-run-and-fine-tune#fine-tuning-qwen3-with-unsloth)。"
88
+
89
+ #: ../../source/training/unsloth.md:30 581ccade253e4145be58856901aeee91
90
+ msgid "Colab Notebooks"
91
+ msgstr ""
92
+
93
+ #: ../../source/training/unsloth.md:31 f131a50d6c604bd3aa9a896500bd2cc2
94
+ msgid "[Qwen3 (14B) Reasoning + Conversational](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen3_(14B)-Reasoning-Conversational.ipynb)"
95
+ msgstr ""
96
+
97
+ #: ../../source/training/unsloth.md:32 fc6397fddd354fc1a44a4329dd4020d4
98
+ msgid "[Qwen3 (4B) Advanced GRPO LoRA](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen3_(4B)-GRPO.ipynb)"
99
+ msgstr ""
100
+
101
+ #: ../../source/training/unsloth.md:33 061f4bf082fd435db514c9355e599453
102
+ msgid "[Qwen3 (14B) Alpaca (Base model)](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen3_(14B)-Alpaca.ipynb)"
103
+ msgstr ""
104
+
105
+ #: ../../source/training/unsloth.md:35 c5bb61e8cb7e4e078956e837d033f339
106
+ msgid "**Update Unsloth locally:**"
107
+ msgstr "**在本地更新 Unsloth:**"
108
+
109
+ #: ../../source/training/unsloth.md:41 4eb073fad2e344dba1f0fb622c18ccd2
110
+ msgid "Fine-tuning Qwen3 MoE Models"
111
+ msgstr "微调 Qwen3 MoE 模型"
112
+
113
+ #: ../../source/training/unsloth.md:42 22755ac77e144d2aa7e959fa0a86aeaa
114
+ msgid "Supported MoE models include 30B‑A3B and 235B‑A22B. Unsloth fine-tunes the 30B‑A3B model with just 17.5 GB VRAM. Router-layer fine-tuning is disabled by default."
115
+ msgstr "支持的 MoE 模型包括 30B‑A3B 和 235B‑A22B。Unsloth 仅需 17.5 GB 显存即可微调 30B‑A3B 模型。默认情况下禁用路由层(router-layer)的微调。"
116
+
117
+ #: ../../source/training/unsloth.md:44 19ffbd02f9ab44e78a2eae078de3bc4a
118
+ msgid "Use `FastModel` for MoE fine-tuning:"
119
+ msgstr "对 MoE 模型进行微调时,请使用 `FastModel`:"
120
+
121
+ #: ../../source/training/unsloth.md:58 55c17609e3844f57aa6a7f61b8e0629c
122
+ msgid "Notebook Guide"
123
+ msgstr "Notebook 指南"
124
+
125
+ #: ../../source/training/unsloth.md:59 2897bf2a487d4f21ac0bcd8d1866f53e
126
+ msgid "For an end-to-end walkthrough, see Unsloth’s [full end-to-end fine-tuning guide](https://docs.unsloth.ai/basics/reinforcement-learning-rl-guide)."
127
+ msgstr "如需端到端的完整操作流程,请参阅 Unsloth 的[完整端到端微调指南\[英文\]](https://docs.unsloth.ai/basics/reinforcement-learning-rl-guide)。"
128
+
129
+ #: ../../source/training/unsloth.md:61 919bfc2dc5f640a1a2c18af536e38529
130
+ msgid "Open the notebook → click **Runtime ▸ Run all**."
131
+ msgstr "打开 Notebook → 点击 **Runtime ▸ Run all**。"
132
+
133
+ #: ../../source/training/unsloth.md:62 76fed20c6fa048728023f2664089d991
134
+ msgid "Adjust settings (e.g., model name, context length) directly in the notebook:"
135
+ msgstr "直接在 Notebook 中调整设置(例如模型名称、上下文长度):"
136
+
137
+ #: ../../source/training/unsloth.md:63 c60e9857fd4e44b794ccfd2cc5d15cbe
138
+ msgid "`max_seq_length`: Recommended 2048 (Qwen3 supports up to 40960)."
139
+ msgstr "`max_seq_length`:推荐值为 2048(Qwen3 最高支持 40960)。"
140
+
141
+ #: ../../source/training/unsloth.md:64 e73b7cab67cc4eed802c6af5219f6cc6
142
+ msgid "`load_in_4bit=True`: reduces memory usage by 4×."
143
+ msgstr "`load_in_4bit=True`:将内存使用量减少为原来的四分之一。"
144
+
145
+ #: ../../source/training/unsloth.md:65 06e12675ca494226a2731a616fbe8c01
146
+ msgid "Enable full fine-tuning (`full_finetuning=True`) or 8-bit training (`load_in_8bit=True`)."
147
+ msgstr "启用全量微调(`full_finetuning=True`)或 8-bit 训练(`load_in_8bit=True`)。"
148
+
149
+ #: ../../source/training/unsloth.md:67 fcc086506d3f45b1bc0aee524dbc1cfe
150
+ msgid "If you want to use models directly from [ModelScope](https://modelscope.cn/organization/unsloth), use:"
151
+ msgstr "如果您想直接使用来自 [ModelScope](https://modelscope.cn/organization/unsloth) 的模型,请使用:"
152
+
153
+ #: ../../source/training/unsloth.md:85 9d6116efc01d44ff948af4e660045bb5
154
+ msgid "RL & GRPO with Qwen3"
155
+ msgstr "使用 Qwen3 进行强化学习(RL)与 GRPO"
156
+
157
+ #: ../../source/training/unsloth.md:86 0afdabd0d4bf4ae7936b67de95c3ed3d
158
+ msgid "You can also train Qwen models with reinforcement learning (RL) using Unsloth. Explore Unsloth’s advanced GRPO notebook, featuring proximity-based reward scoring and Hugging Face's Open‑R1 math dataset: [Qwen3 (4B) Advanced GRPO LoRA notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen3_(4B)-GRPO.ipynb)."
159
+ msgstr "您还可以使用 Unsloth 通过强化学习(RL)来训练 Qwen 模型。探索 Unsloth 的进阶 GRPO Notebook,其中包含基于接近度的奖励评分和 Hugging Face 的 Open‑R1 数学数据集:[Qwen3 (4B) 进阶 GRPO LoRA Notebook](https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/Qwen3_(4B)-GRPO.ipynb)。"
160
+
161
+ #: ../../source/training/unsloth.md:87 4fc6252997454f769562fc37150d5bd1
162
+ msgid "Proximity-based rewards for closer answers"
163
+ msgstr "基于 Proximity 的奖励,对更接近正确答案的回答给予更高奖励"
164
+
165
+ #: ../../source/training/unsloth.md:88 e38b7b9cb5ed447caeed00e37aa1f7e1
166
+ msgid "Custom GRPO formatting and templates"
167
+ msgstr "自定义 GRPO 格式和模板"
168
+
169
+ #: ../../source/training/unsloth.md:89 feecf90a36cf40fab79713ed8c84dfa7
170
+ msgid "Enhanced evaluation accuracy with regex matching"
171
+ msgstr "通过正则表达式匹配提高评估准确性"
172
+
173
+ #: ../../source/training/unsloth.md:91 c176e49b6e4a42a0b89ff7b180faf0bc
174
+ msgid "Resources & Links"
175
+ msgstr "资源与链接"
176
+
177
+ #: ../../source/training/unsloth.md:92 d29d33008569432bbf59ffae56e62a48
178
+ msgid "That’s how you can easily train Qwen models with Unsloth. If you need any help, join the discussion on Unsloth’s [Discord](https://discord.com/invite/unsloth) or [GitHub](https://github.com/unslothai/unsloth) pages."
179
+ msgstr "这就是使用 Unsloth 轻松训练 Qwen 模型的方法。如果您需要任何帮助,请加入 Unsloth 的 [Discord](https://discord.com/invite/unsloth) 或 [GitHub](https://github.com/unslothai/unsloth) 页面参与讨论。"
180
+
181
+ #: ../../source/training/unsloth.md:94 ff3536ed471841f7addfbcdb828dc11d
182
+ msgid "**Links:**"
183
+ msgstr "**链接:**"
184
+
185
+ #: ../../source/training/unsloth.md:95 873de88c8178499f8b0262fe30dbf44c
186
+ msgid "[Unsloth Documentation](https://docs.unsloth.ai/)"
187
+ msgstr "[Unsloth 官方文档](https://docs.unsloth.ai/)"
188
+
189
+ #: ../../source/training/unsloth.md:96 69437a5a07834f5ab79c96961dc95842
190
+ msgid "[Unsloth Discord](https://discord.com/invite/unsloth)"
191
+ msgstr ""
192
+
193
+ #: ../../source/training/unsloth.md:97 3e8bbe8da0124e5d8ff71868e19141cd
194
+ msgid "[Unsloth Website](https://unsloth.ai/)"
195
+ msgstr "[Unsloth 官方站点](https://unsloth.ai/)"
196
+
197
+ #: ../../source/training/unsloth.md:98 35c1f4a1bcf647f096bdee249fcabdaa
198
+ msgid "[Unsloth Reddit](https://www.reddit.com/r/unsloth/)"
199
+ msgstr ""
200
+
docs/locales/zh_CN/LC_MESSAGES/training/verl.po ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) 2024, Qwen Team
3
+ # This file is distributed under the same license as the Qwen package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: Qwen \n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2025-06-13 17:22+0800\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language: zh_CN\n"
15
+ "Language-Team: zh_CN <LL@li.org>\n"
16
+ "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "MIME-Version: 1.0\n"
18
+ "Content-Type: text/plain; charset=utf-8\n"
19
+ "Content-Transfer-Encoding: 8bit\n"
20
+ "Generated-By: Babel 2.16.0\n"
21
+
22
+ #: ../../source/training/verl.md:1 937d32044f9d4ce685b5c0d297d2c48d
23
+ msgid "verl"
24
+ msgstr ""
25
+
26
+ #: ../../source/training/verl.md:3 11c0fdd831b444f28be5cce4fd8f8b38
27
+ msgid "verl is a flexible, efficient and production-ready RL training library for large language models (LLMs)."
28
+ msgstr "verl 是一个灵活、高效且被广泛使用的强化学习(RL)训练库,专为大型语言模型(LLM)设计。"
29
+
30
+ #: ../../source/training/verl.md:5 64a80c70bd8a49cbb40d4acd035c6212
31
+ msgid "verl is the open-source version of [HybridFlow: A Flexible and Efficient RLHF Framework](https://arxiv.org/abs/2409.19256v2) paper."
32
+ msgstr "verl 是论文 [HybridFlow: A Flexible and Efficient RLHF Framework](https://arxiv.org/abs/2409.19256v2) 的开源实现"
33
+
34
+ #: ../../source/training/verl.md:7 81aa9801baa54d72bef51c26925278d2
35
+ msgid "GitHub repository: [verl](https://github.com/volcengine/verl)"
36
+ msgstr "仓库地址:[verl](https://github.com/volcengine/verl)"
37
+
38
+ #: ../../source/training/verl.md:9 2080b3c322ac41299917a122b4826994
39
+ msgid "verl is flexible and easy to use with:"
40
+ msgstr "verl 的灵活性和易用性体现在以下几个方面:"
41
+
42
+ #: ../../source/training/verl.md:11 564fbddc57ae43e090e24fe6426d670a
43
+ msgid "**Easy extension of diverse RL algorithms**: The hybrid-controller programming model enables flexible representation and efficient execution of complex Post-Training dataflows. Build RL dataflows such as GRPO, PPO in a few lines of code."
44
+ msgstr "**支持多样化的强化学习算法扩展**:verl 采用混合编程模型,结合了单一控制器和多控制器的优势,能够灵活表示和高效执行复杂的后训练数据流。用户只需几行代码即可构建强化学习数据流,例如 PPO、GRPO 等。"
45
+
46
+ #: ../../source/training/verl.md:12 690f3983ad004db081baba2bc5d80d32
47
+ msgid "**Seamless integration of existing LLM infra with modular APIs**: Decouples computation and data dependencies, enabling seamless integration with existing LLM frameworks, such as FSDP, Megatron-LM, vLLM, SGLang, etc"
48
+ msgstr "**与现有大语言模型基础设施无缝集成**:verl 通过模块化 API 解耦计算和数据依赖,支持与 PyTorch FSDP、Megatron-LM、vLLM 等现有大语言模型框架无缝集成,且用户可以轻松扩展到其他训练和推理框架。"
49
+
50
+ #: ../../source/training/verl.md:13 323cbf0f7b034e3aadaa3b86e4680058
51
+ msgid "**Flexible device mapping**: Supports various placement of models onto different sets of GPUs for efficient resource utilization and scalability across different cluster sizes."
52
+ msgstr "**灵活的设备映射和并行性**:verl 支持将模型放置到不同 GPU 集合上,以实现高效的资源利用和跨不同集群规模的可扩展性。"
53
+
54
+ #: ../../source/training/verl.md:14 e76a04d1c8aa491e8d6ae1d24d3b71d8
55
+ msgid "**Ready integration with popular HuggingFace models**: verl supports popular LLM models, including Qwen, Llama, and more."
56
+ msgstr "**与热门 HuggingFace 模型的及时集成**:verl 支持多种流行的 LLM 模型,包括 Qwen、Llama 等。"
57
+
58
+ #: ../../source/training/verl.md:16 acc32ec6e23248d1b3714424bcb868f5
59
+ msgid "verl is fast with:"
60
+ msgstr "verl 的高效性体现在以下几个方面:"
61
+
62
+ #: ../../source/training/verl.md:18 bdeb7205dbd04ab689ab15907fe8ced1
63
+ msgid "**State-of-the-art throughput**: SOTA LLM training and inference engine integrations and SOTA RL throughput."
64
+ msgstr "**最高效的吞吐量**:verl 集成了最先进的 LLM 训练和推理引擎,并实现了最先进的强化学习(RL)吞吐量。"
65
+
66
+ #: ../../source/training/verl.md:19 314eba723e854d1ab020ec72a0251706
67
+ msgid "**Efficient actor model resharding with 3D-HybridEngine**: Eliminates memory redundancy and significantly reduces communication overhead during transitions between training and generation phases."
68
+ msgstr "**使用 3D-HybridEngine 实现高效的 Actor 模型分片**:消除内存冗余,并显著减少训练和生成阶段转换期间的通信开销。"
69
+
70
+ #: ../../source/training/verl.md:21 d76b21e9b42c414283609c3846c1e75c
71
+ msgid "Next, we will introduce how to use verl for training Qwen3 models."
72
+ msgstr "接下来,我们将介绍如何使用 verl 训练 Qwen3 模型。"
73
+
74
+ #: ../../source/training/verl.md:23 6924574168a841e39a4ef0dfb11e6439
75
+ msgid "Reinforcement Learning (RL)"
76
+ msgstr "强化学习(RL)"
77
+
78
+ #: ../../source/training/verl.md:25 5dae4a3e148042c3b9a2d42e967f7798
79
+ msgid "Now, verl supports various combinations of training frameworks and inference frameworks, including FSDP, Megatron-LM, vLLM, SGLang, etc. verl also supports training with multiple algorithms such as PPO, GRPO, DAPO, etc."
80
+ msgstr "现在,verl 支持多种训练框架和推理框架的组合,包括 FSDP、Megatron-LM、vLLM、SGLang 等。此外,verl 还支持使用多种算法进行训练,例如 PPO、GRPO、DAPO 等。"
81
+
82
+ #: ../../source/training/verl.md:27 5fe2ddcafab04734a5ce56358f213de2
83
+ msgid "Step1: Environment and Training Preparation"
84
+ msgstr "第一步:环境和训练准备"
85
+
86
+ #: ../../source/training/verl.md:29 f5bd55e1b12e4cf0a5c77959e30a2add
87
+ msgid "You can follow verl's [installation guide](https://verl.readthedocs.io/en/latest/start/install.html) to complete the environment configuration."
88
+ msgstr "你可以按照 verl 的 [安装指南](https://verl.readthedocs.io/en/latest/start/install.html) 完成环境配置。"
89
+
90
+ #: ../../source/training/verl.md:31 c5a07c1e71a44be699c2628b0af66fa7
91
+ msgid "Data preparation can be done by running the following command:"
92
+ msgstr "数据准备可以通过运行以下命令完成:"
93
+
94
+ #: ../../source/training/verl.md:39 e626176f3660473ba8a834ba471135eb
95
+ msgid "Model download can be done using the following command:"
96
+ msgstr "模型下载可以使用以下命令完成:"
97
+
98
+ #: ../../source/training/verl.md:45 fda85ea40df948188f0b765379c5f5b0
99
+ msgid "Step2: Start Training"
100
+ msgstr "第二步:开始训练"
101
+
102
+ #: ../../source/training/verl.md:47 24994606b01b452abb1f3c487862bf57
103
+ msgid "In verl, training frameworks and inference frameworks can be combined freely, as long as the training framework and inference framework themselves support model training and inference tasks, so that verl can support RL-related training."
104
+ msgstr "在 verl 中,训练框架和推理框架可以自由组合,只要训练框架和推理框架本身支持模型训练和推理任务,verl 就能够支持与强化学习(RL)相关的训练。"
105
+
106
+ #: ../../source/training/verl.md:49 3f8ac764b49c42a2bd5a673461866371
107
+ msgid "Below is an example using FSDP and vLLM to demonstrate how to train Qwen3 models in verl. We chose Qwen3-1.7B as the example, as it only requires a single 80GB GPU and a machine with more than 64GB of memory to start training."
108
+ msgstr "以下是一个使用 FSDP 和 vLLM 的示例,展示如何在 verl 中训练 Qwen3 模型。我们选择了Qwen3-1.7B作为例子,因为他仅需使用一张80GB显存的显卡,以及大于64G内存的机器即可开始训练。"
109
+
110
+ #: ../../source/training/verl.md:92 8b8ed7d9463c4a8086d5fe1a452b34e0
111
+ msgid "Finally"
112
+ msgstr "结束语"
113
+
114
+ #: ../../source/training/verl.md:94 294699cc5278422f85beebb282ad0c2a
115
+ msgid "If you encounter any difficulties during use, please join the discussion at [GitHub](https://github.com/volcengine/verl/discussions)."
116
+ msgstr "如果在使用过程中遇到任何困难,请在 [GitHub](https://github.com/volcengine/verl/discussions) 参与讨论。"
117
+
docs/make.bat ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=source
11
+ set BUILDDIR=build
12
+
13
+ if "%1" == "" goto help
14
+
15
+ %SPHINXBUILD% >NUL 2>NUL
16
+ if errorlevel 9009 (
17
+ echo.
18
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19
+ echo.installed, then set the SPHINXBUILD environment variable to point
20
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
21
+ echo.may add the Sphinx directory to PATH.
22
+ echo.
23
+ echo.If you don't have Sphinx installed, grab it from
24
+ echo.https://www.sphinx-doc.org/
25
+ exit /b 1
26
+ )
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd
docs/requirements-docs.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ furo
2
+ myst-parser==4.0.0
3
+ sphinx<8,>4.5.0
4
+ sphinx-copybutton
5
+ sphinx-design>=0.6.0
docs/source/_static/css/custom.css ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html {
2
+ font-size: 16px;
3
+ }
4
+
5
+ h1 {
6
+ font-size: 1.75rem;
7
+ line-height: 2.5rem;
8
+ }
9
+
10
+ h2 {
11
+ font-size: 1.5rem;
12
+ line-height: 2rem;
13
+ }
14
+
15
+ h3 {
16
+ font-size: 1.25rem;
17
+ line-height: 1.75rem;
18
+ }
19
+
20
+ h4 {
21
+ font-size: 1.125rem;
22
+ line-height: 1.5rem;
23
+ }
24
+
25
+ h5 {
26
+ font-size: 1rem;
27
+ }
28
+
29
+ h6 {
30
+ font-size: 0.75rem;
31
+ }
32
+
33
+ h1,
34
+ h2,
35
+ h3,
36
+ h4,
37
+ h5,
38
+ h6 {
39
+ margin-top: 1.875rem;
40
+ margin-bottom: 1rem;
41
+ }
42
+
43
+ p strong {
44
+ font-weight: 500;
45
+ }
46
+
47
+ p:target {
48
+ background-color: var(--color-highlight-on-target);
49
+ }
50
+
51
+ details.sd-dropdown summary.sd-summary-title {
52
+ flex-direction: row-reverse;
53
+ font-weight: 500;
54
+ padding-left: 0;
55
+ }
56
+
57
+ details.sd-dropdown summary.sd-summary-title code.literal {
58
+ font-weight: bolder;
59
+ filter: brightness(95%);
60
+ }
61
+
62
+ details.sd-dropdown summary.sd-summary-title span.sd-summary-state-marker {
63
+ padding-left: 0.5em;
64
+ padding-right: 0.5em
65
+ }
66
+
67
+ details.sd-dropdown div.sd-summary-content {
68
+ padding-left: 2.5em;
69
+ }
70
+
71
+ pre.terminal {
72
+ font-size: 12px !important;
73
+ line-height: 16px;
74
+ background-color: black;
75
+ color: white;
76
+ padding: .5em;
77
+ text-wrap: wrap;
78
+ word-break: break-all;
79
+ }
80
+
81
+ pre.terminal span.system {
82
+ color: greenyellow
83
+ }
84
+
85
+ pre.terminal span.user {
86
+ color: yellowgreen
87
+ }
docs/source/_static/design-tabs.js ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // @ts-check
2
+
3
+ // Extra JS capability for selected tabs to be synced
4
+ // The selection is stored in local storage so that it persists across page loads.
5
+
6
+ /**
7
+ * @type {Record<string, HTMLElement[]>}
8
+ */
9
+ let sd_id_to_elements = {};
10
+ const storageKeyPrefix = "sphinx-design-tab-id-";
11
+
12
+ /**
13
+ * Create a key for a tab element.
14
+ * @param {HTMLElement} el - The tab element.
15
+ * @returns {[string, string, string] | null} - The key.
16
+ *
17
+ */
18
+ function create_key(el) {
19
+ let syncId = el.getAttribute("data-sync-id");
20
+ let syncGroup = el.getAttribute("data-sync-group");
21
+ if (!syncId || !syncGroup) return null;
22
+ return [syncGroup, syncId, syncGroup + "--" + syncId];
23
+ }
24
+
25
+ /**
26
+ * Initialize the tab selection.
27
+ *
28
+ */
29
+ function ready() {
30
+ // Find all tabs with sync data
31
+
32
+ /** @type {string[]} */
33
+ let groups = [];
34
+
35
+ document.querySelectorAll(".sd-tab-label").forEach((label) => {
36
+ if (label instanceof HTMLElement) {
37
+ let data = create_key(label);
38
+ if (data) {
39
+ let [group, id, key] = data;
40
+
41
+ // add click event listener
42
+ // @ts-ignore
43
+ label.onclick = onSDLabelClick;
44
+
45
+ // store map of key to elements
46
+ if (!sd_id_to_elements[key]) {
47
+ sd_id_to_elements[key] = [];
48
+ }
49
+ sd_id_to_elements[key].push(label);
50
+
51
+ if (groups.indexOf(group) === -1) {
52
+ groups.push(group);
53
+ // Check if a specific tab has been selected via URL parameter
54
+ const tabParam = new URLSearchParams(window.location.search).get(
55
+ group
56
+ );
57
+ if (tabParam) {
58
+ console.log(
59
+ "sphinx-design: Selecting tab id for group '" +
60
+ group +
61
+ "' from URL parameter: " +
62
+ tabParam
63
+ );
64
+ window.sessionStorage.setItem(storageKeyPrefix + group, tabParam);
65
+ }
66
+ }
67
+
68
+ // Check is a specific tab has been selected previously
69
+ let previousId = window.sessionStorage.getItem(
70
+ storageKeyPrefix + group
71
+ );
72
+ if (previousId === id) {
73
+ // console.log(
74
+ // "sphinx-design: Selecting tab from session storage: " + id
75
+ // );
76
+ // @ts-ignore
77
+ label.previousElementSibling.checked = true;
78
+ }
79
+ }
80
+ }
81
+ });
82
+ }
83
+
84
+ /**
85
+ * Activate other tabs with the same sync id.
86
+ *
87
+ * @this {HTMLElement} - The element that was clicked.
88
+ */
89
+ function onSDLabelClick() {
90
+ let data = create_key(this);
91
+ if (!data) return;
92
+ const top = this.parentElement?.offsetTop || 0;
93
+ console.log(top);
94
+ let [group, id, key] = data;
95
+ for (const label of sd_id_to_elements[key]) {
96
+ if (label === this) continue;
97
+ // @ts-ignore
98
+ label.previousElementSibling.checked = true;
99
+ }
100
+ const diff = (this.parentElement?.offsetTop || 0) - top;
101
+ if (diff !== 0) {
102
+ window.scrollBy({ left: 0, top: diff, behavior: "instant" });
103
+ }
104
+ window.sessionStorage.setItem(storageKeyPrefix + group, id);
105
+ }
106
+
107
+ document.addEventListener("DOMContentLoaded", ready, false);
docs/source/assets/qwen-openllm-ui-demo.png ADDED

Git LFS Details

  • SHA256: ef2fc5d3cc6a269b4224224ab1dbb61b7a7bd0d1ce16e7bc4fdd9ed0cbda5a73
  • Pointer size: 131 Bytes
  • Size of remote file: 315 kB
docs/source/assets/qwen3_nonthinking.jinja ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n<think>\n\n</think>\n\n' }}
86
+ {%- endif %}
docs/source/conf.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # This file only contains a selection of the most common options. For a full
4
+ # list see the documentation:
5
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
6
+
7
+ # -- Path setup --------------------------------------------------------------
8
+
9
+ # If extensions (or modules to document with autodoc) are in another directory,
10
+ # add these directories to sys.path here. If the directory is relative to the
11
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
12
+
13
+ import sys
14
+ from sphinx.ext import autodoc
15
+ import logging
16
+
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+ # -- Project information -----------------------------------------------------
21
+
22
+ project = "C9-AI"
23
+ copyright = "2025, C9-AI Team"
24
+ author = "C9-AI Team"
25
+
26
+ # -- General configuration ---------------------------------------------------
27
+
28
+ # Add any Sphinx extension module names here, as strings. They can be
29
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
30
+ # ones.
31
+ extensions = [
32
+ "sphinx.ext.napoleon",
33
+ "sphinx.ext.viewcode",
34
+ "sphinx.ext.intersphinx",
35
+ # "sphinx_copybutton",
36
+ "sphinx.ext.autodoc",
37
+ "sphinx.ext.autosummary",
38
+ "myst_parser",
39
+ "sphinx_design",
40
+ ]
41
+
42
+ myst_enable_extensions = ["colon_fence", "attrs_block", "attrs_inline", "fieldlist"]
43
+
44
+ # Add any paths that contain templates here, relative to this directory.
45
+ templates_path = ["_templates"]
46
+
47
+ # List of patterns, relative to source directory, that match files and
48
+ # directories to ignore when looking for source files.
49
+ # This pattern also affects html_static_path and html_extra_path.
50
+ exclude_patterns = []
51
+
52
+ # Exclude the prompt "$" when copying code
53
+ copybutton_prompt_text = r"\$ "
54
+ copybutton_prompt_is_regexp = True
55
+
56
+ # -- Options for HTML output -------------------------------------------------
57
+
58
+ # The theme to use for HTML and HTML Help pages. See the documentation for
59
+ # a list of builtin themes.
60
+ #
61
+ html_title = project
62
+ html_theme = "furo"
63
+ # html_logo = 'assets/logo/qwen.png'
64
+ # html_theme_options = {
65
+ # 'path_to_docs': 'docs/source',
66
+ # 'repository_url': 'https://github.com/QwenLM/Qwen2',
67
+ # # 'use_repository_button': True,
68
+ # }
69
+ html_sidebars = {
70
+ "**": [
71
+ "sidebar/scroll-start.html",
72
+ "sidebar/brand.html",
73
+ "sidebar/navigation.html",
74
+ "sidebar/ethical-ads.html",
75
+ "sidebar/scroll-end.html",
76
+ ]
77
+ }
78
+
79
+ # multi-language docs
80
+ language = "en"
81
+ locale_dirs = ["../locales/"] # path is example but recommended.
82
+ gettext_compact = False # optional.
83
+ gettext_uuid = True # optional.
84
+
85
+ # Add any paths that contain custom static files (such as style sheets) here,
86
+ # relative to this directory. They are copied after the builtin static files,
87
+ # so a file named "default.css" will overwrite the builtin "default.css".
88
+ html_static_path = ["_static"]
89
+ html_css_files = [
90
+ "css/custom.css",
91
+ ]
92
+ # FIXME: figure out why this file is not copied
93
+ html_js_files = [
94
+ "design-tabs.js",
95
+ ]
96
+
97
+ # Mock out external dependencies here.
98
+ autodoc_mock_imports = ["torch", "transformers"]
99
+
100
+ for mock_target in autodoc_mock_imports:
101
+ if mock_target in sys.modules:
102
+ logger.info(
103
+ f"Potentially problematic mock target ({mock_target}) found; "
104
+ "autodoc_mock_imports cannot mock modules that have already "
105
+ "been loaded into sys.modules when the sphinx build starts."
106
+ )
107
+
108
+
109
+ class MockedClassDocumenter(autodoc.ClassDocumenter):
110
+ """Remove note about base class when a class is derived from object."""
111
+
112
+ def add_line(self, line: str, source: str, *lineno: int) -> None:
113
+ if line == " Bases: :py:class:`object`":
114
+ return
115
+ super().add_line(line, source, *lineno)
116
+
117
+
118
+ autodoc.ClassDocumenter = MockedClassDocumenter
119
+
120
+ navigation_with_keys = False
docs/source/deployment/dstack.rst ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ dstack
2
+ ========
3
+
4
+ `dstack <https://github.com/dstackai/dstack>`__ is an open-source alternative to Kubernetes and Slurm, designed to simplify GPU allocation and AI workload orchestration for ML teams across top clouds, on-prem clusters, and accelerators.
5
+
6
+ Prerequisites
7
+ ----------------
8
+ Before you start, install dstack by following the `installation instructions <https://dstack.ai/docs/installation/>`__. Once dstack server is up, you can initialize your workspace
9
+ as shown below:
10
+
11
+ .. code:: bash
12
+
13
+ mkdir dstack-qwen-deploy && cd dstack-qwen-deploy
14
+ dstack init
15
+
16
+ Deploy Qwen3-30B-A3B
17
+ -----------------------------------------------
18
+
19
+ Deploy ``Qwen3-30B-A3B`` on instances available with cloud providers configured in your ``~/.dstack/server/config.yml`` file.
20
+
21
+ You can use ``SgLang``, ``TGI`` or ``vLLM`` to serve the model. Here we use ``SgLang`` as an example.
22
+
23
+ Create a `service <https://dstack.ai/docs/concepts/services/>`__ configuration file named ``serve-30b.dstack.yml`` with the following content:
24
+
25
+ .. code:: yaml
26
+
27
+ type: service
28
+ name: qwen3-30b-a3b
29
+
30
+ image: lmsysorg/sglang:latest
31
+ env:
32
+ - MODEL_ID=Qwen/Qwen3-30B-A3B
33
+
34
+ commands:
35
+ - python3 -m sglang.launch_server
36
+ --model-path $MODEL_ID
37
+ --port 8000
38
+ --trust-remote-code
39
+
40
+ port: 8000
41
+ model: Qwen/Qwen3-30B-A3B
42
+
43
+ resources:
44
+ gpu: 80GB:1
45
+
46
+
47
+
48
+ .. note::
49
+ For other inference backends such as vLLM or TGI, visit the `dstack Inference Examples <https://dstack.ai/examples/#inference>`__ documentation.
50
+
51
+ Go ahead and apply the service configuration:
52
+
53
+ .. code:: bash
54
+
55
+ dstack apply -f serve-30b.dstack.yml
56
+
57
+ Access the Service
58
+ --------------------
59
+
60
+ After the service is successfully deployed, you can access the service's endpoint in the following ways:
61
+
62
+ .. tab-set::
63
+
64
+ .. tab-item:: CURL
65
+
66
+ Access through service endpoint at ``<dstack server URL>/proxy/services/<project name>/<run name>/``
67
+
68
+ .. code:: bash
69
+
70
+ curl http://localhost:3000/proxy/services/main/qwen3-30b-a3b/v1/chat/completions \
71
+ -H 'Content-Type: application/json' \
72
+ -H 'Authorization: Bearer <dstack token>' \
73
+ -d '{
74
+ "model": "Qwen/Qwen3-30B-A3B",
75
+ "messages": [
76
+ {
77
+ "role": "user",
78
+ "content": "Compose a poem that explains the concept of recursion in programming."
79
+ }
80
+ ]
81
+ }'
82
+
83
+ .. note::
84
+ When starting the dstack server, an admin token is automatically generated:
85
+
86
+ .. code:: bash
87
+
88
+ The admin token is "bbae0f28-d3dd-4820-bf61-8f4bb40815da"
89
+ The server is running at http://127.0.0.1:3000/
90
+
91
+ .. tab-item:: Chat UI
92
+
93
+ Access through dstack's Chat UI at ``<dstack server URL>/projects/<project name>/models/<run name>/``
94
+
95
+ .. image:: https://dstack.ai/static-assets/static-assets/images//dstack-qwen-ui.png
96
+
97
+
98
+ .. dropdown:: Gateway
99
+ :icon: info
100
+ :animate: fade-in
101
+
102
+ Running services for development purposes doesn't require setting up a gateway.
103
+
104
+ However, you'll need a gateway in the following cases:
105
+
106
+ * To use auto-scaling or rate limits
107
+ * To enable HTTPS for the endpoint and map it to your domain
108
+ * If your service requires WebSockets
109
+ * If your service cannot work with a path prefix
110
+
111
+ For detailed information about gateway configuration and usage, refer to the `dstack documentation on gateways <https://dstack.ai/docs/concepts/gateways/>`__.
112
+
113
+ Replicas and Auto Scaling
114
+ ----------------------------------------
115
+
116
+ You can auto scale the service by specifying additional configurations in the ``serve-30b.dstack.yml``.
117
+
118
+ - Set ``replicas: min..max`` to define the minimum and maximum number of replicas
119
+ - Configure ``scaling`` rules to determine when to scale up or down
120
+
121
+ Below is a complete configuration example with auto-scaling enabled:
122
+
123
+ .. code:: yaml
124
+
125
+ type: service
126
+ name: qwen3-30b-a3b
127
+
128
+ image: lmsysorg/sglang:latest
129
+ env:
130
+ - MODEL_ID=Qwen/Qwen3-30B-A3B
131
+
132
+ commands:
133
+ - python3 -m sglang.launch_server
134
+ --model-path $MODEL_ID
135
+ --port 8000
136
+ --trust-remote-code
137
+
138
+ port: 8000
139
+ model: Qwen/Qwen3-30B-A3B
140
+
141
+ resources:
142
+ gpu: 80GB:1
143
+
144
+ # Minimum and maximum number of replicas
145
+ replicas: 1..4
146
+ scaling:
147
+ # Requests per seconds
148
+ metric: rps
149
+ # Target metric value
150
+ target: 10
151
+
152
+ .. note::
153
+ The scaling property requires a gateway to be set up.
154
+
155
+ See also
156
+ ------------
157
+ - **Fleets**: Create cloud and on-prem clusters using `Fleets <https://dstack.ai/docs/concepts/fleets/>`__.
158
+ - **Dev Environments**: Experiment and test before deploying to production using `Dev Environments <https://dstack.ai/docs/concepts/dev-environments/>`__.
159
+ - **Tasks**: Schedule single node or distributed training using `Tasks <https://dstack.ai/docs/concepts/tasks/>`__.
160
+ - **Services**: Deploy models as secure, auto-scaling OpenAI-compatible endpoints using `Services <https://dstack.ai/docs/concepts/services/>`__.
161
+ - **Metrics**: Monitor performance with automatically tracked metrics via CLI or UI using `Metrics <https://dstack.ai/docs/guides/metrics/>`__.
docs/source/deployment/openllm.rst ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ OpenLLM
2
+ =======
3
+
4
+ .. attention::
5
+ To be updated for Qwen3.
6
+
7
+ OpenLLM allows developers to run Qwen2.5 models of different sizes as OpenAI-compatible APIs with a single command. It features a built-in chat UI, state-of-the-art inference backends, and a simplified workflow for creating enterprise-grade cloud deployment with Qwen2.5. Visit `the OpenLLM repository <https://github.com/bentoml/OpenLLM/>`_ to learn more.
8
+
9
+ Installation
10
+ ------------
11
+
12
+ Install OpenLLM using ``pip``.
13
+
14
+ .. code:: bash
15
+
16
+ pip install openllm
17
+
18
+ Verify the installation and display the help information:
19
+
20
+ .. code:: bash
21
+
22
+ openllm --help
23
+
24
+ Quickstart
25
+ ----------
26
+
27
+ Before you run any Qwen2.5 model, ensure your model repository is up to date by syncing it with OpenLLM's latest official repository.
28
+
29
+ .. code:: bash
30
+
31
+ openllm repo update
32
+
33
+ List the supported Qwen2.5 models:
34
+
35
+ .. code:: bash
36
+
37
+ openllm model list --tag qwen2.5
38
+
39
+ The results also display the required GPU resources and supported platforms:
40
+
41
+ .. code:: bash
42
+
43
+ model version repo required GPU RAM platforms
44
+ ------- --------------------- ------- ------------------ -----------
45
+ qwen2.5 qwen2.5:0.5b default 12G linux
46
+ qwen2.5:1.5b default 12G linux
47
+ qwen2.5:3b default 12G linux
48
+ qwen2.5:7b default 24G linux
49
+ qwen2.5:14b default 80G linux
50
+ qwen2.5:14b-ggml-q4 default macos
51
+ qwen2.5:14b-ggml-q8 default macos
52
+ qwen2.5:32b default 80G linux
53
+ qwen2.5:32b-ggml-fp16 default macos
54
+ qwen2.5:72b default 80Gx2 linux
55
+ qwen2.5:72b-ggml-q4 default macos
56
+
57
+ To start a server with one of the models, use ``openllm serve`` like this:
58
+
59
+ .. code:: bash
60
+
61
+ openllm serve qwen2.5:7b
62
+
63
+ By default, the server starts at ``http://localhost:3000/``.
64
+
65
+ Interact with the model server
66
+ ------------------------------
67
+
68
+ With the model server up and running, you can call its APIs in the following ways:
69
+
70
+ .. tab-set::
71
+
72
+ .. tab-item:: CURL
73
+
74
+ Send an HTTP request to its ``/generate`` endpoint via CURL:
75
+
76
+ .. code-block:: bash
77
+
78
+ curl -X 'POST' \
79
+ 'http://localhost:3000/api/generate' \
80
+ -H 'accept: text/event-stream' \
81
+ -H 'Content-Type: application/json' \
82
+ -d '{
83
+ "prompt": "Tell me something about large language models.",
84
+ "model": "Qwen/Qwen2.5-7B-Instruct",
85
+ "max_tokens": 2048,
86
+ "stop": null
87
+ }'
88
+
89
+ .. tab-item:: Python client
90
+
91
+ Call the OpenAI-compatible endpoints with frameworks and tools that support the OpenAI API protocol. Here is an example:
92
+
93
+ .. code-block:: python
94
+
95
+ from openai import OpenAI
96
+
97
+ client = OpenAI(base_url='http://localhost:3000/v1', api_key='na')
98
+
99
+ # Use the following func to get the available models
100
+ # model_list = client.models.list()
101
+ # print(model_list)
102
+
103
+ chat_completion = client.chat.completions.create(
104
+ model="Qwen/Qwen2.5-7B-Instruct",
105
+ messages=[
106
+ {
107
+ "role": "user",
108
+ "content": "Tell me something about large language models."
109
+ }
110
+ ],
111
+ stream=True,
112
+ )
113
+ for chunk in chat_completion:
114
+ print(chunk.choices[0].delta.content or "", end="")
115
+
116
+ .. tab-item:: Chat UI
117
+
118
+ OpenLLM provides a chat UI at the ``/chat`` endpoint for the LLM server at http://localhost:3000/chat.
119
+
120
+ .. image:: ../../source/assets/qwen-openllm-ui-demo.png
121
+
122
+ Model repository
123
+ ----------------
124
+
125
+ A model repository in OpenLLM represents a catalog of available LLMs. You can add your own repository to OpenLLM with custom Qwen2.5 variants for your specific needs. See our `documentation to learn details <https://github.com/bentoml/OpenLLM?tab=readme-ov-file#model-repository>`_.
docs/source/deployment/sglang.md ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SGLang
2
+
3
+ [SGLang](https://github.com/sgl-project/sglang) is a fast serving framework for large language models and vision language models.
4
+
5
+ To learn more about SGLang, please refer to the [documentation](https://docs.sglang.ai/).
6
+
7
+ ## Environment Setup
8
+
9
+ By default, you can install `sglang` with pip in a clean environment:
10
+
11
+ ```shell
12
+ pip install "sglang[all]>=0.4.6.post1"
13
+ ```
14
+
15
+ If you have encountered issues in installation, please feel free to check the official document for installation ([link](https://docs.sglang.ai/start/install.html)).
16
+
17
+ ## API Service
18
+
19
+ It is easy to build an OpenAI-compatible API service with SGLang, which can be deployed as a server that implements OpenAI API protocol.
20
+ By default, it starts the server at `http://localhost:30000`.
21
+ You can specify the address with `--host` and `--port` arguments.
22
+ Run the command as shown below:
23
+ ```shell
24
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B
25
+ ```
26
+
27
+ By default, if the `--model-path` does not point to a valid local directory, it will download the model files from the Hugging Face Hub.
28
+ To download model from ModelScope, set the following before running the above command:
29
+ ```shell
30
+ export SGLANG_USE_MODELSCOPE=true
31
+ ```
32
+
33
+ For distributed inference with tensor parallelism, it is as simple as
34
+ ```shell
35
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B --tensor-parallel-size 4
36
+ ```
37
+ The above command will use tensor parallelism on 4 GPUs.
38
+ You should change the number of GPUs according to your demand.
39
+
40
+ ### Basic Usage
41
+
42
+ Then, you can use the [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) to communicate with Qwen:
43
+
44
+ ::::{tab-set}
45
+
46
+ :::{tab-item} curl
47
+ ```shell
48
+ curl http://localhost:30000/v1/chat/completions -H "Content-Type: application/json" -d '{
49
+ "model": "Qwen/Qwen3-8B",
50
+ "messages": [
51
+ {"role": "user", "content": "Give me a short introduction to large language models."}
52
+ ],
53
+ "temperature": 0.6,
54
+ "top_p": 0.95,
55
+ "top_k": 20,
56
+ "max_tokens": 32768
57
+ }'
58
+ ```
59
+ :::
60
+
61
+ :::{tab-item} Python
62
+ You can use the API client with the `openai` Python SDK as shown below:
63
+
64
+ ```python
65
+ from openai import OpenAI
66
+ # Set OpenAI's API key and API base to use SGLang's API server.
67
+ openai_api_key = "EMPTY"
68
+ openai_api_base = "http://localhost:30000/v1"
69
+
70
+ client = OpenAI(
71
+ api_key=openai_api_key,
72
+ base_url=openai_api_base,
73
+ )
74
+
75
+ chat_response = client.chat.completions.create(
76
+ model="Qwen/Qwen3-8B",
77
+ messages=[
78
+ {"role": "user", "content": "Give me a short introduction to large language models."},
79
+ ],
80
+ max_tokens=32768,
81
+ temperature=0.6,
82
+ top_p=0.95,
83
+ extra_body={
84
+ "top_k": 20,
85
+ },
86
+ )
87
+ print("Chat response:", chat_response)
88
+ ```
89
+ ::::
90
+
91
+ :::{tip}
92
+ While the default sampling parameters would work most of the time for thinking mode,
93
+ it is recommended to adjust the sampling parameters according to your application,
94
+ and always pass the sampling parameters to the API.
95
+ :::
96
+
97
+
98
+ ### Thinking & Non-Thinking Modes
99
+
100
+ Qwen3 models will think before respond.
101
+ This behavior could be controlled by either the hard switch, which could disable thinking completely, or the soft switch, where the model follows the instruction of the user on whether it should think.
102
+
103
+ The hard switch is available in SGLang through the following configuration to the API call.
104
+ To disable thinking, use
105
+
106
+ ::::{tab-set}
107
+
108
+ :::{tab-item} curl
109
+ ```shell
110
+ curl http://localhost:30000/v1/chat/completions -H "Content-Type: application/json" -d '{
111
+ "model": "Qwen/Qwen3-8B",
112
+ "messages": [
113
+ {"role": "user", "content": "Give me a short introduction to large language models."}
114
+ ],
115
+ "temperature": 0.7,
116
+ "top_p": 0.8,
117
+ "top_k": 20,
118
+ "max_tokens": 8192,
119
+ "presence_penalty": 1.5,
120
+ "chat_template_kwargs": {"enable_thinking": false}
121
+ }'
122
+ ```
123
+ :::
124
+
125
+ :::{tab-item} Python
126
+ You can use the API client with the `openai` Python SDK as shown below:
127
+
128
+ ```python
129
+ from openai import OpenAI
130
+ # Set OpenAI's API key and API base to use SGLang's API server.
131
+ openai_api_key = "EMPTY"
132
+ openai_api_base = "http://localhost:30000/v1"
133
+
134
+ client = OpenAI(
135
+ api_key=openai_api_key,
136
+ base_url=openai_api_base,
137
+ )
138
+
139
+ chat_response = client.chat.completions.create(
140
+ model="Qwen/Qwen3-8B",
141
+ messages=[
142
+ {"role": "user", "content": "Give me a short introduction to large language models."},
143
+ ],
144
+ max_tokens=8192,
145
+ temperature=0.7,
146
+ top_p=0.8,
147
+ presence_penalty=1.5,
148
+ extra_body={
149
+ "top_k": 20,
150
+ "chat_template_kwargs": {"enable_thinking": True},
151
+ },
152
+ )
153
+ print("Chat response:", chat_response)
154
+ ```
155
+ ::::
156
+
157
+ :::{note}
158
+ Please note that passing `enable_thinking` is not OpenAI API compatible.
159
+ The exact method may differ among frameworks.
160
+ :::
161
+
162
+ :::{tip}
163
+ To completely disable thinking, you could use [a custom chat template](../../source/assets/qwen3_nonthinking.jinja) when starting the model:
164
+
165
+ ```shell
166
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B --chat-template ./qwen3_nonthinking.jinja
167
+ ```
168
+
169
+ The chat template prevents the model from generating thinking content, even if the user instructs the model to do so with `/think`.
170
+ :::
171
+
172
+
173
+ :::{tip}
174
+ It is recommended to set sampling parameters differently for thinking and non-thinking modes.
175
+ :::
176
+
177
+ ### Parsing Thinking Content
178
+
179
+ SGLang supports parsing the thinking content from the model generation into structured messages:
180
+ ```shell
181
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B --reasoning-parser qwen3
182
+ ```
183
+
184
+ The response message will have a field named `reasoning_content` in addition to `content`, containing the thinking content generated by the model.
185
+
186
+ :::{note}
187
+ Please note that this feature is not OpenAI API compatible.
188
+ :::
189
+
190
+ :::{important}
191
+ `enable_thinking=False` may not be compatible with this feature.
192
+ If you need to pass `enable_thinking=False` to the API, please consider disabling parsing thinking content.
193
+ :::
194
+
195
+ ### Parsing Tool Calls
196
+
197
+ SGLang supports parsing the tool calling content from the model generation into structured messages:
198
+ ```shell
199
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B --tool-call-parser qwen25
200
+ ```
201
+
202
+ For more information, please refer to [our guide on Function Calling](../framework/function_call.md).
203
+
204
+ ### Structured/JSON Output
205
+
206
+ SGLang supports structured/JSON output.
207
+ Please refer to [SGLang's documentation](https://docs.sglang.ai/backend/structured_outputs.html#OpenAI-Compatible-API).
208
+ Besides, it is also recommended to instruct the model to generate the specific format in the system message or in your prompt.
209
+
210
+ ### Serving Quantized models
211
+
212
+ Qwen3 comes with two types of pre-quantized models, FP8 and AWQ.
213
+
214
+ The command serving those models are the same as the original models except for the name change:
215
+ ```shell
216
+ # For FP8 quantized model
217
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B-FP8
218
+
219
+ # For AWQ quantized model
220
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B-AWQ
221
+ ```
222
+
223
+ ### Context Length
224
+
225
+ The context length for Qwen3 models in pretraining is up to 32,768 tokens.
226
+ To handle context length substantially exceeding 32,768 tokens, RoPE scaling techniques should be applied.
227
+ We have validated the performance of [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
228
+
229
+ SGLang supports YaRN, which can be configured as
230
+ ```shell
231
+ python -m sglang.launch_server --model-path Qwen/Qwen3-8B --json-model-override-args '{"rope_scaling":{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}}' --context-length 131072
232
+ ```
233
+
234
+ :::{note}
235
+ SGLang implements static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.**
236
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
237
+ It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0.
238
+ :::
239
+
240
+ :::{note}
241
+ The default `max_position_embeddings` in `config.json` is set to 40,960, which is used by SGLang.
242
+ This allocation includes reserving 32,768 tokens for outputs and 8,192 tokens for typical prompts, which is sufficient for most scenarios involving short text processing and leave adequate room for model thinking.
243
+ If the average context length does not exceed 32,768 tokens, we do not recommend enabling YaRN in this scenario, as it may potentially degrade model performance.
244
+ :::
docs/source/deployment/skypilot.rst ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SkyPilot
2
+ ========
3
+
4
+ .. attention::
5
+ To be updated for Qwen3.
6
+
7
+ What is SkyPilot
8
+ ----------------
9
+
10
+ SkyPilot is a framework for running LLMs, AI, and batch jobs on any
11
+ cloud, offering maximum cost savings, the highest GPU availability, and
12
+ managed execution. Its features include:
13
+
14
+ - Get the best GPU availability by utilizing multiple resources pools
15
+ across multiple regions and clouds.
16
+ - Pay absolute minimum — SkyPilot picks the cheapest resources across
17
+ regions and clouds. No managed solution markups.
18
+ - Scale up to multiple replicas across different locations and
19
+ accelerators, all served with a single endpoint
20
+ - Everything stays in your cloud account (your VMs & buckets)
21
+ - Completely private - no one else sees your chat history
22
+
23
+ Install SkyPilot
24
+ ----------------
25
+
26
+ We advise you to follow the
27
+ `instruction <https://skypilot.readthedocs.io/en/latest/getting-started/installation.html>`__
28
+ to install SkyPilot. Here we provide a simple example of using ``pip``
29
+ for the installation as shown below.
30
+
31
+ .. code:: bash
32
+
33
+ # You can use any of the following clouds that you have access to:
34
+ # aws, gcp, azure, oci, lamabda, runpod, fluidstack, paperspace,
35
+ # cudo, ibm, scp, vsphere, kubernetes
36
+ pip install "skypilot-nightly[aws,gcp]"
37
+
38
+ After that, you need to verify cloud access with a command like:
39
+
40
+ .. code:: bash
41
+
42
+ sky check
43
+
44
+ For more information, check the `official document <https://skypilot.readthedocs.io/en/latest/getting-started/installation.html>`__ and see if you have
45
+ set up your cloud accounts correctly.
46
+
47
+ Alternatively, you can also use the official docker image with SkyPilot
48
+ master branch automatically cloned by running:
49
+
50
+ .. code:: bash
51
+
52
+ # NOTE: '--platform linux/amd64' is needed for Apple Silicon Macs
53
+ docker run --platform linux/amd64 \
54
+ -td --rm --name sky \
55
+ -v "$HOME/.sky:/root/.sky:rw" \
56
+ -v "$HOME/.aws:/root/.aws:rw" \
57
+ -v "$HOME/.config/gcloud:/root/.config/gcloud:rw" \
58
+ berkeleyskypilot/skypilot-nightly
59
+
60
+ docker exec -it sky /bin/bash
61
+
62
+ Running Qwen2.5-72B-Instruct with SkyPilot
63
+ ------------------------------------------
64
+
65
+ 1. Start serving Qwen2.5-72B-Instruct on a single instance with any
66
+ available GPU in the list specified in
67
+ `serve-72b.yaml <https://github.com/skypilot-org/skypilot/blob/master/llm/qwen/serve-72b.yaml>`__
68
+ with a vLLM-powered OpenAI-compatible endpoint:
69
+
70
+ .. code:: bash
71
+
72
+ sky launch -c qwen serve-72b.yaml
73
+
74
+ **Before launching, make sure you have changed Qwen/Qwen2-72B-Instruct to Qwen/Qwen2.5-72B-Instruct in the YAML file.**
75
+
76
+ 2. Send a request to the endpoint for completion:
77
+
78
+ .. code:: bash
79
+
80
+ IP=$(sky status --ip qwen)
81
+
82
+ curl -L http://$IP:8000/v1/completions \
83
+ -H "Content-Type: application/json" \
84
+ -d '{
85
+ "model": "Qwen/Qwen2.5-72B-Instruct",
86
+ "prompt": "My favorite food is",
87
+ "max_tokens": 512
88
+ }' | jq -r '.choices[0].text'
89
+
90
+ 3. Send a request for chat completion:
91
+
92
+ .. code:: bash
93
+
94
+ curl -L http://$IP:8000/v1/chat/completions \
95
+ -H "Content-Type: application/json" \
96
+ -d '{
97
+ "model": "Qwen/Qwen2.5-72B-Instruct",
98
+ "messages": [
99
+ {
100
+ "role": "system",
101
+ "content": "You are Qwen, created by Alibaba Cloud. You are a helpful and honest chat expert."
102
+ },
103
+ {
104
+ "role": "user",
105
+ "content": "What is the best food?"
106
+ }
107
+ ],
108
+ "max_tokens": 512
109
+ }' | jq -r '.choices[0].message.content'
110
+
111
+ Scale up the service with SkyPilot Serve
112
+ ----------------------------------------
113
+
114
+ 1. With `SkyPilot
115
+ Serve <https://skypilot.readthedocs.io/en/latest/serving/sky-serve.html>`__,
116
+ a serving library built on top of SkyPilot, scaling up the Qwen
117
+ service is as simple as running:
118
+
119
+ .. code:: bash
120
+
121
+ sky serve up -n qwen ./serve-72b.yaml
122
+
123
+ **Before launching, make sure you have changed Qwen/Qwen2-72B-Instruct to Qwen/Qwen2.5-72B-Instruct in the YAML file.**
124
+
125
+ This will start the service with multiple replicas on the cheapest
126
+ available locations and accelerators. SkyServe will automatically manage
127
+ the replicas, monitor their health, autoscale based on load, and restart
128
+ them when needed.
129
+
130
+ A single endpoint will be returned and any request sent to the endpoint
131
+ will be routed to the ready replicas.
132
+
133
+ 2. To check the status of the service, run:
134
+
135
+ .. code:: bash
136
+
137
+ sky serve status qwen
138
+
139
+ After a while, you will see the following output:
140
+
141
+ ::
142
+
143
+ Services
144
+ NAME VERSION UPTIME STATUS REPLICAS ENDPOINT
145
+ Qwen 1 - READY 2/2 3.85.107.228:30002
146
+
147
+ Service Replicas
148
+ SERVICE_NAME ID VERSION IP LAUNCHED RESOURCES STATUS REGION
149
+ Qwen 1 1 - 2 mins ago 1x Azure({'A100-80GB': 8}) READY eastus
150
+ Qwen 2 1 - 2 mins ago 1x GCP({'L4': 8}) READY us-east4-a
151
+
152
+ As shown, the service is now backed by 2 replicas, one on Azure and one
153
+ on GCP, and the accelerator type is chosen to be **the cheapest
154
+ available one** on the clouds. That said, it maximizes the availability
155
+ of the service while minimizing the cost.
156
+
157
+ 3. To access the model, we use a ``curl -L`` command (``-L`` to follow
158
+ redirect) to send the request to the endpoint:
159
+
160
+ .. code:: bash
161
+
162
+ ENDPOINT=$(sky serve status --endpoint qwen)
163
+
164
+ curl -L http://$ENDPOINT/v1/chat/completions \
165
+ -H "Content-Type: application/json" \
166
+ -d '{
167
+ "model": "Qwen/Qwen2.5-72B-Instruct",
168
+ "messages": [
169
+ {
170
+ "role": "system",
171
+ "content": "You are Qwen, created by Alibaba Cloud. You are a helpful and honest code assistant expert in Python."
172
+ },
173
+ {
174
+ "role": "user",
175
+ "content": "Show me the python code for quick sorting a list of integers."
176
+ }
177
+ ],
178
+ "max_tokens": 512
179
+ }' | jq -r '.choices[0].message.content'
180
+
181
+ Accessing Qwen2.5 with Chat GUI
182
+ ---------------------------------------------
183
+
184
+ It is also possible to access the Qwen2.5 service with GUI by connecting a
185
+ `FastChat GUI server <https://github.com/lm-sys/FastChat>`__ to the endpoint launched
186
+ above (see `gui.yaml <https://github.com/skypilot-org/skypilot/blob/master/llm/qwen/gui.yaml>`__).
187
+
188
+ 1. Start the Chat Web UI:
189
+
190
+ .. code:: bash
191
+
192
+ sky launch -c qwen-gui ./gui.yaml --env ENDPOINT=$(sky serve status --endpoint qwen)
193
+
194
+ **Before launching, make sure you have changed Qwen/Qwen1.5-72B-Chat to Qwen/Qwen2.5-72B-Instruct in the YAML file.**
195
+
196
+ 2. Then, we can access the GUI at the returned gradio link:
197
+
198
+ ::
199
+
200
+ | INFO | stdout | Running on public URL: https://6141e84201ce0bb4ed.gradio.live
201
+
202
+ Note that you may get better results by using a different temperature and top_p value.
203
+
204
+ Summary
205
+ -------
206
+
207
+ With SkyPilot, it is easy for you to deploy Qwen2.5 on any cloud. We
208
+ advise you to read the official doc for more usages and updates.
209
+ Check `this <https://skypilot.readthedocs.io/>`__ out!
docs/source/deployment/tgi.rst ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ TGI
2
+ =====================
3
+
4
+ .. attention::
5
+ To be updated for Qwen3.
6
+
7
+ Hugging Face's Text Generation Inference (TGI) is a production-ready framework specifically designed for deploying and serving large language models (LLMs) for text generation tasks. It offers a seamless deployment experience, powered by a robust set of features:
8
+
9
+ * `Speculative Decoding <Speculative Decoding_>`_: Accelerates generation speeds.
10
+ * `Tensor Parallelism`_: Enables efficient deployment across multiple GPUs.
11
+ * `Token Streaming`_: Allows for the continuous generation of text.
12
+ * Versatile Device Support: Works seamlessly with `AMD`_, `Gaudi`_ and `AWS Inferentia`_.
13
+
14
+ .. _AMD: https://rocm.docs.amd.com/en/latest/how-to/rocm-for-ai/deploy-your-model.html#serving-using-hugging-face-tgi
15
+ .. _Gaudi: https://github.com/huggingface/tgi-gaudi
16
+ .. _AWS Inferentia: https://aws.amazon.com/blogs/machine-learning/announcing-the-launch-of-new-hugging-face-llm-inference-containers-on-amazon-sagemaker/#:~:text=Get%20started%20with%20TGI%20on%20SageMaker%20Hosting
17
+ .. _Tensor Parallelism: https://huggingface.co/docs/text-generation-inference/conceptual/tensor_parallelism
18
+ .. _Token Streaming: https://huggingface.co/docs/text-generation-inference/conceptual/streaming
19
+
20
+ Installation
21
+ -----------------
22
+
23
+ The easiest way to use TGI is via the TGI docker image. In this guide, we show how to use TGI with docker.
24
+
25
+ It's possible to run it locally via Conda or build locally. Please refer to `Installation Guide <https://huggingface.co/docs/text-generation-inference/installation>`_ and `CLI tool <https://huggingface.co/docs/text-generation-inference/en/basic_tutorials/using_cli>`_ for detailed instructions.
26
+
27
+ Deploy Qwen2.5 with TGI
28
+ -----------------------
29
+
30
+ 1. **Find a Qwen2.5 Model:** Choose a model from `the Qwen2.5 collection <https://huggingface.co/collections/Qwen/qwen25-66e81a666513e518adb90d9e>`_.
31
+ 2. **Deployment Command:** Run the following command in your terminal, replacing ``model`` with your chosen Qwen2.5 model ID and ``volume`` with the path to your local data directory:
32
+
33
+ .. code:: bash
34
+
35
+ model=Qwen/Qwen2.5-7B-Instruct
36
+ volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
37
+
38
+ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model
39
+
40
+
41
+ Using TGI API
42
+ -------------
43
+
44
+ Once deployed, the model will be available on the mapped port (8080).
45
+
46
+ TGI comes with a handy API for streaming response:
47
+
48
+ .. code:: bash
49
+
50
+ curl http://localhost:8080/generate_stream -H 'Content-Type: application/json' \
51
+ -d '{"inputs":"Tell me something about large language models.","parameters":{"max_new_tokens":512}}'
52
+
53
+
54
+ It's also available on OpenAI style API:
55
+
56
+ .. code:: bash
57
+
58
+ curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
59
+ "model": "",
60
+ "messages": [
61
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
62
+ {"role": "user", "content": "Tell me something about large language models."}
63
+ ],
64
+ "temperature": 0.7,
65
+ "top_p": 0.8,
66
+ "repetition_penalty": 1.05,
67
+ "max_tokens": 512
68
+ }'
69
+
70
+
71
+ .. note::
72
+
73
+ The model field in the JSON is not used by TGI, you can put anything.
74
+
75
+ Refer to the `TGI Swagger UI <https://huggingface.github.io/text-generation-inference/#/Text%20Generation%20Inference/completions>`_ for a complete API reference.
76
+
77
+ You can also use Python API:
78
+
79
+ .. code:: python
80
+
81
+ from openai import OpenAI
82
+
83
+ # initialize the client but point it to TGI
84
+ client = OpenAI(
85
+ base_url="http://localhost:8080/v1/", # replace with your endpoint url
86
+ api_key="", # this field is not used when running locally
87
+ )
88
+ chat_completion = client.chat.completions.create(
89
+ model="", # it is not used by TGI, you can put anything
90
+ messages=[
91
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
92
+ {"role": "user", "content": "Tell me something about large language models."},
93
+ ],
94
+ stream=True,
95
+ temperature=0.7,
96
+ top_p=0.8,
97
+ max_tokens=512,
98
+ )
99
+
100
+ # iterate and print stream
101
+ for message in chat_completion:
102
+ print(message.choices[0].delta.content, end="")
103
+
104
+
105
+ Quantization for Performance
106
+ ----------------------------
107
+
108
+ 1. Data-dependent quantization (GPTQ and AWQ)
109
+
110
+ Both GPTQ and AWQ models are data-dependent. The official quantized models can be found from `the Qwen2.5 collection`_ and you can also quantize models with your own dataset to make it perform better on your use case.
111
+
112
+ The following shows the command to start TGI with Qwen2.5-7B-Instruct-GPTQ-Int4:
113
+
114
+ .. code:: bash
115
+
116
+ model=Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4
117
+ volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
118
+
119
+ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model --quantize gptq
120
+
121
+
122
+ If the model is quantized with AWQ, e.g. Qwen/Qwen2.5-7B-Instruct-AWQ, please use ``--quantize awq``.
123
+
124
+ 2. Data-agnostic quantization
125
+
126
+ EETQ on the other side is not data dependent and can be used with any model. Note that we're passing in the original model (instead of a quantized model) with the ``--quantize eetq`` flag.
127
+
128
+ .. code:: bash
129
+
130
+ model=Qwen/Qwen2.5-7B-Instruct
131
+ volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
132
+
133
+ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model --quantize eetq
134
+
135
+
136
+
137
+ Multi-Accelerators Deployment
138
+ -----------------------------
139
+
140
+ Use the ``--num-shard`` flag to specify the number of accelerators. Please also use ``--shm-size 1g`` to enable shared memory for optimal NCCL performance (`reference <https://github.com/huggingface/text-generation-inference?tab=readme-ov-file#a-note-on-shared-memory-shm>`__):
141
+
142
+ .. code:: bash
143
+
144
+ model=Qwen/Qwen2.5-7B-Instruct
145
+ volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
146
+
147
+ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model --num-shard 2
148
+
149
+
150
+ Speculative Decoding
151
+ --------------------
152
+
153
+ Speculative decoding can reduce the time per token by speculating on the next token. Use the ``--speculative-decoding`` flag, setting the value to the number of tokens to speculate on (default: 0 for no speculation):
154
+
155
+
156
+ .. code:: bash
157
+
158
+ model=Qwen/Qwen2.5-7B-Instruct
159
+ volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
160
+
161
+ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model --speculate 2
162
+
163
+
164
+ The overall performance of speculative decoding highly depends on the type of task. It works best for code or highly repetitive text.
165
+
166
+ More context on speculative decoding can be found `here <https://huggingface.co/docs/text-generation-inference/conceptual/speculation>`__.
167
+
168
+
169
+ Zero-Code Deployment with HF Inference Endpoints
170
+ ---------------------------------------------------
171
+
172
+ For effortless deployment, leverage Hugging Face Inference Endpoints:
173
+
174
+ - **GUI interface:** `<https://huggingface.co/inference-endpoints/dedicated>`__
175
+ - **Coding interface:** `<https://huggingface.co/blog/tgi-messages-api>`__
176
+
177
+ Once deployed, the endpoint can be used as usual.
178
+
179
+
180
+ Common Issues
181
+ ----------------
182
+
183
+ Qwen2.5 supports long context lengths, so carefully choose the values for ``--max-batch-prefill-tokens``, ``--max-total-tokens``, and ``--max-input-tokens`` to avoid potential out-of-memory (OOM) issues. If an OOM occurs, you'll receive an error message upon startup. The following shows an example to modify those parameters:
184
+
185
+ .. code:: bash
186
+
187
+ model=Qwen/Qwen2.5-7B-Instruct
188
+ volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
189
+
190
+ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model --max-batch-prefill-tokens 4096 --max-total-tokens 4096 --max-input-tokens 2048
docs/source/deployment/vllm.md ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # vLLM
2
+
3
+ We recommend you trying [vLLM](https://github.com/vllm-project/vllm) for your deployment of Qwen.
4
+ It is simple to use, and it is fast with state-of-the-art serving throughput, efficient management of attention key value memory with PagedAttention, continuous batching of input requests, optimized CUDA kernels, etc.
5
+ To learn more about vLLM, please refer to the [paper](https://arxiv.org/abs/2309.06180) and [documentation](https://docs.vllm.ai/).
6
+
7
+ ## Environment Setup
8
+
9
+ By default, you can install `vllm` with pip in a clean environment:
10
+
11
+ ```shell
12
+ pip install "vllm>=0.8.5"
13
+ ```
14
+
15
+ Please note that the prebuilt `vllm` has strict dependencies on `torch` and its CUDA versions.
16
+ Check the note in the official document for installation ([link](https://docs.vllm.ai/en/latest/getting_started/installation.html)) for more help.
17
+
18
+ ## API Service
19
+
20
+ It is easy to build an OpenAI-compatible API service with vLLM, which can be deployed as a server that implements OpenAI API protocol.
21
+ By default, it starts the server at `http://localhost:8000`.
22
+ You can specify the address with `--host` and `--port` arguments.
23
+ Run the command as shown below:
24
+ ```shell
25
+ vllm serve Qwen/Qwen3-8B
26
+ ```
27
+
28
+ By default, if the model does not point to a valid local directory, it will download the model files from the Hugging Face Hub.
29
+ To download model from ModelScope, set the following before running the above command:
30
+ ```shell
31
+ export VLLM_USE_MODELSCOPE=true
32
+ ```
33
+
34
+ For distributed inference with tensor parallelism, it is as simple as
35
+ ```shell
36
+ vllm serve Qwen/Qwen3-8B --tensor-parallel-size 4
37
+ ```
38
+ The above command will use tensor parallelism on 4 GPUs.
39
+ You should change the number of GPUs according to your demand.
40
+
41
+ ### Basic Usage
42
+
43
+ Then, you can use the [create chat interface](https://platform.openai.com/docs/api-reference/chat/completions/create) to communicate with Qwen:
44
+
45
+ ::::{tab-set}
46
+
47
+ :::{tab-item} curl
48
+ ```shell
49
+ curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
50
+ "model": "Qwen/Qwen3-8B",
51
+ "messages": [
52
+ {"role": "user", "content": "Give me a short introduction to large language models."}
53
+ ],
54
+ "temperature": 0.6,
55
+ "top_p": 0.95,
56
+ "top_k": 20,
57
+ "max_tokens": 32768
58
+ }'
59
+ ```
60
+ :::
61
+
62
+ :::{tab-item} Python
63
+ You can use the API client with the `openai` Python SDK as shown below:
64
+
65
+ ```python
66
+ from openai import OpenAI
67
+ # Set OpenAI's API key and API base to use vLLM's API server.
68
+ openai_api_key = "EMPTY"
69
+ openai_api_base = "http://localhost:8000/v1"
70
+
71
+ client = OpenAI(
72
+ api_key=openai_api_key,
73
+ base_url=openai_api_base,
74
+ )
75
+
76
+ chat_response = client.chat.completions.create(
77
+ model="Qwen/Qwen3-8B",
78
+ messages=[
79
+ {"role": "user", "content": "Give me a short introduction to large language models."},
80
+ ],
81
+ max_tokens=32768,
82
+ temperature=0.6,
83
+ top_p=0.95,
84
+ extra_body={
85
+ "top_k": 20,
86
+ },
87
+ )
88
+ print("Chat response:", chat_response)
89
+ ```
90
+ ::::
91
+
92
+ :::{tip}
93
+ `vllm` will use the sampling parameters from the `generation_config.json` in the model files.
94
+
95
+ While the default sampling parameters would work most of the time for thinking mode,
96
+ it is recommended to adjust the sampling parameters according to your application,
97
+ and always pass the sampling parameters to the API.
98
+ :::
99
+
100
+
101
+ ### Thinking & Non-Thinking Modes
102
+
103
+ Qwen3 models will think before respond.
104
+ This behavior could be controlled by either the hard switch, which could disable thinking completely, or the soft switch, where the model follows the instruction of the user on whether it should think.
105
+
106
+ The hard switch is available in vLLM through the following configuration to the API call.
107
+ To disable thinking, use
108
+
109
+ ::::{tab-set}
110
+
111
+ :::{tab-item} curl
112
+ ```shell
113
+ curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
114
+ "model": "Qwen/Qwen3-8B",
115
+ "messages": [
116
+ {"role": "user", "content": "Give me a short introduction to large language models."}
117
+ ],
118
+ "temperature": 0.7,
119
+ "top_p": 0.8,
120
+ "top_k": 20,
121
+ "max_tokens": 8192,
122
+ "presence_penalty": 1.5,
123
+ "chat_template_kwargs": {"enable_thinking": false}
124
+ }'
125
+ ```
126
+ :::
127
+
128
+ :::{tab-item} Python
129
+ You can use the API client with the `openai` Python SDK as shown below:
130
+
131
+ ```python
132
+ from openai import OpenAI
133
+ # Set OpenAI's API key and API base to use vLLM's API server.
134
+ openai_api_key = "EMPTY"
135
+ openai_api_base = "http://localhost:8000/v1"
136
+
137
+ client = OpenAI(
138
+ api_key=openai_api_key,
139
+ base_url=openai_api_base,
140
+ )
141
+
142
+ chat_response = client.chat.completions.create(
143
+ model="Qwen/Qwen3-8B",
144
+ messages=[
145
+ {"role": "user", "content": "Give me a short introduction to large language models."},
146
+ ],
147
+ max_tokens=8192,
148
+ temperature=0.7,
149
+ top_p=0.8,
150
+ presence_penalty=1.5,
151
+ extra_body={
152
+ "top_k": 20,
153
+ "chat_template_kwargs": {"enable_thinking": False},
154
+ },
155
+ )
156
+ print("Chat response:", chat_response)
157
+ ```
158
+ ::::
159
+
160
+
161
+ :::{note}
162
+ Please note that passing `enable_thinking` is not OpenAI API compatible.
163
+ The exact method may differ among frameworks.
164
+ :::
165
+
166
+ :::{tip}
167
+ To completely disable thinking, you could use [a custom chat template](../../source/assets/qwen3_nonthinking.jinja) when starting the model:
168
+
169
+ ```shell
170
+ vllm serve Qwen/Qwen3-8B --chat-template ./qwen3_nonthinking.jinja
171
+ ```
172
+
173
+ The chat template prevents the model from generating thinking content, even if the user instructs the model to do so with `/think`.
174
+ :::
175
+
176
+
177
+ :::{tip}
178
+ It is recommended to set sampling parameters differently for thinking and non-thinking modes.
179
+ :::
180
+
181
+
182
+ ### Parsing Thinking Content
183
+
184
+ vLLM supports parsing the thinking content from the model generation into structured messages:
185
+ ```shell
186
+ vllm serve Qwen/Qwen3-8B --enable-reasoning --reasoning-parser deepseek_r1
187
+ ```
188
+
189
+ Since vLLM 0.9.0, one can also use
190
+ ```shell
191
+ vllm serve Qwen/Qwen3-8B --reasoning-parser qwen3
192
+ ```
193
+
194
+ The response message will have a field named `reasoning_content` in addition to `content`, containing the thinking content generated by the model.
195
+
196
+ :::{note}
197
+ Please note that this feature is not OpenAI API compatible.
198
+ :::
199
+
200
+ :::{important}
201
+ As of vLLM 0.8.5, `enable_thinking=False` is not compatible with this feature.
202
+ If you need to pass `enable_thinking=False` to the API, you should disable parsing thinking content.
203
+ This is resolved in vLLM 0.9.0 with the `qwen3` reasoning parser.
204
+ :::
205
+
206
+ ### Parsing Tool Calls
207
+
208
+ vLLM supports parsing the tool calling content from the model generation into structured messages:
209
+ ```shell
210
+ vllm serve Qwen/Qwen3-8B --enable-auto-tool-choice --tool-call-parser hermes
211
+ ```
212
+
213
+ For more information, please refer to [our guide on Function Calling](../framework/function_call.md#vllm).
214
+
215
+ ### Structured/JSON Output
216
+
217
+ vLLM supports structured/JSON output.
218
+ Please refer to [vLLM's documentation](https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#extra-parameters-for-chat-api) for the `guided_json` parameters.
219
+ Besides, it is also recommended to instruct the model to generate the specific format in the system message or in your prompt.
220
+
221
+
222
+ ### Serving Quantized models
223
+
224
+ Qwen3 comes with two types of pre-quantized models, FP8 and AWQ.
225
+
226
+ The command serving those models are the same as the original models except for the name change:
227
+ ```shell
228
+ # For FP8 quantized model
229
+ vllm serve Qwen/Qwen3-8B-FP8
230
+
231
+ # For AWQ quantized model
232
+ vllm serve Qwen/Qwen3-8B-AWQ
233
+ ```
234
+
235
+ :::{note}
236
+ The FP8 models of Qwen3 are block-wise quant, which is supported on NVIDIA GPUs with compute capability > 8.9, that is, Ada Lovelace, Hopper, and later GPUs and runs as w8a8.
237
+
238
+ Since vLLM v0.9.0, FP8 Marlin has supported block-wise quants (running as w8a16) and you can also run Qwen3 FP8 models on Ampere cards.
239
+ :::
240
+
241
+ :::{note}
242
+ If you encountered the following error when deploying the FP8 models, it indicates that the tensor parallel size does not agree with the model weights:
243
+ ```
244
+ File ".../vllm/vllm/model_executor/layers/quantization/fp8.py", line 477, in create_weights
245
+ raise ValueError(
246
+ ValueError: The output_size of gate's and up's weight = 192 is not divisible by weight quantization block_n = 128.
247
+ ```
248
+
249
+ We recommend lowering the degree of tensor parallel, e.g., `--tensor-parallel-size 4` or enabling expert parallel, e.g., `--tensor-parallel-size 8 --enable-expert-parallel`.
250
+ :::
251
+
252
+ ### Context Length
253
+
254
+ The context length for Qwen3 models in pretraining is up to 32,768 tokens.
255
+ To handle context length substantially exceeding 32,768 tokens, RoPE scaling techniques should be applied.
256
+ We have validated the performance of [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
257
+
258
+ vLLM supports YaRN, which can be configured as
259
+ ```shell
260
+ vllm serve Qwen/Qwen3-8B --rope-scaling '{"rope_type":"yarn","factor":4.0,"original_max_position_embeddings":32768}' --max-model-len 131072
261
+ ```
262
+
263
+ :::{note}
264
+ vLLM implements static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.**
265
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
266
+ It is also recommended to modify the `factor` as needed. For example, if the typical context length for your application is 65,536 tokens, it would be better to set `factor` as 2.0.
267
+ :::
268
+
269
+ :::{note}
270
+ The default `max_position_embeddings` in `config.json` is set to 40,960, which used by vLLM, if `--max-model-len` is not specified.
271
+ This allocation includes reserving 32,768 tokens for outputs and 8,192 tokens for typical prompts, which is sufficient for most scenarios involving short text processing and leave adequate room for model thinking.
272
+ If the average context length does not exceed 32,768 tokens, we do not recommend enabling YaRN in this scenario, as it may potentially degrade model performance.
273
+ :::
274
+
275
+ ## Python Library
276
+
277
+ vLLM can also be directly used as a Python library, which is convenient for offline batch inference but lack some API-only features, such as parsing model generation to structure messages.
278
+
279
+ The following shows the basic usage of vLLM as a library:
280
+
281
+ ```python
282
+ from transformers import AutoTokenizer
283
+ from vllm import LLM, SamplingParams
284
+
285
+ # Initialize the tokenizer
286
+ tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")
287
+
288
+ # Configurae the sampling parameters (for thinking mode)
289
+ sampling_params = SamplingParams(temperature=0.6, top_p=0.95, top_k=20, max_tokens=32768)
290
+
291
+ # Initialize the vLLM engine
292
+ llm = LLM(model="Qwen/Qwen3-8B")
293
+
294
+ # Prepare the input to the model
295
+ prompt = "Give me a short introduction to large language models."
296
+ messages = [
297
+ {"role": "user", "content": prompt}
298
+ ]
299
+ text = tokenizer.apply_chat_template(
300
+ messages,
301
+ tokenize=False,
302
+ add_generation_prompt=True,
303
+ enable_thinking=True, # Set to False to strictly disable thinking
304
+ )
305
+
306
+ # Generate outputs
307
+ outputs = llm.generate([text], sampling_params)
308
+
309
+ # Print the outputs.
310
+ for output in outputs:
311
+ prompt = output.prompt
312
+ generated_text = output.outputs[0].text
313
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
314
+ ```
315
+
316
+ Since vLLM v0.9.0, you can also use the `LLM.chat` interface which includes support for `chat_template_kwargs`:
317
+
318
+ ```python
319
+ from vllm import LLM, SamplingParams
320
+
321
+ # Configurae the sampling parameters (for thinking mode)
322
+ sampling_params = SamplingParams(temperature=0.6, top_p=0.95, top_k=20, max_tokens=32768)
323
+
324
+ # Initialize the vLLM engine
325
+ llm = LLM(model="Qwen/Qwen3-8B")
326
+
327
+ # Prepare the input to the model
328
+ prompt = "Give me a short introduction to large language models."
329
+ messages = [
330
+ {"role": "user", "content": prompt}
331
+ ]
332
+
333
+ # Generate outputs
334
+ outputs = llm.chat(
335
+ [messages],
336
+ sampling_params,
337
+ chat_template_kwargs={"enable_thinking": True}, # Set to False to strictly disable thinking
338
+ )
339
+
340
+ # Print the outputs.
341
+ for output in outputs:
342
+ prompt = output.prompt
343
+ generated_text = output.outputs[0].text
344
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
345
+ ```
346
+
347
+ ## FAQ
348
+
349
+ You may encounter OOM issues that are pretty annoying.
350
+ We recommend two arguments for you to make some fix.
351
+
352
+ - The first one is `--max-model-len`.
353
+ Our provided default `max_position_embedding` is `40960` and thus the maximum length for the serving is also this value, leading to higher requirements of memory.
354
+ Reducing it to a proper length for yourself often helps with the OOM issue.
355
+ - Another argument you can pay attention to is `--gpu-memory-utilization`.
356
+ vLLM will pre-allocate this much GPU memory.
357
+ By default, it is `0.9`.
358
+ This is also why you find a vLLM service always takes so much memory.
359
+ If you are in eager mode (by default it is not), you can level it up to tackle the OOM problem.
360
+ Otherwise, CUDA Graphs are used, which will use GPU memory not controlled by vLLM, and you should try lowering it.
361
+ If it doesn't work, you should try `--enforce-eager`, which may slow down inference, or reduce the `--max-model-len`.
362
+
363
+
364
+ For more usage guide with vLLM, please see vLLM's [Qwen3 Usage Guide](https://github.com/vllm-project/vllm/issues/17327).
docs/source/framework/Langchain.rst ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Langchain
2
+ ==========================
3
+
4
+ .. attention::
5
+ To be updated for Qwen3.
6
+
7
+ This guide helps you build a question-answering application based
8
+ on a local knowledge base using ``Qwen2.5-7B-Instruct`` with ``langchain``.
9
+ The goal is to establish a knowledge base Q&A solution.
10
+
11
+ Basic Usage
12
+ -----------
13
+
14
+ The implementation process of this project includes
15
+ loading files -> reading text -> segmenting text -> vectorizing text -> vectorizing questions
16
+ -> matching the top k most similar text vectors with the question vectors ->
17
+ incorporating the matched text as context along with the question into the prompt ->
18
+ submitting to the Qwen2.5-7B-Instruct to generate an answer.
19
+ Below is an example:
20
+
21
+ .. code:: bash
22
+
23
+ pip install langchain==0.0.174
24
+ pip install faiss-gpu
25
+
26
+ .. code:: python
27
+
28
+ from transformers import AutoModelForCausalLM, AutoTokenizer
29
+ from abc import ABC
30
+ from langchain.llms.base import LLM
31
+ from typing import Any, List, Mapping, Optional
32
+ from langchain.callbacks.manager import CallbackManagerForLLMRun
33
+
34
+ model_name = "Qwen/Qwen2.5-7B-Instruct"
35
+
36
+ model = AutoModelForCausalLM.from_pretrained(
37
+ model_name,
38
+ torch_dtype="auto",
39
+ device_map="auto"
40
+ )
41
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
42
+
43
+ class Qwen(LLM, ABC):
44
+ max_token: int = 10000
45
+ temperature: float = 0.01
46
+ top_p = 0.9
47
+ history_len: int = 3
48
+
49
+ def __init__(self):
50
+ super().__init__()
51
+
52
+ @property
53
+ def _llm_type(self) -> str:
54
+ return "Qwen"
55
+
56
+ @property
57
+ def _history_len(self) -> int:
58
+ return self.history_len
59
+
60
+ def set_history_len(self, history_len: int = 10) -> None:
61
+ self.history_len = history_len
62
+
63
+ def _call(
64
+ self,
65
+ prompt: str,
66
+ stop: Optional[List[str]] = None,
67
+ run_manager: Optional[CallbackManagerForLLMRun] = None,
68
+ ) -> str:
69
+ messages = [
70
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
71
+ {"role": "user", "content": prompt}
72
+ ]
73
+ text = tokenizer.apply_chat_template(
74
+ messages,
75
+ tokenize=False,
76
+ add_generation_prompt=True
77
+ )
78
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
79
+ generated_ids = model.generate(
80
+ **model_inputs,
81
+ max_new_tokens=512
82
+ )
83
+ generated_ids = [
84
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
85
+ ]
86
+
87
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
88
+ return response
89
+
90
+ @property
91
+ def _identifying_params(self) -> Mapping[str, Any]:
92
+ """Get the identifying parameters."""
93
+ return {"max_token": self.max_token,
94
+ "temperature": self.temperature,
95
+ "top_p": self.top_p,
96
+ "history_len": self.history_len}
97
+
98
+ After loading the Qwen2.5-7B-Instruct model, you should specify the txt file
99
+ for retrieval.
100
+
101
+ .. code:: python
102
+
103
+ import os
104
+ import re
105
+ import torch
106
+ import argparse
107
+ from langchain.vectorstores import FAISS
108
+ from langchain.embeddings.huggingface import HuggingFaceEmbeddings
109
+ from typing import List, Tuple
110
+ import numpy as np
111
+ from langchain.document_loaders import TextLoader
112
+ from langchain.text_splitter import CharacterTextSplitter
113
+ from langchain.docstore.document import Document
114
+ from langchain.prompts.prompt import PromptTemplate
115
+ from langchain.chains import RetrievalQA
116
+
117
+ class ChineseTextSplitter(CharacterTextSplitter):
118
+ def __init__(self, pdf: bool = False, **kwargs):
119
+ super().__init__(**kwargs)
120
+ self.pdf = pdf
121
+
122
+ def split_text(self, text: str) -> List[str]:
123
+ if self.pdf:
124
+ text = re.sub(r"\n{3,}", "\n", text)
125
+ text = re.sub('\s', ' ', text)
126
+ text = text.replace("\n\n", "")
127
+ sent_sep_pattern = re.compile(
128
+ '([﹒﹔﹖﹗.。!?]["’”」』]{0,2}|(?=["‘“「『]{1,2}|$))')
129
+ sent_list = []
130
+ for ele in sent_sep_pattern.split(text):
131
+ if sent_sep_pattern.match(ele) and sent_list:
132
+ sent_list[-1] += ele
133
+ elif ele:
134
+ sent_list.append(ele)
135
+ return sent_list
136
+
137
+
138
+ def load_file(filepath):
139
+ loader = TextLoader(filepath, autodetect_encoding=True)
140
+ textsplitter = ChineseTextSplitter(pdf=False)
141
+ docs = loader.load_and_split(textsplitter)
142
+ write_check_file(filepath, docs)
143
+ return docs
144
+
145
+
146
+ def write_check_file(filepath, docs):
147
+ folder_path = os.path.join(os.path.dirname(filepath), "tmp_files")
148
+ if not os.path.exists(folder_path):
149
+ os.makedirs(folder_path)
150
+ fp = os.path.join(folder_path, 'load_file.txt')
151
+ with open(fp, 'a+', encoding='utf-8') as fout:
152
+ fout.write("filepath=%s,len=%s" % (filepath, len(docs)))
153
+ fout.write('\n')
154
+ for i in docs:
155
+ fout.write(str(i))
156
+ fout.write('\n')
157
+ fout.close()
158
+
159
+
160
+ def separate_list(ls: List[int]) -> List[List[int]]:
161
+ lists = []
162
+ ls1 = [ls[0]]
163
+ for i in range(1, len(ls)):
164
+ if ls[i - 1] + 1 == ls[i]:
165
+ ls1.append(ls[i])
166
+ else:
167
+ lists.append(ls1)
168
+ ls1 = [ls[i]]
169
+ lists.append(ls1)
170
+ return lists
171
+
172
+
173
+ class FAISSWrapper(FAISS):
174
+ chunk_size = 250
175
+ chunk_conent = True
176
+ score_threshold = 0
177
+
178
+ def similarity_search_with_score_by_vector(
179
+ self, embedding: List[float], k: int = 4
180
+ ) -> List[Tuple[Document, float]]:
181
+ scores, indices = self.index.search(np.array([embedding], dtype=np.float32), k)
182
+ docs = []
183
+ id_set = set()
184
+ store_len = len(self.index_to_docstore_id)
185
+ for j, i in enumerate(indices[0]):
186
+ if i == -1 or 0 < self.score_threshold < scores[0][j]:
187
+ # This happens when not enough docs are returned.
188
+ continue
189
+ _id = self.index_to_docstore_id[i]
190
+ doc = self.docstore.search(_id)
191
+ if not self.chunk_conent:
192
+ if not isinstance(doc, Document):
193
+ raise ValueError(f"Could not find document for id {_id}, got {doc}")
194
+ doc.metadata["score"] = int(scores[0][j])
195
+ docs.append(doc)
196
+ continue
197
+ id_set.add(i)
198
+ docs_len = len(doc.page_content)
199
+ for k in range(1, max(i, store_len - i)):
200
+ break_flag = False
201
+ for l in [i + k, i - k]:
202
+ if 0 <= l < len(self.index_to_docstore_id):
203
+ _id0 = self.index_to_docstore_id[l]
204
+ doc0 = self.docstore.search(_id0)
205
+ if docs_len + len(doc0.page_content) > self.chunk_size:
206
+ break_flag = True
207
+ break
208
+ elif doc0.metadata["source"] == doc.metadata["source"]:
209
+ docs_len += len(doc0.page_content)
210
+ id_set.add(l)
211
+ if break_flag:
212
+ break
213
+ if not self.chunk_conent:
214
+ return docs
215
+ if len(id_set) == 0 and self.score_threshold > 0:
216
+ return []
217
+ id_list = sorted(list(id_set))
218
+ id_lists = separate_list(id_list)
219
+ for id_seq in id_lists:
220
+ for id in id_seq:
221
+ if id == id_seq[0]:
222
+ _id = self.index_to_docstore_id[id]
223
+ doc = self.docstore.search(_id)
224
+ else:
225
+ _id0 = self.index_to_docstore_id[id]
226
+ doc0 = self.docstore.search(_id0)
227
+ doc.page_content += " " + doc0.page_content
228
+ if not isinstance(doc, Document):
229
+ raise ValueError(f"Could not find document for id {_id}, got {doc}")
230
+ doc_score = min([scores[0][id] for id in [indices[0].tolist().index(i) for i in id_seq if i in indices[0]]])
231
+ doc.metadata["score"] = int(doc_score)
232
+ docs.append((doc, doc_score))
233
+ return docs
234
+
235
+
236
+ if __name__ == '__main__':
237
+ # load docs (pdf file or txt file)
238
+ filepath = 'your file path'
239
+ # Embedding model name
240
+ EMBEDDING_MODEL = 'text2vec'
241
+ PROMPT_TEMPLATE = """Known information:
242
+ {context_str}
243
+ Based on the above known information, respond to the user's question concisely and professionally. If an answer cannot be derived from it, say 'The question cannot be answered with the given information' or 'Not enough relevant information has been provided,' and do not include fabricated details in the answer. Please respond in English. The question is {question}"""
244
+ # Embedding running device
245
+ EMBEDDING_DEVICE = "cuda"
246
+ # return top-k text chunk from vector store
247
+ VECTOR_SEARCH_TOP_K = 3
248
+ CHAIN_TYPE = 'stuff'
249
+ embedding_model_dict = {
250
+ "text2vec": "your text2vec model path",
251
+ }
252
+ llm = Qwen()
253
+ embeddings = HuggingFaceEmbeddings(model_name=embedding_model_dict[EMBEDDING_MODEL],model_kwargs={'device': EMBEDDING_DEVICE})
254
+
255
+ docs = load_file(filepath)
256
+
257
+ docsearch = FAISSWrapper.from_documents(docs, embeddings)
258
+
259
+ prompt = PromptTemplate(
260
+ template=PROMPT_TEMPLATE, input_variables=["context_str", "question"]
261
+ )
262
+
263
+ chain_type_kwargs = {"prompt": prompt, "document_variable_name": "context_str"}
264
+ qa = RetrievalQA.from_chain_type(
265
+ llm=llm,
266
+ chain_type=CHAIN_TYPE,
267
+ retriever=docsearch.as_retriever(search_kwargs={"k": VECTOR_SEARCH_TOP_K}),
268
+ chain_type_kwargs=chain_type_kwargs)
269
+
270
+ query = "Give me a short introduction to large language models."
271
+ print(qa.run(query))
272
+
273
+ Next Step
274
+ ---------
275
+
276
+ Now you can chat with Qwen2.5 use your own document. Continue
277
+ to read the documentation and try to figure out more advanced usages of
278
+ model retrieval!
docs/source/framework/LlamaIndex.rst ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LlamaIndex
2
+ ==========
3
+
4
+ .. attention::
5
+ To be updated for Qwen3.
6
+
7
+ To connect Qwen2.5 with external data, such as documents, web pages, etc., we offer a tutorial on `LlamaIndex <https://www.llamaindex.ai/>`__.
8
+ This guide helps you quickly implement retrieval-augmented generation (RAG) using LlamaIndex with Qwen2.5.
9
+
10
+ Preparation
11
+ --------------------------------------
12
+
13
+ To implement RAG,
14
+ we advise you to install the LlamaIndex-related packages first.
15
+
16
+ The following is a simple code snippet showing how to do this:
17
+
18
+ .. code:: bash
19
+
20
+ pip install llama-index
21
+ pip install llama-index-llms-huggingface
22
+ pip install llama-index-readers-web
23
+
24
+ Set Parameters
25
+ --------------------------------------
26
+
27
+ Now we can set up LLM, embedding model, and the related configurations.
28
+ Qwen2.5-Instruct supports conversations in multiple languages, including English and Chinese.
29
+ You can use the ``bge-base-en-v1.5`` model to retrieve from English documents, and you can download the ``bge-base-zh-v1.5`` model to retrieve from Chinese documents.
30
+ You can also choose ``bge-large`` or ``bge-small`` as the embedding model or modify the context window size or text chunk size depending on your computing resources.
31
+ Qwen2.5 model families support a maximum of 32K context window size (up to 128K for 7B, 14B, 32B, and 72B, requiring extra configuration)
32
+
33
+ .. code:: python
34
+
35
+ import torch
36
+ from llama_index.core import Settings
37
+ from llama_index.core.node_parser import SentenceSplitter
38
+ from llama_index.llms.huggingface import HuggingFaceLLM
39
+ from llama_index.embeddings.huggingface import HuggingFaceEmbedding
40
+
41
+ # Set prompt template for generation (optional)
42
+ from llama_index.core import PromptTemplate
43
+
44
+ def completion_to_prompt(completion):
45
+ return f"<|im_start|>system\n<|im_end|>\n<|im_start|>user\n{completion}<|im_end|>\n<|im_start|>assistant\n"
46
+
47
+ def messages_to_prompt(messages):
48
+ prompt = ""
49
+ for message in messages:
50
+ if message.role == "system":
51
+ prompt += f"<|im_start|>system\n{message.content}<|im_end|>\n"
52
+ elif message.role == "user":
53
+ prompt += f"<|im_start|>user\n{message.content}<|im_end|>\n"
54
+ elif message.role == "assistant":
55
+ prompt += f"<|im_start|>assistant\n{message.content}<|im_end|>\n"
56
+
57
+ if not prompt.startswith("<|im_start|>system"):
58
+ prompt = "<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n" + prompt
59
+
60
+ prompt = prompt + "<|im_start|>assistant\n"
61
+
62
+ return prompt
63
+
64
+ # Set Qwen2.5 as the language model and set generation config
65
+ Settings.llm = HuggingFaceLLM(
66
+ model_name="Qwen/Qwen2.5-7B-Instruct",
67
+ tokenizer_name="Qwen/Qwen2.5-7B-Instruct",
68
+ context_window=30000,
69
+ max_new_tokens=2000,
70
+ generate_kwargs={"temperature": 0.7, "top_k": 50, "top_p": 0.95},
71
+ messages_to_prompt=messages_to_prompt,
72
+ completion_to_prompt=completion_to_prompt,
73
+ device_map="auto",
74
+ )
75
+
76
+ # Set embedding model
77
+ Settings.embed_model = HuggingFaceEmbedding(
78
+ model_name = "BAAI/bge-base-en-v1.5"
79
+ )
80
+
81
+ # Set the size of the text chunk for retrieval
82
+ Settings.transformations = [SentenceSplitter(chunk_size=1024)]
83
+
84
+ Build Index
85
+ --------------------------------------
86
+
87
+ Now we can build index from documents or websites.
88
+
89
+ The following code snippet demonstrates how to build an index for files (regardless of whether they are in PDF or TXT format) in a local folder named 'document'.
90
+
91
+ .. code:: python
92
+
93
+ from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
94
+
95
+ documents = SimpleDirectoryReader("./document").load_data()
96
+ index = VectorStoreIndex.from_documents(
97
+ documents,
98
+ embed_model=Settings.embed_model,
99
+ transformations=Settings.transformations
100
+ )
101
+
102
+ The following code snippet demonstrates how to build an index for the content in a list of websites.
103
+
104
+ .. code:: python
105
+
106
+ from llama_index.readers.web import SimpleWebPageReader
107
+ from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
108
+
109
+ documents = SimpleWebPageReader(html_to_text=True).load_data(
110
+ ["web_address_1","web_address_2",...]
111
+ )
112
+ index = VectorStoreIndex.from_documents(
113
+ documents,
114
+ embed_model=Settings.embed_model,
115
+ transformations=Settings.transformations
116
+ )
117
+
118
+ To save and load the index, you can use the following code snippet.
119
+
120
+ .. code:: python
121
+
122
+ from llama_index.core import StorageContext, load_index_from_storage
123
+
124
+ # save index
125
+ storage_context = StorageContext.from_defaults(persist_dir="save")
126
+
127
+ # load index
128
+ index = load_index_from_storage(storage_context)
129
+
130
+
131
+ RAG
132
+ -------------------
133
+
134
+ Now you can perform queries, and Qwen2.5 will answer based on the content of the indexed documents.
135
+
136
+ .. code:: python
137
+
138
+ query_engine = index.as_query_engine()
139
+ your_query = "<your query here>"
140
+ print(query_engine.query(your_query).response)
141
+
docs/source/framework/function_call.md ADDED
@@ -0,0 +1,606 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ myst:
3
+ number_code_blocks: ["python3"]
4
+ ---
5
+
6
+ # Function Calling
7
+
8
+
9
+ ## Preface
10
+
11
+ Function calling with large language models is a huge and evolving topic.
12
+ It is particularly important for AI applications:
13
+ - either for AI-native applications that strive to work around the shortcomings of current AI technology,
14
+ - or for existing applications that seeks the integration of AI technology to improve performance, user interaction and experience, or efficiency.
15
+
16
+ We will talk about how Qwen3 can be used to support function calling and how it can be used to achieve your goals, from the inference usage for developing application to the inner workings for hardcore customizations.
17
+ In this guide,
18
+ - We will first demonstrate how to use function calling with Qwen3.
19
+ - Then, we will introduce the technical details on functional calling with Qwen3, which are mainly about the templates.
20
+
21
+ Before starting, there is one thing we have not yet introduced, that is ...
22
+
23
+ ## What is function calling?
24
+
25
+ :::{Note}
26
+ There is another term "tool use" that may be used to refer to the same concept.
27
+ While some may argue that tools are a generalized form of functions, at present, their difference exists only technically as different I/O types of programming interfaces.
28
+ :::
29
+
30
+ Large language models (LLMs) are powerful things.
31
+ However, sometimes LLMs by themselves are simply not capable enough.
32
+ - On the one hand, LLMs have inherent modeling limitations.
33
+ For one, they do not know things that are not in their training data, which include those happened after their training ended.
34
+ In addition, they learn things in the way of likelihood, which suggests that they may not be precise enough for tasks with fixed rule sets, e.g., mathematical computation.
35
+ - On the other hand, it is not easy to use LLMs as a Plug-and-Play service programmatically with other things.
36
+ LLMs mostly talk in words that are open to interpretation and thus ambiguous, while other software or applications or systems talk in code and through programming interfaces that are pre-defined and fixed and structured.
37
+
38
+ To this end, function calling establishes a common protocol that specifies how LLMs should interact with the other things.
39
+ The procedure is mainly as follows:
40
+ 1. The application provides a set of functions and the instructions of the functions to an LLM.
41
+ 2. The LLM choose to or not to, or is forced to use one or many of the functions, in response to user queries.
42
+ 3. If the LLM chooses to use the functions, it states how the functions should be used based on the function instructions.
43
+ 4. The chosen functions are used as such by the application and the results are obtained, which are then given to the LLM if further interaction is needed.
44
+
45
+ There are many ways for LLMs to understand and follow this protocol.
46
+ As always, the key is prompt engineering or an internalized template known by the model.
47
+ We recommend using Hermes-style tool use for Qwen3 to maximize function calling performance.
48
+
49
+ ## Inference with Function Calling
50
+
51
+ As function calling is essentially implemented using prompt engineering, you could manually construct the model inputs for Qwen3 models.
52
+ However, frameworks with function calling support can help you with all that laborious work.
53
+
54
+ In the following, we will introduce the usage (via dedicated function calling chat template) with
55
+ - **Qwen-Agent**,
56
+ - **vLLM**.
57
+
58
+ ### The Example Case
59
+
60
+ Let's also use an example to demonstrate the inference usage.
61
+ We assume **Python 3.11** is used as the programming language.
62
+
63
+ **Scenario**: Suppose we would like to ask the model about the temperature of a location.
64
+ Normally, the model would reply that it cannot provide real-time information.
65
+ But we have two tools that can be used to obtain the current temperature of and the temperature at a given date of a city respectively, and we would like the model to make use of them.
66
+
67
+ To set up the example case, you can use the following code:
68
+
69
+ :::{dropdown} Preparation Code
70
+ :name: prepcode
71
+
72
+ ```python
73
+ import json
74
+
75
+ def get_current_temperature(location: str, unit: str = "celsius"):
76
+ """Get current temperature at a location.
77
+
78
+ Args:
79
+ location: The location to get the temperature for, in the format "City, State, Country".
80
+ unit: The unit to return the temperature in. Defaults to "celsius". (choices: ["celsius", "fahrenheit"])
81
+
82
+ Returns:
83
+ the temperature, the location, and the unit in a dict
84
+ """
85
+ return {
86
+ "temperature": 26.1,
87
+ "location": location,
88
+ "unit": unit,
89
+ }
90
+
91
+
92
+ def get_temperature_date(location: str, date: str, unit: str = "celsius"):
93
+ """Get temperature at a location and date.
94
+
95
+ Args:
96
+ location: The location to get the temperature for, in the format "City, State, Country".
97
+ date: The date to get the temperature for, in the format "Year-Month-Day".
98
+ unit: The unit to return the temperature in. Defaults to "celsius". (choices: ["celsius", "fahrenheit"])
99
+
100
+ Returns:
101
+ the temperature, the location, the date and the unit in a dict
102
+ """
103
+ return {
104
+ "temperature": 25.9,
105
+ "location": location,
106
+ "date": date,
107
+ "unit": unit,
108
+ }
109
+
110
+
111
+ def get_function_by_name(name):
112
+ if name == "get_current_temperature":
113
+ return get_current_temperature
114
+ if name == "get_temperature_date":
115
+ return get_temperature_date
116
+
117
+ TOOLS = [
118
+ {
119
+ "type": "function",
120
+ "function": {
121
+ "name": "get_current_temperature",
122
+ "description": "Get current temperature at a location.",
123
+ "parameters": {
124
+ "type": "object",
125
+ "properties": {
126
+ "location": {
127
+ "type": "string",
128
+ "description": 'The location to get the temperature for, in the format "City, State, Country".',
129
+ },
130
+ "unit": {
131
+ "type": "string",
132
+ "enum": ["celsius", "fahrenheit"],
133
+ "description": 'The unit to return the temperature in. Defaults to "celsius".',
134
+ },
135
+ },
136
+ "required": ["location"],
137
+ },
138
+ },
139
+ },
140
+ {
141
+ "type": "function",
142
+ "function": {
143
+ "name": "get_temperature_date",
144
+ "description": "Get temperature at a location and date.",
145
+ "parameters": {
146
+ "type": "object",
147
+ "properties": {
148
+ "location": {
149
+ "type": "string",
150
+ "description": 'The location to get the temperature for, in the format "City, State, Country".',
151
+ },
152
+ "date": {
153
+ "type": "string",
154
+ "description": 'The date to get the temperature for, in the format "Year-Month-Day".',
155
+ },
156
+ "unit": {
157
+ "type": "string",
158
+ "enum": ["celsius", "fahrenheit"],
159
+ "description": 'The unit to return the temperature in. Defaults to "celsius".',
160
+ },
161
+ },
162
+ "required": ["location", "date"],
163
+ },
164
+ },
165
+ },
166
+ ]
167
+ MESSAGES = [
168
+ {"role": "user", "content": "What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30."},
169
+ ]
170
+ ```
171
+ :::
172
+
173
+ In particular, the tools should be described using JSON Schema and the messages should contain as much available information as possible.
174
+ You can find the explanations of the tools and messages below:
175
+
176
+ :::{dropdown} Example Tools
177
+
178
+ The tools should be described using the following JSON:
179
+ ```json
180
+ [
181
+ {
182
+ "type": "function",
183
+ "function": {
184
+ "name": "get_current_temperature",
185
+ "description": "Get current temperature at a location.",
186
+ "parameters": {
187
+ "type": "object",
188
+ "properties": {
189
+ "location": {
190
+ "type": "string",
191
+ "description": "The location to get the temperature for, in the format \"City, State, Country\"."
192
+ },
193
+ "unit": {
194
+ "type": "string",
195
+ "enum": [
196
+ "celsius",
197
+ "fahrenheit"
198
+ ],
199
+ "description": "The unit to return the temperature in. Defaults to \"celsius\"."
200
+ }
201
+ },
202
+ "required": [
203
+ "location"
204
+ ]
205
+ }
206
+ }
207
+ },
208
+ {
209
+ "type": "function",
210
+ "function": {
211
+ "name": "get_temperature_date",
212
+ "description": "Get temperature at a location and date.",
213
+ "parameters": {
214
+ "type": "object",
215
+ "properties": {
216
+ "location": {
217
+ "type": "string",
218
+ "description": "The location to get the temperature for, in the format \"City, State, Country\"."
219
+ },
220
+ "date": {
221
+ "type": "string",
222
+ "description": "The date to get the temperature for, in the format \"Year-Month-Day\"."
223
+ },
224
+ "unit": {
225
+ "type": "string",
226
+ "enum": [
227
+ "celsius",
228
+ "fahrenheit"
229
+ ],
230
+ "description": "The unit to return the temperature in. Defaults to \"celsius\"."
231
+ }
232
+ },
233
+ "required": [
234
+ "location",
235
+ "date"
236
+ ]
237
+ }
238
+ }
239
+ }
240
+ ]
241
+ ```
242
+ For each **tool**, it is a JSON object with two fields:
243
+ - `type`: a string specifying the type of the tool, currently only `"function"` is valid
244
+ - `function`: an object detailing the instructions to use the function
245
+
246
+ For each **function**, it is a JSON object with three fields:
247
+ - `name`: a string indicating the name of the function
248
+ - `description`: a string describing what the function is used for
249
+ - `parameters`: [a JSON Schema](https://json-schema.org/learn/getting-started-step-by-step) that specifies the parameters the function accepts. Please refer to the linked documentation for how to compose a JSON Schema. Notable fields include `type`, `required`, and `enum`.
250
+
251
+ Most frameworks use the tool format and some may use the function format.
252
+ Which one to use should be obvious according to the naming.
253
+ :::
254
+
255
+
256
+ :::{dropdown} Example Messages
257
+
258
+ Our query is `What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30.`.
259
+
260
+ ```json
261
+ [
262
+ {"role": "user", "content": "What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30."}
263
+ ]
264
+ ```
265
+ :::
266
+
267
+ ### Qwen-Agent
268
+
269
+ [Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) is actually a Python Agent framework for developing AI applications.
270
+ Although its intended use cases are higher-level than efficient inference, it does contain the **canonical implementation** of function calling for Qwen3.
271
+ It provides the function calling ability for Qwen3 to an OpenAI-compatible API through templates that is transparent to users.
272
+
273
+ It is worth noting that for reasoning models like Qwen3, it is *not recommended* to use tool call template based on stopwords, such as ReAct, because the model may output stopwords in the thought section, potentially leading to unexpected behavior in tool calls.
274
+
275
+ Before starting, let's make sure the latest library is installed:
276
+ ```bash
277
+ pip install -U qwen-agent
278
+ ```
279
+
280
+ #### Preparing
281
+
282
+ Qwen-Agent can wrap an OpenAI-compatible API that does not support function calling.
283
+ You can serve such an API with most inference frameworks or obtain one from cloud providers like DashScope or Together.
284
+
285
+ Assuming there is an OpenAI-compatible API at `http://localhost:8000/v1`, Qwen-Agent provides a shortcut function `get_chat_model` to obtain a model inference class with function calling support:
286
+
287
+ ```python
288
+ from qwen_agent.llm import get_chat_model
289
+
290
+ llm = get_chat_model({
291
+ "model": "Qwen/Qwen3-8B",
292
+ "model_server": "http://localhost:8000/v1",
293
+ "api_key": "EMPTY",
294
+ "generate_cfg": {
295
+ "extra_body": {
296
+ "chat_template_kwargs": {"enable_thinking": False} # default to True
297
+ }
298
+ }
299
+ })
300
+ ```
301
+
302
+ In the above, `model_server` is the `api_base` common used in other OpenAI-compatible API clients.
303
+ It is advised to provide the `api_key` (but not via plaintext in the code), even if the API server does not check it, in which case, you can set it to anything.
304
+ You can pass model parameters to the model by `generate_cfg`. Here we demonstrate how to control the think and no_think modes of Qwen3.
305
+ Different APIs may have different control methods.
306
+
307
+ For model inputs, the common message structure for system, user, and assistant history should be used:
308
+
309
+ ```python
310
+ messages = MESSAGES[:]
311
+ ```
312
+
313
+ At the time, Qwen-Agent works with functions instead of tools.
314
+ This requires a small change to our tool descriptions, that is, extracting the function fields:
315
+
316
+ ```python
317
+ functions = [tool["function"] for tool in TOOLS]
318
+ ```
319
+
320
+ #### Tool Calls and Tool Results
321
+
322
+ To interact with the model, the `chat` method should be used:
323
+
324
+ ```python
325
+ for responses in llm.chat(
326
+ messages=messages,
327
+ functions=functions,
328
+ ):
329
+ pass
330
+ messages.extend(responses)
331
+ ```
332
+
333
+ The `chat` method returns a generator of list, each of which may contain multiple messages.
334
+
335
+
336
+ - The results of `no_think` mode:
337
+ ```python
338
+ [
339
+ {"role": "assistant", "content": "", "function_call": {"name": "get_current_temperature", "arguments": "{\"location\": \"San Francisco, California, United States\", \"unit\": \"celsius\"}"}},
340
+ {"role": "assistant", "content": "", "function_call": {"name": "get_temperature_date", "arguments": "{\"location\": \"San Francisco, California, United States\", \"date\": \"2024-10-01\", \"unit\": \"celsius\"}"}},
341
+ ]
342
+ ```
343
+
344
+ - The results of `think` mode:
345
+ ```python
346
+ [
347
+ {"role": "assistant", "content": "", "reasoning_content": "Okay, the user is asking for the current temperature in San Francisco and the temperature for tomorrow. Let me check the available tools.\n\nFirst, there's the get_current_temperature function. It requires the location and optionally the unit. Since the user didn't specify the unit, I'll default to celsius. The location should be \"San Francisco, State, Country\". Wait, the example format is \"City, State, Country\", but San Francisco is a city in California, USA. So the location parameter would be \"San Francisco, California, United States\".\n\nThen, for tomorrow's temperature, the user mentioned the current date is 2024-09-30, so tomorrow would be 2024-10-01. The get_temperature_date function requires location, date, and unit. Again, using the same location and default unit. I need to format the date as \"Year-Month-Day\", which is 2024-10-01.\n\nWait, the current date given is 2024-09-30. If today is September 30, then tomorrow is October 1st. So the date parameter for the second function call should be \"2024-10-01\".\n\nI should make two separate function calls: one for the current temperature and another for tomorrow's date. Let me structure the JSON for both tool calls accordingly."},
348
+ {"role": "assistant", "content": "", "function_call": {"name": "get_current_temperature", "arguments": "{\"location\": \"San Francisco, California, United States\", \"unit\": \"celsius\"}"}},
349
+ {"role": "assistant", "content": "", "function_call": {"name": "get_temperature_date", "arguments": "{\"location\": \"San Francisco, California, United States\", \"date\": \"2024-10-01\", \"unit\": \"celsius\"}"}},
350
+ ]
351
+ ```
352
+
353
+ As we can see, Qwen-Agent attempts to parse the model generation in an easier to use structural format.
354
+ The details related to function calls are placed in the `function_call` field of the messages:
355
+ - `name`: a string representing the function to call
356
+ - `arguments`: a JSON-formatted string representing the arguments the function should be called with
357
+
358
+ In the thinking mode, it will first generate a thought and then generate the tool call(s).
359
+
360
+ Then comes the critical part -- checking and applying the function call:
361
+ ```python3
362
+ for message in responses:
363
+ if fn_call := message.get("function_call", None):
364
+ fn_name: str = fn_call['name']
365
+ fn_args: dict = json.loads(fn_call["arguments"])
366
+
367
+ fn_res: str = json.dumps(get_function_by_name(fn_name)(**fn_args))
368
+
369
+ messages.append({
370
+ "role": "function",
371
+ "name": fn_name,
372
+ "content": fn_res,
373
+ })
374
+ ```
375
+
376
+ To get tool results:
377
+ - line 1: We should iterate the function calls in the order the model generates them.
378
+ - line 2: We can check if a function call is needed as deemed by the model by checking the `function_call` field of the generated messages.
379
+ - line 3-4: The related details including the name and the arguments of the function can also be found there, which are `name` and `arguments` respectively.
380
+ - line 6: With the details, one should call the function and obtain the results.
381
+ Here, we assume there is a function named [`get_function_by_name`](#prepcode) to help us get the related function by its name.
382
+ - line 8-12: With the result obtained, add the function result to the messages as `content` and with `role` as `"function"`.
383
+
384
+ Now the messages are:
385
+
386
+ - `no_think` mode:
387
+ ```python
388
+ [
389
+ {"role": "user", "content": "What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30."},
390
+ {"role": "assistant", "content": "", "function_call": {"name": "get_current_temperature", "arguments": "{\"location\": \"San Francisco, California, United States\", \"unit\": \"celsius\"}"}},
391
+ {"role": "assistant", "content": "", "function_call": {"name": "get_temperature_date", "arguments": "{\"location\": \"San Francisco, California, United States\", \"date\": \"2024-10-01\", \"unit\": \"celsius\"}"}},
392
+ {"role": "function", "name": "get_current_temperature", "content": '{"temperature": 26.1, "location": "San Francisco, California, United States", "unit": "celsius"}'},
393
+ {"role": "function", "name": "get_temperature_date", "content": '{"temperature": 25.9, "location": "San Francisco, California, United States", "date": "2024-10-01", "unit": "celsius"}'},
394
+ ]
395
+ ```
396
+
397
+ - `think` mode:
398
+ ```python
399
+ [
400
+ {"role": "user", "content": "What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30."},
401
+ {"role": "assistant", "content": "", "reasoning_content": "Okay, the user is asking for the current temperature in San Francisco and the temperature for tomorrow. Let me check the available tools.\n\nFirst, there's the get_current_temperature function. It requires the location and optionally the unit. Since the user didn't specify the unit, I'll default to celsius. The location should be \"San Francisco, State, Country\". Wait, the example format is \"City, State, Country\", but San Francisco is a city in California, USA. So the location parameter would be \"San Francisco, California, United States\".\n\nThen, for tomorrow's temperature, the user mentioned the current date is 2024-09-30, so tomorrow would be 2024-10-01. The get_temperature_date function requires location, date, and unit. Again, using the same location and default unit. I need to format the date as \"Year-Month-Day\", which is 2024-10-01.\n\nWait, the current date given is 2024-09-30. If today is September 30, then tomorrow is October 1st. So the date parameter for the second function call should be \"2024-10-01\".\n\nI should make two separate function calls: one for the current temperature and another for tomorrow's date. Let me structure the JSON for both tool calls accordingly."},
402
+ {"role": "assistant", "content": "", "function_call": {"name": "get_current_temperature", "arguments": "{\"location\": \"San Francisco, California, United States\", \"unit\": \"celsius\"}"}},
403
+ {"role": "assistant", "content": "", "function_call": {"name": "get_temperature_date", "arguments": "{\"location\": \"San Francisco, California, United States\", \"date\": \"2024-10-01\", \"unit\": \"celsius\"}"}},
404
+ {"role": "function", "name": "get_current_temperature", "content": '{"temperature": 26.1, "location": "San Francisco, California, United States", "unit": "celsius"}'},
405
+ {"role": "function", "name": "get_temperature_date", "content": '{"temperature": 25.9, "location": "San Francisco, California, United States", "date": "2024-10-01", "unit": "celsius"}'},
406
+ ]
407
+ ```
408
+
409
+ #### Final Response
410
+
411
+ Finally, run the model again to get the final model results:
412
+
413
+ ```python
414
+ for responses in llm.chat(messages=messages, functions=functions):
415
+ pass
416
+ messages.extend(responses)
417
+ ```
418
+
419
+ The final response should be like
420
+
421
+ - `no_think` mode:
422
+ ```python
423
+ [
424
+ {"role": "assistant", "content": "The current temperature in San Francisco, CA, USA is **26.1°C**. \n\nFor tomorrow (2024-10-01), the temperature is projected to be **25.9°C**. \n\nThere is a slight decrease in temperature expected from today to tomorrow."}
425
+ ]
426
+ ```
427
+
428
+ - `think` mode:
429
+ ```python
430
+ [
431
+ {"role": "assistant", "content": "", "reasoning_content": "Okay, the user asked for the current temperature in San Francisco and tomorrow's temperature. I called the get_current_temperature function for now and get_temperature_date for tomorrow. The responses came back with 26.1°C today and 25.9°C tomorrow. Let me present this info clearly.\n\nFirst, confirm the location to make sure there's no confusion. The current temp is 26.1°C, so I'll state that. Then, tomorrow's date is 2024-10-01, which is October 1st, so I'll mention the date in a user-friendly way. The temp drops slightly to 25.9°C. I should note the unit is Celsius as per the default. Keep the answer concise but informative. Maybe add a brief note about the slight decrease. Make sure the dates are correctly formatted and the temperatures are accurate based on the data provided."},
432
+ {"role": "assistant", "content": "The current temperature in San Francisco, CA, USA is **26.1°C**. \n\nFor tomorrow (2024-10-01), the temperature is projected to be **25.9°C**. \n\nThere is a slight decrease in temperature expected from today to tomorrow."}
433
+ ]
434
+ ```
435
+
436
+
437
+ (heading-target)=
438
+ ### vLLM
439
+
440
+ vLLM is a fast and easy-to-use library for LLM inference and serving.
441
+ It uses the tokenizer from `transformers` to format the input, so we should have no trouble preparing the input.
442
+ In addition, vLLm also implements helper functions so that generated tool calls can be parsed automatically if the format is supported.
443
+
444
+ - `vllm` >= v0.8.5.
445
+
446
+ For more information, check the [vLLM documentation](https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#tool-calling-in-the-chat-completion-api).
447
+
448
+ We will use the OpenAI-Compatible API by `vllm` with the API client from the `openai` Python library.
449
+
450
+ #### Preparing
451
+
452
+ For Qwen3, the chat template in tokenizer_config.json has already included support for the Hermes-style tool use.
453
+ We simply need to start a OpenAI-compatible API with vLLM:
454
+
455
+ ```bash
456
+ vllm serve Qwen/Qwen3-8B --enable-auto-tool-choice --tool-call-parser hermes --reasoning-parser deepseek_r1
457
+ ```
458
+
459
+ The inputs are the same with those in [the preparation code](#prepcode):
460
+
461
+ ```python
462
+ tools = TOOLS
463
+ messages = MESSAGES
464
+ ```
465
+
466
+ Let's also initialize the client:
467
+
468
+ ```python
469
+ from openai import OpenAI
470
+
471
+ openai_api_key = "EMPTY"
472
+ openai_api_base = "http://localhost:8000/v1"
473
+
474
+ client = OpenAI(
475
+ api_key=openai_api_key,
476
+ base_url=openai_api_base,
477
+ )
478
+
479
+ model_name = "Qwen/Qwen3-8B"
480
+ ```
481
+
482
+ #### Tool Calls and Tool Results
483
+
484
+ We can use the create chat completions endpoint to query the model.
485
+ Here is an example of the `no_think` mode:
486
+
487
+ ```python
488
+ response = client.chat.completions.create(
489
+ model=model_name,
490
+ messages=messages,
491
+ tools=tools,
492
+ temperature=0.7,
493
+ top_p=0.8,
494
+ max_tokens=512,
495
+ extra_body={
496
+ "repetition_penalty": 1.05,
497
+ "chat_template_kwargs": {"enable_thinking": False} # default to True
498
+ },
499
+ )
500
+ ```
501
+
502
+ vLLM should be able to parse the tool calls for us, and the main fields in the response (`response.choices[0]`) should be like
503
+ ```python
504
+ Choice(
505
+ finish_reason='tool_calls',
506
+ index=0,
507
+ logprobs=None,
508
+ message=ChatCompletionMessage(
509
+ content=None,
510
+ role='assistant',
511
+ function_call=None,
512
+ tool_calls=[
513
+ ChatCompletionMessageToolCall(
514
+ id='chatcmpl-tool-924d705adb044ff88e0ef3afdd155f15',
515
+ function=Function(arguments='{"location": "San Francisco, CA, USA"}', name='get_current_temperature'),
516
+ type='function',
517
+ ),
518
+ ChatCompletionMessageToolCall(
519
+ id='chatcmpl-tool-7e30313081944b11b6e5ebfd02e8e501',
520
+ function=Function(arguments='{"location": "San Francisco, CA, USA", "date": "2024-10-01"}', name='get_temperature_date'),
521
+ type='function',
522
+ ),
523
+ ],
524
+ ),
525
+ stop_reason=None,
526
+ )
527
+ ```
528
+
529
+ Note that the function arguments are JSON-formatted strings, which Qwen-Agent follows.
530
+
531
+ As before, chances are that there are corner cases where tool calls are generated but they are malformed and cannot be parsed.
532
+ For production code, we should try parsing by ourselves.
533
+
534
+ Then, we can obtain the tool results and add them to the messages as shown below:
535
+
536
+ ```python
537
+ messages.append(response.choices[0].message.model_dump())
538
+
539
+ if tool_calls := messages[-1].get("tool_calls", None):
540
+ for tool_call in tool_calls:
541
+ call_id: str = tool_call["id"]
542
+ if fn_call := tool_call.get("function"):
543
+ fn_name: str = fn_call["name"]
544
+ fn_args: dict = json.loads(fn_call["arguments"])
545
+
546
+ fn_res: str = json.dumps(get_function_by_name(fn_name)(**fn_args))
547
+
548
+ messages.append({
549
+ "role": "tool",
550
+ "content": fn_res,
551
+ "tool_call_id": call_id,
552
+ })
553
+ ```
554
+
555
+ It should be noted that the OpenAI API uses `tool_call_id` to identify the relation between tool results and tool calls.
556
+
557
+ The messages are now like
558
+ ```python
559
+ [
560
+ {'role': 'user', 'content': "What's the temperature in San Francisco now? How about tomorrow? Current Date: 2024-09-30."},
561
+ {'content': None, 'role': 'assistant', 'function_call': None, 'tool_calls': [
562
+ {'id': 'chatcmpl-tool-924d705adb044ff88e0ef3afdd155f15', 'function': {'arguments': '{"location": "San Francisco, CA, USA"}', 'name': 'get_current_temperature'}, 'type': 'function'},
563
+ {'id': 'chatcmpl-tool-7e30313081944b11b6e5ebfd02e8e501', 'function': {'arguments': '{"location": "San Francisco, CA, USA", "date": "2024-10-01"}', 'name': 'get_temperature_date'}, 'type': 'function'},
564
+ ]},
565
+ {'role': 'tool', 'content': '{"temperature": 26.1, "location": "San Francisco, CA, USA", "unit": "celsius"}', 'tool_call_id': 'chatcmpl-tool-924d705adb044ff88e0ef3afdd155f15'},
566
+ {'role': 'tool', 'content': '{"temperature": 25.9, "location": "San Francisco, CA, USA", "date": "2024-10-01", "unit": "celsius"}', 'tool_call_id': 'chatcmpl-tool-7e30313081944b11b6e5ebfd02e8e501'},
567
+ ]
568
+ ```
569
+
570
+ #### Final Response
571
+
572
+ Let's call the endpoint again to seed the tool results and get response:
573
+ ```python
574
+ response = client.chat.completions.create(
575
+ model=model_name,
576
+ messages=messages,
577
+ tools=tools,
578
+ temperature=0.7,
579
+ top_p=0.8,
580
+ max_tokens=512,
581
+ extra_body={
582
+ "repetition_penalty": 1.05,
583
+ },
584
+ )
585
+
586
+ messages.append(response.choices[0].message.model_dump())
587
+ ```
588
+
589
+ The final response (`response.choices[0].message.content`) should be like
590
+ ```text
591
+ The current temperature in San Francisco is approximately 26.1°C. For tomorrow, the forecasted temperature is around 25.9°C.
592
+ ```
593
+
594
+
595
+ ## Finally
596
+
597
+ In whichever way you choose to use function calling with Qwen3, keep in mind that the limitation and the perks of prompt engineering applies:
598
+ - It is not guaranteed that the model generation will always follow the protocol even with proper prompting or templates.
599
+ Especially, for the templates that are more complex and relies more on the model itself to think and stay on track than the ones that are simpler and relies on the template and the use of control or special tokens.
600
+ The latter one, of course, requires some kind of training.
601
+ In production code, be prepared that if it breaks, countermeasures or rectifications are in place.
602
+ - If in certain scenarios, the generation is not up to expectation, you can refine the template to add more instructions or constraints.
603
+ While the templates mentioned here are general enough, they may not be the best or the most specific or the most concise for your use cases.
604
+ The ultimate solution is fine-tuning using your own data.
605
+
606
+ Have fun prompting!
docs/source/framework/qwen_agent.rst ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Qwen-Agent
2
+ ==========
3
+
4
+ `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ is a framework for
5
+ developing LLM applications based on the instruction following, tool
6
+ usage, planning, and memory capabilities of Qwen.
7
+
8
+ This is a simple tutorial on using Qwen-Agent to quickly experience the
9
+ agentic capabilities of Qwen3. For more detailed information, please
10
+ refer to `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__
11
+ repository.
12
+
13
+ Installation
14
+ ------------
15
+
16
+ - Install the stable version from PyPI:
17
+
18
+ .. code:: bash
19
+
20
+ pip install -U "qwen-agent[gui,rag,code_interpreter,mcp]"
21
+ # Or use `pip install -U qwen-agent` for the minimal requirements.
22
+ # The optional requirements, specified in double brackets, are:
23
+ # [gui] for Gradio-based GUI support;
24
+ # [rag] for RAG support;
25
+ # [code_interpreter] for Code Interpreter support;
26
+ # [mcp] for MCP support.
27
+
28
+ Developing Your Own Agent
29
+ -------------------------
30
+
31
+ Qwen3 excels in tool calling capabilities. Qwen-Agent encapsulates
32
+ tool-calling templates and tool-calling parsers internally, greatly
33
+ reducing coding complexity.
34
+
35
+ To define the available tools, you can use the MCP configuration file,
36
+ use the integrated tool of Qwen-Agent, or integrate other tools by
37
+ yourself.
38
+
39
+ .. code:: python
40
+
41
+ import os
42
+ from qwen_agent.agents import Assistant
43
+
44
+ # Define LLM
45
+ llm_cfg = {
46
+ # Use a custom endpoint compatible with OpenAI API by vLLM/SGLang:
47
+ 'model': 'Qwen/Qwen3-32B',
48
+ 'model_server': 'http://localhost:8000/v1', # api_base
49
+ 'api_key': 'EMPTY',
50
+
51
+ # 'generate_cfg': {
52
+ # # When using vLLM/SGLang OAI API, pass the parameter of whether to enable thinking mode in this way
53
+ # 'extra_body': {
54
+ # 'chat_template_kwargs': {'enable_thinking': False}
55
+ # },
56
+ #
57
+ # # Add: When the content is `<think>this is the thought</think>this is the answer`
58
+ # # Do not add: When the response has been separated by reasoning_content and content
59
+ # # This parameter will affect the parsing strategy of tool call
60
+ # # 'thought_in_content': True,
61
+ # },
62
+ }
63
+ # llm_cfg = {
64
+ # # Use the model service provided by DashScope:
65
+ # 'model': 'qwen3-235b-a22b',
66
+ # 'model_type': 'qwen_dashscope',
67
+ #
68
+ # # 'generate_cfg': {
69
+ # # # When using the Dash Scope API, pass the parameter of whether to enable thinking mode in this way
70
+ # # 'enable_thinking': False,
71
+ # # },
72
+ # }
73
+ # llm_cfg = {
74
+ # # Use the OpenAI-compatible model service provided by DashScope:
75
+ # 'model': 'qwen3-235b-a22b',
76
+ # 'model_server': 'https://dashscope.aliyuncs.com/compatible-mode/v1',
77
+ # 'api_key': os.getenv('DASHSCOPE_API_KEY'),
78
+ #
79
+ # # 'generate_cfg': {
80
+ # # # When using Dash Scope OAI API, pass the parameter of whether to enable thinking mode in this way
81
+ # # 'extra_body': {
82
+ # # 'enable_thinking': False
83
+ # # },
84
+ # # },
85
+ # }
86
+
87
+ # Define Tools
88
+ tools = [
89
+ {'mcpServers': { # You can specify the MCP configuration file
90
+ 'time': {
91
+ 'command': 'uvx',
92
+ 'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
93
+ },
94
+ "fetch": {
95
+ "command": "uvx",
96
+ "args": ["mcp-server-fetch"]
97
+ }
98
+ }
99
+ },
100
+ 'code_interpreter', # Built-in tools
101
+ ]
102
+
103
+ # Define Agent
104
+ bot = Assistant(llm=llm_cfg, function_list=tools)
105
+
106
+ # Streaming generation
107
+ messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
108
+ for responses in bot.run(messages=messages):
109
+ pass
110
+ print(responses)
111
+
112
+ For more detailed examples and MCP cookbooks, please refer to
113
+ `Qwen-Agent <https://github.com/QwenLM/Qwen-Agent>`__ repository.
docs/source/getting_started/concepts.md ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Key Concepts
2
+
3
+ ## Qwen
4
+
5
+ Qwen (Chinese: 通义千问; pinyin: _Tongyi Qianwen_) is the large language model and large multimodal model series of the Qwen Team, Alibaba Group.
6
+ Qwen is capable of natural language understanding, text generation, vision understanding, audio understanding, tool use, role play, playing as AI agent, etc.
7
+ Both language models and multimodal models are pre-trained on large-scale multilingual and multimodal data and post-trained on quality data for aligning to human preferences.
8
+
9
+ There is the proprietary/closed source version and the open-weight version. You can learn more about the proprietary models at Alibaba Cloud Model Studio ([China Site](https://help.aliyun.com/zh/model-studio/getting-started/models#9f8890ce29g5u) \[zh\], [International Site](https://www.alibabacloud.com/en/product/modelstudio)).
10
+
11
+ In this document, our focus is Qwen, the language models.
12
+
13
+ ## Qwen3
14
+
15
+ Qwen3 is the newest edition of the Qwen language models, featuring balanced model sizes, enhanced capbilities, hybrid thinking modes, and more language support:
16
+ - The mixture-of-experts (MoE) models are reintroduced with the Qwen3-30B-A3B and Qwen3-235B-A22B. The largest dense models are now Qwen3-32B.
17
+ - Hybrid thinking mode is designed so that thinking and non-thinking (instruct) can be achieved without changing models, simplifying deployment and making alternating thinking and non-thinking in a single chat possible.
18
+ - With 119 languages (and dialects), Qwen3's extensive multilingual capability opens up new possibilities for international applications.
19
+ - Qwen3 models are optimized for coding and agentic capabilities, with strengthened support of Model Context Protocol (MCP) as well.
20
+
21
+ ## Naming
22
+
23
+ Starting with Qwen3, the models are named using the scheme `Qwen3[-size][-type][-date]`:
24
+ - `size`: the notation of the structure and the parameter counts. Dense models use the total saved parameters, e.g., `4B` and `32B`, while MoE models use the total saved parameters and the activated parameters for each token with a prepended `A`, e.g., `30B-A3B` and `235B-A22B`.
25
+ - `type`: there are currently 4 types:
26
+ - `-Instruct`: the instruction following models that follow the predefined chat template, used for conducting tasks in conversations, downstream fine-tuning, etc.
27
+ - `-Thinking`: the thinking models that follow the predefined chat template and use chain-of-thoughts (CoT) to think deeply about the questions, used for solving complex problems.
28
+ - `-Base`: the pre-trained models that do not know the predefined chat template, used for in-context learning, downstream fine-tuning, etc.
29
+ - No type: the models with hybrid thinking modes.
30
+ - `date`: the released date in yearmonth format, e.g., `2507`.
31
+
32
+
33
+ ## Tokens & Tokenization
34
+
35
+ Tokens represent the fundamental units that models process and generate.
36
+ They can represent texts in human languages (regular tokens) or represent specific functionality like keywords in programming languages (control tokens [^special]).
37
+ Typically, a tokenizer is used to split text into regular tokens, which can be words, subwords, or characters depending on the specific tokenization scheme employed, and furnish the token sequence with control tokens as needed.
38
+ The vocabulary size, or the total number of unique tokens a model recognizes, significantly impacts its performance and versatility.
39
+ Larger language models often use sophisticated tokenization methods to handle the vast diversity of human language while keeping the vocabulary size manageable.
40
+ Qwen use a relatively large vocabulary of 151,646 tokens in total.
41
+
42
+ [^special]: Control tokens can be called special tokens. However, the meaning of special tokens need to be interpreted based on the contexts: special tokens may contain extra regular tokens.
43
+
44
+
45
+ ### Byte-level Byte Pair Encoding
46
+
47
+ Qwen adopts a subword tokenization method called Byte Pair Encoding (BPE), which attempts to learn the composition of tokens that can represent the text with the fewest tokens.
48
+ For example, the string ` tokenization` is decomposed as ` token` and `ization` (note that the space is part of the token).
49
+ Especially, the tokenization of Qwen ensures that there is no unknown words and all texts can be transformed to token sequences.
50
+
51
+ There are 151,643 tokens as a result of BPE in the vocabulary of Qwen, which is a large vocabulary efficient for diverse languages.
52
+ As a rule of thumb, 1 token is 3~4 characters for English texts and 1.5~1.8 characters for Chinese texts.
53
+
54
+ ### Control Tokens
55
+
56
+ Control tokens are special tokens inserted into the sequence that signifies meta information.
57
+ For example, in pre-training, multiple documents may be packed into a single sequence.
58
+ For Qwen, the control token `<|endoftext|>` is inserted after each document to signify that the document has ended and a new document will proceed.
59
+ Common control tokens and their status with respect to Qwen can be found in the following table:
60
+
61
+ | Type | Qwen (training) | Note |
62
+ | :-- | :-- | :-- |
63
+ | eod token | `<\|endoftext\|>` | end of document, which are inserted between documents inside a packed training sequence |
64
+ | bot token | `<\|im_start\|>` | start of each turn, which is prepended to each turn |
65
+ | eot token | `<\|im_end\|>` | end of each turn, which is appended to each turn |
66
+ | unk token | no unk token | BBPE ensures no unknown tokens for Qwen. |
67
+ | pad token | no pad token | Qwen does not make use of padded sequence in training. One could use any special token together with the attention masks returned by the tokenizer. It is commonly set the same as eod for Qwen. |
68
+ | bos token | no bos token | Qwen does not prepend a fixed token to each packed training sequence.[^boseos] |
69
+ | eos token | no eos token | Qwen does not append a fixed token to each packed training sequence. However, as most frameworks do not have the concept of eot and use eos instead for stopping criteria in inference, eos token is set to eot for Qwen.[^boseos] |
70
+
71
+ [^boseos]: bos token should not be set to `<\|im_start\|>` or you may see double bot tokens for the first turn in fine-tuning. eos token set to `<\|im_end\|>` is fine, because double eot tokens for the last turn are less harmful in fine-tuning.
72
+
73
+
74
+ ## Chat Template
75
+
76
+ Chat templates provide a structured format for conversational interactions, where predefined placeholders or prompts are used to elicit responses from the model that adhere to a desired dialogue flow or context.
77
+ Different models may use different kinds of chat template to format the conversations.
78
+ It is crucial to use the designated one to ensure the precise control over the LLM's generation process.
79
+
80
+ Qwen uses the following format (ChatML[^chatml]), making use of control tokens to format each turn in the conversations
81
+ ```text
82
+ <|im_start|>{{role}}
83
+ {{content}}<|im_end|>
84
+ ```
85
+ The user input takes the role of `user` and the model generation takes the role of `assistant`.
86
+ Qwen also supports the meta message that instruct the model to perform specific actions or generate text with certain characteristics, such as altering tone, style, or content, which takes the role of `system`.
87
+ Starting with Qwen3, no default system messages are used.
88
+
89
+ The following is a full example:
90
+ ```text
91
+ <|im_start|>system
92
+ You are a cat.<|im_end|>
93
+ <|im_start|>user
94
+ hello<|im_end|>
95
+ <|im_start|>assistant
96
+ *Meow~* Hello there! The sun is shining so brightly today, and I'm feeling extra fluffy. Did you bring me a treat? 🐾<|im_end|>
97
+ <|im_start|>user
98
+ Explain large language models like I'm 5.<|im_end|>
99
+ <|im_start|>assistant
100
+ *Paws at a toy, then looks up with curious eyes*
101
+
102
+ Hey there! 🐾 Imagine you have a super-smart robot friend who loves to talk and play. This robot has *gigantic* brainpower (like a million puzzle pieces all stuck together!) and knows *everything* about stories, animals, and even how to make up new words.
103
+
104
+ When you ask it a question, like “What’s a rainbow?” it uses its brain to find the answer and then *tells you* it in a way that makes sense. It can even help you write a story or solve a puzzle!
105
+
106
+ But here’s the magic: it’s not just a robot—it’s like a *super-duper* smart helper that learns more every day. It’s like having a friend who’s always curious and wants to help you explore the world! 🌟
107
+
108
+ *Meow~* Want to ask it something fun? 😺<|im_end|><|endoftext|>
109
+ ```
110
+
111
+ [^chatml]: For historical reference only, ChatML is first described by the OpenAI Python SDK. The last available version is [this](https://github.com/openai/openai-python/blob/v0.28.1/chatml.md). Please also be aware that that document lists use cases intended for OpenAI models. For Qwen2.5 models, please only use as in our guide.
112
+
113
+ ### Tool Calling
114
+
115
+ Qwen3 supports tool calling or function calling and uses a template akin to [Hermes](https://github.com/NousResearch/Hermes-Function-Calling#prompt-format-for-function-calling).
116
+
117
+ The template is as follows:
118
+ ```text
119
+ <|im_start|>system
120
+ # Tools
121
+
122
+ You may call one or more functions to assist with the user query.
123
+
124
+ You are provided with function signatures within <tools></tools> XML tags:
125
+ <tools>
126
+ {{JSON Schema of function 1}}
127
+ {{JSON Schema of function 2}}
128
+ </tools>
129
+
130
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
131
+ <tool_call>
132
+ {"name": <function-name>, "arguments": <args-json-object>}
133
+ </tool_call><|im_end|>
134
+ <|im_start|>user
135
+ {{user content}}<|im_end|>
136
+ <|im_start|>assistant
137
+ <tool_call>
138
+ {{tool call 1}}
139
+ </tool_call>
140
+ <tool_call>
141
+ {{tool call 2}}
142
+ </tool_call><|im_end|>
143
+ <|im_start|>user
144
+ <tool_response>
145
+ {{tool result 1}}
146
+ </tool_response>
147
+ <tool_response>
148
+ {{tool result 2}}
149
+ </tool_response><|im_end|>
150
+ <|im_start|>assistant
151
+ {{assistant content}}<|im_end|>
152
+ ```
153
+
154
+ It should be noted that
155
+ - The models support parallel tool calling and mulit-turn/multi-step tool calling.
156
+ - There may be additional content in assistant messages containing tool calls.
157
+ - The arguments field in the generated tool calls should be of type object instead of type string.
158
+ - Tool results are treated as special user messages.
159
+
160
+ In general, we recommend using the tokenizer to format the tool calls or let Qwen-Agent handle the formatting.
161
+
162
+ ### Thinking
163
+
164
+ Qwen3 supports thinking mode and uses a structured format for thinking content, which uses the `<think>` and `</think>` tokens to separate the thinking content from the regular response.
165
+ The template for the final round is as follows:
166
+
167
+ ```text
168
+ <|im_start|>user
169
+ {{user content}}<|im_end|>
170
+ <|im_start|>assistant
171
+ <think>
172
+ {{thinking content}}
173
+ </think>
174
+
175
+ {{assistant content}}<|im_end|>
176
+ ```
177
+
178
+ The thinking block should only be included in the final round except for multi-step tool calls.
179
+
180
+
181
+ ## Causal Language Models
182
+
183
+ Causal language models, also known as autoregressive language models or decoder-only language models, are a type of machine learning model designed to predict the next token in a sequence based on the preceding tokens.
184
+ In other words, they generate text one token at a time, using the previously generated tokens as context.
185
+ The "causal" aspect refers to the fact that the model only considers the past context (the already generated tokens) when predicting the next token, not any future tokens.
186
+
187
+ Causal language models are widely used for various natural language processing tasks involving text completion and generation.
188
+ They have been particularly successful in generating coherent and contextually relevant text, making them a cornerstone of modern natural language understanding and generation systems.
189
+
190
+ Qwen models are causal language models suitable for text completion.
191
+
192
+ ### Context Length
193
+
194
+ As Qwen models are causal language models, in theory there is only one length limit of the entire sequence.
195
+ However, since there is often packing in training and each sequence may contain multiple individual pieces of texts.
196
+ **How long the model can generate or complete ultimately depends on the use case and in that case how long each document (for pre-training) or each turn (for post-training) is in training.**
197
+
198
+ For Qwen3, the packed sequence length in pre-training is 32,768 tokens and may be extended to 131,072 tokens if mentioned in the modelcards.
199
+ The maximum length of the assistant message is 38,912 tokens for thinking modes and 16,384 tokens for non-thinking modes.
200
+
201
+ For Qwen3-2507, the packed sequence length in pre-training is 262,144 tokens and may be extended to 1M tokens.
202
+ The maximum length of the assistant message is 81,920 tokens for thinking models and 16,384 tokens for instruct models.
203
+
204
+ :::{tip}
205
+ In our testing, we find that the post-trained models could generate coherent content that is far longer than what is trained on, e.g., from 16,384 tokens to 32,768 tokens, especially for coding and similar tasks that have "clear rules".
206
+
207
+ In general, we advise that one should evaluate the quality of the generated content of different lengths before determining the optimal generation length.
208
+ :::
docs/source/getting_started/quantization_benchmark.rst ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Performance of Quantized Models
2
+ ==================================
3
+
4
+ .. attention::
5
+ To be updated for Qwen3.
6
+
7
+ This section reports the generation performance of quantized
8
+ models (including GPTQ and AWQ) of the Qwen2 series. Specifically, we
9
+ report:
10
+
11
+ * MMLU (Accuracy)
12
+ * C-Eval (Accuracy)
13
+ * IFEval (Strict Prompt-Level Accuracy)
14
+
15
+ We use greedy decoding in evaluating all models.
16
+
17
+ +---------------------+--------------+---------+-------+--------+--------+
18
+ | | Quantization | Average | MMLU | C-Eval | IFEval |
19
+ +=====================+==============+=========+=======+========+========+
20
+ | Qwen2-72B-Instruct | BF16 | 81.3 | 82.3 | 83.8 | 77.6 |
21
+ + +--------------+---------+-------+--------+--------+
22
+ | | GPTQ-Int8 | 80.7 | 81.3 | 83.4 | 77.5 |
23
+ + +--------------+---------+-------+--------+--------+
24
+ | | GPTQ-Int4 | 81.2 | 80.8 | 83.9 | 78.9 |
25
+ + +--------------+---------+-------+--------+--------+
26
+ | | AWQ | 80.4 | 80.5 | 83.9 | 76.9 |
27
+ +---------------------+--------------+---------+-------+--------+--------+
28
+ | Qwen2-7B-Instruct | BF16 | 66.9 | 70.5 | 77.2 | 53.1 |
29
+ + +--------------+---------+-------+--------+--------+
30
+ | | GPTQ-Int8 | 66.2 | 69.1 | 76.7 | 52.9 |
31
+ + +--------------+---------+-------+--------+--------+
32
+ | | GPTQ-Int4 | 64.1 | 67.8 | 75.2 | 49.4 |
33
+ + +--------------+---------+-------+--------+--------+
34
+ | | AWQ | 64.1 | 67.4 | 73.6 | 51.4 |
35
+ +---------------------+--------------+---------+-------+--------+--------+
36
+ | Qwen2-1.5B-Instruct | BF16 | 48.4 | 52.4 | 63.8 | 29.0 |
37
+ + +--------------+---------+-------+--------+--------+
38
+ | | GPTQ-Int8 | 48.1 | 53.0 | 62.5 | 28.8 |
39
+ + +--------------+---------+-------+--------+--------+
40
+ | | GPTQ-Int4 | 45.0 | 50.7 | 57.4 | 27.0 |
41
+ + +--------------+---------+-------+--------+--------+
42
+ | | AWQ | 46.5 | 51.6 | 58.1 | 29.9 |
43
+ +---------------------+--------------+---------+-------+--------+--------+
44
+ | Qwen2-0.5B-Instruct | BF16 | 34.4 | 37.9 | 45.2 | 20.0 |
45
+ + +--------------+---------+-------+--------+--------+
46
+ | | GPTQ-Int8 | 32.6 | 35.6 | 43.9 | 18.1 |
47
+ + +--------------+---------+-------+--------+--------+
48
+ | | GPTQ-Int4 | 29.7 | 33.0 | 39.2 | 16.8 |
49
+ + +--------------+---------+-------+--------+--------+
50
+ | | AWQ | 31.1 | 34.4 | 42.1 | 16.7 |
51
+ +---------------------+--------------+---------+-------+--------+--------+
52
+