TechxGenus commited on
Commit
36755d6
·
verified ·
1 Parent(s): b7d515b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3-Coder-480B-A35B-Instruct/blob/main/LICENSE
5
+ pipeline_tag: text-generation
6
+ ---
7
+
8
+ AWQ quantized version of Qwen3-Coder-480B-A35B-Instruct model.
9
+
10
+ ---
11
+ # Qwen3-Coder-480B-A35B-Instruct
12
+ <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
13
+ <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;"/>
14
+ </a>
15
+ ## Highlights
16
+
17
+ Today, we're announcing **Qwen3-Coder**, our most agentic code model to date. **Qwen3-Coder** is available in multiple sizes, but we're excited to introduce its most powerful variant first: **Qwen3-Coder-480B-A35B-Instruct**. featuring the following key enhancements:
18
+
19
+ - **Significant Performance** among open models on **Agentic Coding**, **Agentic Browser-Use**, and other foundational coding tasks, achieving results comparable to Claude Sonnet.
20
+ - **Long-context Capabilities** with native support for **256K** tokens, extendable up to **1M** tokens using Yarn, optimized for repository-scale understanding.
21
+ - **Agentic Coding** supporting for most platform such as **Qwen Code**, **CLINE**, featuring a specially designed function call format.
22
+
23
+ ![image/jpeg](https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-Coder/qwen3-coder-main.jpg)
24
+
25
+ ## Model Overview
26
+
27
+ **Qwen3-480B-A35B-Instruct** has the following features:
28
+ - Type: Causal Language Models
29
+ - Training Stage: Pretraining & Post-training
30
+ - Number of Parameters: 480B in total and 35B activated
31
+ - Number of Layers: 62
32
+ - Number of Attention Heads (GQA): 96 for Q and 8 for KV
33
+ - Number of Experts: 160
34
+ - Number of Activated Experts: 8
35
+ - Context Length: **262,144 natively**.
36
+
37
+ **NOTE: This model supports only non-thinking mode and does not generate ``<think></think>`` blocks in its output. Meanwhile, specifying `enable_thinking=False` is no longer required.**
38
+ For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our [blog](https://qwenlm.github.io/blog/qwen3-coder/), [GitHub](https://github.com/QwenLM/Qwen3-Coder), and [Documentation](https://qwen.readthedocs.io/en/latest/).
39
+ ## Quickstart
40
+ We advise you to use the latest version of `transformers`.
41
+ With `transformers<4.51.0`, you will encounter the following error:
42
+ ```
43
+ KeyError: 'qwen3_moe'
44
+ ```
45
+ The following contains a code snippet illustrating how to use the model generate content based on given inputs.
46
+ ```python
47
+ from transformers import AutoModelForCausalLM, AutoTokenizer
48
+ model_name = "Qwen/Qwen3-480B-A35B-Instruct"
49
+ # load the tokenizer and the model
50
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
51
+ model = AutoModelForCausalLM.from_pretrained(
52
+ model_name,
53
+ torch_dtype="auto",
54
+ device_map="auto"
55
+ )
56
+ # prepare the model input
57
+ prompt = "Write a quick sort algorithm."
58
+ messages = [
59
+ {"role": "user", "content": prompt}
60
+ ]
61
+ text = tokenizer.apply_chat_template(
62
+ messages,
63
+ tokenize=False,
64
+ add_generation_prompt=True,
65
+ )
66
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
67
+ # conduct text completion
68
+ generated_ids = model.generate(
69
+ **model_inputs,
70
+ max_new_tokens=65536
71
+ )
72
+ output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
73
+ content = tokenizer.decode(output_ids, skip_special_tokens=True)
74
+
75
+ print("content:", content)
76
+ ```
77
+ **Note: If you encounter out-of-memory (OOM) issues, consider reducing the context length to a shorter value, such as `32,768`.**
78
+ For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
79
+ ## Agentic Coding
80
+ Qwen3-Coder excels in tool calling capabilities.
81
+ You can simply define or use any tools as following example.
82
+ ```python
83
+ # Your tool implementation
84
+ def square_the_number(num: float) -> dict:
85
+ return num ** 2
86
+ # Define Tools
87
+ tools=[
88
+ {
89
+ "type":"function",
90
+ "function":{
91
+ "name": "square_the_number",
92
+ "description": "output the square of the number.",
93
+ "parameters": {
94
+ "type": "object",
95
+ "required": ["input_num"],
96
+ "properties": {
97
+ 'input_num': {
98
+ 'type': 'number',
99
+ 'description': 'input_num is a number that will be squared'
100
+ }
101
+ },
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ import OpenAI
107
+ # Define LLM
108
+ client = OpenAI(
109
+ # Use a custom endpoint compatible with OpenAI API
110
+ base_url='http://localhost:8000/v1', # api_base
111
+ api_key="EMPTY"
112
+ )
113
+
114
+ messages = [{'role': 'user', 'content': 'square the number 1024'}]
115
+ completion = client.chat.completions.create(
116
+ messages=messages,
117
+ model="Qwen3-Coder-480B-A35B-Instruct",
118
+ max_tokens=65536,
119
+ tools=tools,
120
+ )
121
+ print(completion.choice[0])
122
+ ```
123
+ ## Best Practices
124
+ To achieve optimal performance, we recommend the following settings:
125
+ 1. **Sampling Parameters**:
126
+ - We suggest using `temperature=0.7`, `top_p=0.8`, `top_k=20`, `repetition_penalty=1.05`.
127
+ 2. **Adequate Output Length**: We recommend using an output length of 65,536 tokens for most queries, which is adequate for instruct models.
128
+ ### Citation
129
+ If you find our work helpful, feel free to give us a cite.
130
+ ```
131
+ @misc{qwen3technicalreport,
132
+ title={Qwen3 Technical Report},
133
+ author={Qwen Team},
134
+ year={2025},
135
+ eprint={2505.09388},
136
+ archivePrefix={arXiv},
137
+ primaryClass={cs.CL},
138
+ url={https://arxiv.org/abs/2505.09388},
139
+ }
140
+ ```