Update README.md
Browse files
README.md
CHANGED
|
@@ -1,351 +1,152 @@
|
|
| 1 |
-
|
| 2 |
-
library_name: transformers
|
| 3 |
-
license: apache-2.0
|
| 4 |
-
license_link: https://huggingface.co/Qwen/Qwen3-32B/blob/main/LICENSE
|
| 5 |
-
pipeline_tag: text-generation
|
| 6 |
-
---
|
| 7 |
|
| 8 |
-
|
| 9 |
-
<a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
|
| 10 |
-
<img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
|
| 11 |
-
</a>
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
-
|
| 18 |
-
-
|
| 19 |
-
- **
|
| 20 |
-
- **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.
|
| 21 |
-
- **Support of 100+ languages and dialects** with strong capabilities for **multilingual instruction following** and **translation**.
|
| 22 |
|
| 23 |
-
##
|
| 24 |
|
| 25 |
-
|
| 26 |
-
- Type: Causal Language Models
|
| 27 |
-
- Training Stage: Pretraining & Post-training
|
| 28 |
-
- Number of Parameters: 32.8B
|
| 29 |
-
- Number of Paramaters (Non-Embedding): 31.2B
|
| 30 |
-
- Number of Layers: 64
|
| 31 |
-
- Number of Attention Heads (GQA): 64 for Q and 8 for KV
|
| 32 |
-
- Context Length: 32,768 natively and [131,072 tokens with YaRN](#processing-long-texts).
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
```
|
| 44 |
|
| 45 |
-
|
| 46 |
-
```python
|
| 47 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
model_name,
|
| 55 |
-
torch_dtype="auto",
|
| 56 |
-
device_map="auto"
|
| 57 |
-
)
|
| 58 |
|
| 59 |
-
#
|
| 60 |
-
prompt = "Give me a short introduction to large language model."
|
| 61 |
-
messages = [
|
| 62 |
-
{"role": "user", "content": prompt}
|
| 63 |
-
]
|
| 64 |
-
text = tokenizer.apply_chat_template(
|
| 65 |
-
messages,
|
| 66 |
-
tokenize=False,
|
| 67 |
-
add_generation_prompt=True,
|
| 68 |
-
enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
|
| 69 |
-
)
|
| 70 |
-
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
max_new_tokens=32768
|
| 76 |
-
)
|
| 77 |
-
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 78 |
|
| 79 |
-
#
|
| 80 |
-
try:
|
| 81 |
-
# rindex finding 151668 (</think>)
|
| 82 |
-
index = len(output_ids) - output_ids[::-1].index(151668)
|
| 83 |
-
except ValueError:
|
| 84 |
-
index = 0
|
| 85 |
|
| 86 |
-
|
| 87 |
-
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
-
- SGLang:
|
| 95 |
-
```shell
|
| 96 |
-
python -m sglang.launch_server --model-path Qwen/Qwen3-32B --reasoning-parser qwen3
|
| 97 |
-
```
|
| 98 |
-
- vLLM:
|
| 99 |
-
```shell
|
| 100 |
-
vllm serve Qwen/Qwen3-32B --enable-reasoning --reasoning-parser deepseek_r1
|
| 101 |
-
```
|
| 102 |
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
-
|
| 108 |
-
> The `enable_thinking` switch is also available in APIs created by SGLang and vLLM.
|
| 109 |
-
> Please refer to our documentation for [SGLang](https://qwen.readthedocs.io/en/latest/deployment/sglang.html#thinking-non-thinking-modes) and [vLLM](https://qwen.readthedocs.io/en/latest/deployment/vllm.html#thinking-non-thinking-modes) users.
|
| 110 |
|
| 111 |
-
###
|
| 112 |
|
| 113 |
-
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
```python
|
| 116 |
-
text = tokenizer.apply_chat_template(
|
| 117 |
-
messages,
|
| 118 |
-
tokenize=False,
|
| 119 |
-
add_generation_prompt=True,
|
| 120 |
-
enable_thinking=True # True is the default value for enable_thinking
|
| 121 |
-
)
|
| 122 |
```
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
> [!NOTE]
|
| 127 |
-
> 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](#best-practices) section.
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
We provide a hard switch to strictly disable the model's thinking behavior, aligning its functionality with the previous Qwen2.5-Instruct models. This mode is particularly useful in scenarios where disabling thinking is essential for enhancing efficiency.
|
| 133 |
-
|
| 134 |
-
```python
|
| 135 |
-
text = tokenizer.apply_chat_template(
|
| 136 |
-
messages,
|
| 137 |
-
tokenize=False,
|
| 138 |
-
add_generation_prompt=True,
|
| 139 |
-
enable_thinking=False # Setting enable_thinking=False disables thinking mode
|
| 140 |
-
)
|
| 141 |
```
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
> [!NOTE]
|
| 146 |
-
> For non-thinking mode, we suggest using `Temperature=0.7`, `TopP=0.8`, `TopK=20`, and `MinP=0`. For more detailed guidance, please refer to the [Best Practices](#best-practices) section.
|
| 147 |
-
|
| 148 |
-
### Advanced Usage: Switching Between Thinking and Non-Thinking Modes via User Input
|
| 149 |
-
|
| 150 |
-
We provide a soft switch mechanism that allows users to dynamically control the model's behavior when `enable_thinking=True`. Specifically, you can add `/think` and `/no_think` 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.
|
| 151 |
-
|
| 152 |
-
Here is an example of a multi-turn conversation:
|
| 153 |
-
|
| 154 |
-
```python
|
| 155 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 156 |
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
self.model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 161 |
-
self.history = []
|
| 162 |
-
|
| 163 |
-
def generate_response(self, user_input):
|
| 164 |
-
messages = self.history + [{"role": "user", "content": user_input}]
|
| 165 |
-
|
| 166 |
-
text = self.tokenizer.apply_chat_template(
|
| 167 |
-
messages,
|
| 168 |
-
tokenize=False,
|
| 169 |
-
add_generation_prompt=True
|
| 170 |
-
)
|
| 171 |
-
|
| 172 |
-
inputs = self.tokenizer(text, return_tensors="pt")
|
| 173 |
-
response_ids = self.model.generate(**inputs, max_new_tokens=32768)[0][len(inputs.input_ids[0]):].tolist()
|
| 174 |
-
response = self.tokenizer.decode(response_ids, skip_special_tokens=True)
|
| 175 |
-
|
| 176 |
-
# Update history
|
| 177 |
-
self.history.append({"role": "user", "content": user_input})
|
| 178 |
-
self.history.append({"role": "assistant", "content": response})
|
| 179 |
-
|
| 180 |
-
return response
|
| 181 |
-
|
| 182 |
-
# Example Usage
|
| 183 |
-
if __name__ == "__main__":
|
| 184 |
-
chatbot = QwenChatbot()
|
| 185 |
-
|
| 186 |
-
# First input (without /think or /no_think tags, thinking mode is enabled by default)
|
| 187 |
-
user_input_1 = "How many r's in strawberries?"
|
| 188 |
-
print(f"User: {user_input_1}")
|
| 189 |
-
response_1 = chatbot.generate_response(user_input_1)
|
| 190 |
-
print(f"Bot: {response_1}")
|
| 191 |
-
print("----------------------")
|
| 192 |
-
|
| 193 |
-
# Second input with /no_think
|
| 194 |
-
user_input_2 = "Then, how many r's in blueberries? /no_think"
|
| 195 |
-
print(f"User: {user_input_2}")
|
| 196 |
-
response_2 = chatbot.generate_response(user_input_2)
|
| 197 |
-
print(f"Bot: {response_2}")
|
| 198 |
-
print("----------------------")
|
| 199 |
-
|
| 200 |
-
# Third input with /think
|
| 201 |
-
user_input_3 = "Really? /think"
|
| 202 |
-
print(f"User: {user_input_3}")
|
| 203 |
-
response_3 = chatbot.generate_response(user_input_3)
|
| 204 |
-
print(f"Bot: {response_3}")
|
| 205 |
```
|
| 206 |
|
| 207 |
-
|
| 208 |
-
> For API compatibility, when `enable_thinking=True`, regardless of whether the user uses `/think` or `/no_think`, the model will always output a block wrapped in `<think>...</think>`. However, the content inside this block may be empty if thinking is disabled.
|
| 209 |
-
> When `enable_thinking=False`, the soft switches are not valid. Regardless of any `/think` or `/no_think` tags input by the user, the model will not generate think content and will not include a `<think>...</think>` block.
|
| 210 |
-
|
| 211 |
-
## Agentic Use
|
| 212 |
-
|
| 213 |
-
Qwen3 excels in tool calling capabilities. We recommend using [Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) to make the best use of agentic ability of Qwen3. Qwen-Agent encapsulates tool-calling templates and tool-calling parsers internally, greatly reducing coding complexity.
|
| 214 |
-
|
| 215 |
-
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.
|
| 216 |
-
```python
|
| 217 |
-
from qwen_agent.agents import Assistant
|
| 218 |
-
|
| 219 |
-
# Define LLM
|
| 220 |
-
llm_cfg = {
|
| 221 |
-
'model': 'Qwen3-32B',
|
| 222 |
-
|
| 223 |
-
# Use the endpoint provided by Alibaba Model Studio:
|
| 224 |
-
# 'model_type': 'qwen_dashscope',
|
| 225 |
-
# 'api_key': os.getenv('DASHSCOPE_API_KEY'),
|
| 226 |
-
|
| 227 |
-
# Use a custom endpoint compatible with OpenAI API:
|
| 228 |
-
'model_server': 'http://localhost:8000/v1', # api_base
|
| 229 |
-
'api_key': 'EMPTY',
|
| 230 |
-
|
| 231 |
-
# Other parameters:
|
| 232 |
-
# 'generate_cfg': {
|
| 233 |
-
# # Add: When the response content is `<think>this is the thought</think>this is the answer;
|
| 234 |
-
# # Do not add: When the response has been separated by reasoning_content and content.
|
| 235 |
-
# 'thought_in_content': True,
|
| 236 |
-
# },
|
| 237 |
-
}
|
| 238 |
-
|
| 239 |
-
# Define Tools
|
| 240 |
-
tools = [
|
| 241 |
-
{'mcpServers': { # You can specify the MCP configuration file
|
| 242 |
-
'time': {
|
| 243 |
-
'command': 'uvx',
|
| 244 |
-
'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
|
| 245 |
-
},
|
| 246 |
-
"fetch": {
|
| 247 |
-
"command": "uvx",
|
| 248 |
-
"args": ["mcp-server-fetch"]
|
| 249 |
-
}
|
| 250 |
-
}
|
| 251 |
-
},
|
| 252 |
-
'code_interpreter', # Built-in tools
|
| 253 |
-
]
|
| 254 |
|
| 255 |
-
|
| 256 |
-
|
| 257 |
|
| 258 |
-
# Streaming generation
|
| 259 |
-
messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
|
| 260 |
-
for responses in bot.run(messages=messages):
|
| 261 |
-
pass
|
| 262 |
-
print(responses)
|
| 263 |
```
|
| 264 |
|
| 265 |
-
## Processing Long Texts
|
| 266 |
-
|
| 267 |
-
Qwen3 natively supports context lengths of up to 32,768 tokens. For conversations where the total length (including both input and output) significantly exceeds this limit, we recommend using RoPE scaling techniques to handle long texts effectively. We have validated the model's performance on context lengths of up to 131,072 tokens using the [YaRN](https://arxiv.org/abs/2309.00071) method.
|
| 268 |
-
|
| 269 |
-
YaRN is currently supported by several inference frameworks, e.g., `transformers` and `llama.cpp` for local use, `vllm` and `sglang` for deployment. In general, there are two approaches to enabling YaRN for supported frameworks:
|
| 270 |
|
| 271 |
-
|
| 272 |
-
In the `config.json` file, add the `rope_scaling` fields:
|
| 273 |
-
```json
|
| 274 |
-
{
|
| 275 |
-
...,
|
| 276 |
-
"rope_scaling": {
|
| 277 |
-
"rope_type": "yarn",
|
| 278 |
-
"factor": 4.0,
|
| 279 |
-
"original_max_position_embeddings": 32768
|
| 280 |
-
}
|
| 281 |
-
}
|
| 282 |
-
```
|
| 283 |
-
For `llama.cpp`, you need to regenerate the GGUF file after the modification.
|
| 284 |
|
| 285 |
-
-
|
| 286 |
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
|
| 297 |
-
|
| 298 |
-
```shell
|
| 299 |
-
llama-server ... --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 32768
|
| 300 |
-
```
|
| 301 |
|
| 302 |
-
|
| 303 |
-
> If you encounter the following warning
|
| 304 |
-
> ```
|
| 305 |
-
> Unrecognized keys in `rope_scaling` for 'rope_type'='yarn': {'original_max_position_embeddings'}
|
| 306 |
-
> ```
|
| 307 |
-
> please upgrade `transformers>=4.51.0`.
|
| 308 |
|
| 309 |
-
|
| 310 |
-
> All the notable open-source frameworks implement static YaRN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts.**
|
| 311 |
-
> We advise adding the `rope_scaling` configuration only when processing long contexts is required.
|
| 312 |
-
> 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.
|
| 313 |
|
| 314 |
-
|
| 315 |
-
|
|
|
|
| 316 |
|
| 317 |
-
|
| 318 |
-
> The endpoint provided by Alibaba Model Studio supports dynamic YaRN by default and no extra configuration is needed.
|
| 319 |
|
| 320 |
-
|
|
|
|
|
|
|
|
|
|
| 321 |
|
| 322 |
-
|
| 323 |
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
|
| 329 |
-
|
| 330 |
|
| 331 |
-
|
| 332 |
-
- **Math Problems**: Include "Please reason step by step, and put your final answer within \boxed{}." in the prompt.
|
| 333 |
-
- **Multiple-Choice Questions**: Add the following JSON structure to the prompt to standardize responses: "Please show your choice in the `answer` field with only the choice letter, e.g., `"answer": "C"`."
|
| 334 |
|
| 335 |
-
|
|
|
|
|
|
|
|
|
|
| 336 |
|
| 337 |
-
### Citation
|
| 338 |
|
| 339 |
-
|
| 340 |
|
| 341 |
-
|
| 342 |
-
@misc{qwen3technicalreport,
|
| 343 |
-
title={Qwen3 Technical Report},
|
| 344 |
-
author={Qwen Team},
|
| 345 |
-
year={2025},
|
| 346 |
-
eprint={2505.09388},
|
| 347 |
-
archivePrefix={arXiv},
|
| 348 |
-
primaryClass={cs.CL},
|
| 349 |
-
url={https://arxiv.org/abs/2505.09388},
|
| 350 |
-
}
|
| 351 |
-
```
|
|
|
|
| 1 |
+
# Introduction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
**FlagOS** is a unified heterogeneous computing software stack for large models, co-developed with leading global chip manufacturers. With core technologies such as the **FlagScale** distributed training/inference framework, **FlagGems** universal operator library, **FlagCX** communication library, and **FlagTree** unified compiler, the **FlagRelease** platform leverages the FlagOS stack to automatically produce and release various combinations of <chip + open-source model>. This enables efficient and automated model migration across diverse chips, opening a new chapter for large model deployment and application.
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
Based on this, the **Qwen3-32B-FlagOS** model is adapted for the Nvidia chip using the FlagOS software stack, enabling:
|
| 6 |
|
| 7 |
+
### Integrated Deployment
|
| 8 |
|
| 9 |
+
- Deep integration with the open-source [FlagScale framework](https://github.com/FlagOpen/FlagScale)
|
| 10 |
+
- Out-of-the-box inference scripts with pre-configured hardware and software parameters
|
| 11 |
+
- Released **FlagOS** container image supporting deployment within minutes
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
### Consistency Validation
|
| 14 |
|
| 15 |
+
- Rigorously evaluated through benchmark testing: Performance and results from the FlagOS software stack are compared against native stacks on multiple public.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Technical Overview
|
| 18 |
|
| 19 |
+
## **FlagScale Distributed Training and Inference Framework**
|
| 20 |
|
| 21 |
+
FlagScale is an end-to-end framework for large models across heterogeneous computing resources, maximizing computational efficiency and ensuring model validity through core technologies. Its key advantages include:
|
| 22 |
|
| 23 |
+
- **Unified Deployment Interface:** Standardized command-line tools support one-click service deployment across multiple hardware platforms, significantly reducing adaptation costs in heterogeneous environments.
|
| 24 |
+
- **Intelligent Parallel Optimization:** Automatically generates optimal distributed parallel strategies based on chip computing characteristics, achieving dynamic load balancing of computation/communication resources.
|
| 25 |
+
- **Seamless Operator Switching:** Deep integration with the FlagGems operator library allows high-performance operators to be invoked via environment variables without modifying model code.
|
|
|
|
| 26 |
|
| 27 |
+
## **FlagGems Universal Large-Model Operator Library**
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
FlagGems is a Triton-based, cross-architecture operator library collaboratively developed with industry partners. Its core strengths include:
|
| 30 |
|
| 31 |
+
- **Full-stack Coverage**: Over 100 operators, with a broader range of operator types than competing libraries.
|
| 32 |
+
- **Ecosystem Compatibility**: Supports 7 accelerator backends. Ongoing optimizations have significantly improved performance.
|
| 33 |
+
- **High Efficiency**: Employs unique code generation and runtime optimization techniques for faster secondary development and better runtime performance compared to alternatives.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
## **FlagEval Evaluation Framework**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
FlagEval (Libra)** is a comprehensive evaluation system and open platform for large models launched in 2023. It aims to establish scientific, fair, and open benchmarks, methodologies, and tools to help researchers assess model and training algorithm performance. It features:
|
| 38 |
+
- **Multi-dimensional Evaluation**: Supports 800+ model evaluations across NLP, CV, Audio, and Multimodal fields, covering 20+ downstream tasks including language understanding and image-text generation.
|
| 39 |
+
- **Industry-Grade Use Cases**: Has completed horizontal evaluations of mainstream large models, providing authoritative benchmarks for chip-model performance validation.
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
# Evaluation Results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
## Benchmark Result
|
|
|
|
| 44 |
|
| 45 |
+
| Metrics | Qwen3-32B-H100-CUDA | Qwen3-32B-FlagOS |
|
| 46 |
+
|-------------------|--------------------------|-----------------------------|
|
| 47 |
+
| AIME_0fewshot_@avg1 | 0.800 | 0.800 |
|
| 48 |
+
| GPQA_0fewshot_@avg1 | 0.608 | 0.612 |
|
| 49 |
+
| LiveBench-0fewshot_@avg1 | 0.591 | 0.568 |
|
| 50 |
+
| MMLU_5fewshot_@avg1 | 0.770 | 0.769 |
|
| 51 |
+
| MUSR_0fewshot_@avg | 0.644 | 0.673 |
|
| 52 |
|
| 53 |
+
# User Guide
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
**Environment Setup**
|
| 56 |
|
| 57 |
+
| Item | Version |
|
| 58 |
+
| ------------- | ------------------------------------------------------------ |
|
| 59 |
+
| Docker Version | Docker version 28.1.0, build 4d8c241 |
|
| 60 |
+
| Operating System | Ubuntu 22.04.5 LTS |
|
| 61 |
+
| FlagScale | Version: 0.8.0 |
|
| 62 |
+
| FlagGems | Version: 3.0 |
|
| 63 |
|
| 64 |
+
## Operation Steps
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
### Download Open-source Model Weights
|
| 67 |
|
| 68 |
+
```bash
|
| 69 |
+
pip install modelscope
|
| 70 |
+
modelscope download --model Qwen/Qwen3-32B --local_dir /share/Qwen3-32B
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
```
|
| 73 |
|
| 74 |
+
### Download FlagOS Image
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
+
```bash
|
| 77 |
+
docker pull harbor.baai.ac.cn/flagrelease-public/flagrelease_nvidia_qwen3sgl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
+
### Start the inference service
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
+
```bash
|
| 83 |
+
#Container Startup
|
| 84 |
+
docker run --rm --init --detach --net=host --uts=host --ipc=host --security-opt=seccomp=unconfined --privileged=true --ulimit stack=67108864 --ulimit memlock=-1 --ulimit nofile=1048576:1048576 --shm-size=32G -v /share:/share --gpus all --name flagos harbor.baai.ac.cn/flagrelease-public/flagrelease_nvidia_qwen3sgl sleep infinity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
```
|
| 86 |
|
| 87 |
+
### Serve
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
```bash
|
| 90 |
+
flagscale serve qwen3_next
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
```
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
+
## Service Invocation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
+
### API-based Invocation Script
|
| 98 |
|
| 99 |
+
```bash
|
| 100 |
+
import openai
|
| 101 |
+
openai.api_key = "EMPTY"
|
| 102 |
+
openai.base_url = "http://<server_ip>:9010/v1/"
|
| 103 |
+
model = "Qwen3-32B-nvidia-flagos"
|
| 104 |
+
messages = [
|
| 105 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 106 |
+
{"role": "user", "content": "What's the weather like today?"}
|
| 107 |
+
]
|
| 108 |
+
response = openai.chat.completions.create(
|
| 109 |
+
model=model,
|
| 110 |
+
messages=messages,
|
| 111 |
+
stream=False,
|
| 112 |
+
)
|
| 113 |
+
for item in response:
|
| 114 |
+
print(item)
|
| 115 |
|
| 116 |
+
```
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
### AnythingLLM Integration Guide
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
#### 1. Download & Install
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
+
- Visit the official site: https://anythingllm.com/
|
| 123 |
+
- Choose the appropriate version for your OS (Windows/macOS/Linux)
|
| 124 |
+
- Follow the installation wizard to complete the setup
|
| 125 |
|
| 126 |
+
#### 2. Configuration
|
|
|
|
| 127 |
|
| 128 |
+
- Launch AnythingLLM
|
| 129 |
+
- Open settings (bottom left, fourth tab)
|
| 130 |
+
- Configure core LLM parameters
|
| 131 |
+
- Click "Save Settings" to apply changes
|
| 132 |
|
| 133 |
+
#### 3. Model Interaction
|
| 134 |
|
| 135 |
+
- After model loading is complete:
|
| 136 |
+
- Click **"New Conversation"**
|
| 137 |
+
- Enter your question (e.g., “Explain the basics of quantum computing”)
|
| 138 |
+
- Click the send button to get a response
|
| 139 |
|
| 140 |
+
# Contributing
|
| 141 |
|
| 142 |
+
We warmly welcome global developers to join us:
|
|
|
|
|
|
|
| 143 |
|
| 144 |
+
1. Submit Issues to report problems
|
| 145 |
+
2. Create Pull Requests to contribute code
|
| 146 |
+
3. Improve technical documentation
|
| 147 |
+
4. Expand hardware adaptation support
|
| 148 |
|
|
|
|
| 149 |
|
| 150 |
+
# License
|
| 151 |
|
| 152 |
+
本模型的权重来源于Qwen/Qwen3-32B,以apache2.0协议https://www.apache.org/licenses/LICENSE-2.0.txt开源。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|