Instructions to use Qwen/Qwen3-Coder-480B-A35B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen3-Coder-480B-A35B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Qwen/Qwen3-Coder-480B-A35B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-Coder-480B-A35B-Instruct") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-Coder-480B-A35B-Instruct") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Qwen/Qwen3-Coder-480B-A35B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen3-Coder-480B-A35B-Instruct" # 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-Coder-480B-A35B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Qwen/Qwen3-Coder-480B-A35B-Instruct
- SGLang
How to use Qwen/Qwen3-Coder-480B-A35B-Instruct 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-Coder-480B-A35B-Instruct" \ --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-Coder-480B-A35B-Instruct", "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-Coder-480B-A35B-Instruct" \ --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-Coder-480B-A35B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Qwen/Qwen3-Coder-480B-A35B-Instruct with Docker Model Runner:
docker model run hf.co/Qwen/Qwen3-Coder-480B-A35B-Instruct
Update README.md
#5
by zhaochenyang20 - opened
README.md
CHANGED
|
@@ -39,14 +39,16 @@ For more details, including benchmark evaluation, hardware requirements, and inf
|
|
| 39 |
|
| 40 |
## Quickstart
|
| 41 |
|
| 42 |
-
We advise you to use the latest version of `transformers`.
|
| 43 |
|
| 44 |
With `transformers<4.51.0`, you will encounter the following error:
|
|
|
|
| 45 |
```
|
| 46 |
KeyError: 'qwen3_moe'
|
| 47 |
```
|
| 48 |
|
| 49 |
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
|
|
|
|
| 50 |
```python
|
| 51 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 52 |
|
|
@@ -84,6 +86,29 @@ content = tokenizer.decode(output_ids, skip_special_tokens=True)
|
|
| 84 |
print("content:", content)
|
| 85 |
```
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
**Note: If you encounter out-of-memory (OOM) issues, consider reducing the context length to a shorter value, such as `32,768`.**
|
| 88 |
|
| 89 |
For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
|
|
|
|
| 39 |
|
| 40 |
## Quickstart
|
| 41 |
|
| 42 |
+
We advise you to use the latest version of `transformers` and SGLang.
|
| 43 |
|
| 44 |
With `transformers<4.51.0`, you will encounter the following error:
|
| 45 |
+
|
| 46 |
```
|
| 47 |
KeyError: 'qwen3_moe'
|
| 48 |
```
|
| 49 |
|
| 50 |
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
|
| 51 |
+
|
| 52 |
```python
|
| 53 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 54 |
|
|
|
|
| 86 |
print("content:", content)
|
| 87 |
```
|
| 88 |
|
| 89 |
+
To serve Qwen3 model on 4/8xH100/200 GPUs with SGLang:
|
| 90 |
+
|
| 91 |
+
For the BF16 model:
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
python3 -m sglang.launch_server --model-path Qwen/Qwen3-Coder-480B-A35B --tp 8 --tool-call-parser qwen3
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
For FP8 model:
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
python3 -m sglang.launch_server --model-path Qwen/Qwen3-Coder-480B-A35B-FP8 --tp 4 --tool-call-parser qwen3
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
or
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
python3 -m sglang.launch_server --model-path Qwen/Qwen3-Coder-480B-A35B-FP8 --tp 8 --enable-ep-moe --tool-call-parser qwen3
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
* **FP8 models** : With --tp 8 Loading failure is expected; switch to expert-parallel mode using ```--enable-ep-moe```.
|
| 110 |
+
* **Tool call**: Add ```--tool-call-parser qwen3``` for tool call parser.
|
| 111 |
+
|
| 112 |
**Note: If you encounter out-of-memory (OOM) issues, consider reducing the context length to a shorter value, such as `32,768`.**
|
| 113 |
|
| 114 |
For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
|