Text Generation
Transformers
Safetensors
qwen3
conversational
Eval Results
text-generation-inference
Instructions to use Qwen/Qwen3-32B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen3-32B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Qwen/Qwen3-32B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-32B") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-32B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- AMD Developer Cloud
- Local Apps Settings
- vLLM
How to use Qwen/Qwen3-32B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen3-32B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen3-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Qwen/Qwen3-32B
- SGLang
How to use Qwen/Qwen3-32B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Qwen/Qwen3-32B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen3-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Qwen/Qwen3-32B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen3-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Qwen/Qwen3-32B with Docker Model Runner:
docker model run hf.co/Qwen/Qwen3-32B
Update README.md
Browse files
README.md
CHANGED
|
@@ -202,7 +202,6 @@ Qwen3 excels in tool calling capabilities. We recommend using [Qwen-Agent](https
|
|
| 202 |
|
| 203 |
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.
|
| 204 |
```python
|
| 205 |
-
import os
|
| 206 |
from qwen_agent.agents import Assistant
|
| 207 |
|
| 208 |
# Define LLM
|
|
@@ -232,6 +231,10 @@ tools = [
|
|
| 232 |
'command': 'uvx',
|
| 233 |
'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
|
| 234 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
}
|
| 236 |
},
|
| 237 |
'code_interpreter', # Built-in tools
|
|
@@ -241,7 +244,7 @@ tools = [
|
|
| 241 |
bot = Assistant(llm=llm_cfg, function_list=tools)
|
| 242 |
|
| 243 |
# Streaming generation
|
| 244 |
-
messages = [{'role': 'user', 'content': '
|
| 245 |
for responses in bot.run(messages=messages):
|
| 246 |
pass
|
| 247 |
print(responses)
|
|
|
|
| 202 |
|
| 203 |
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.
|
| 204 |
```python
|
|
|
|
| 205 |
from qwen_agent.agents import Assistant
|
| 206 |
|
| 207 |
# Define LLM
|
|
|
|
| 231 |
'command': 'uvx',
|
| 232 |
'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
|
| 233 |
},
|
| 234 |
+
"fetch": {
|
| 235 |
+
"command": "uvx",
|
| 236 |
+
"args": ["mcp-server-fetch"]
|
| 237 |
+
}
|
| 238 |
}
|
| 239 |
},
|
| 240 |
'code_interpreter', # Built-in tools
|
|
|
|
| 244 |
bot = Assistant(llm=llm_cfg, function_list=tools)
|
| 245 |
|
| 246 |
# Streaming generation
|
| 247 |
+
messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
|
| 248 |
for responses in bot.run(messages=messages):
|
| 249 |
pass
|
| 250 |
print(responses)
|