Text Generation
Transformers
Safetensors
qwen3_next
qwen3
Mixture of Experts
int2
quantized
autoround
2-bit precision
conversational
2-bit
auto-round
Instructions to use YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound") 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("YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound") model = AutoModelForCausalLM.from_pretrained("YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound
- SGLang
How to use YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound 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 "YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound" \ --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": "YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound", "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 "YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound" \ --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": "YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound with Docker Model Runner:
docker model run hf.co/YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,96 +1,144 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
###
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
#
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
##
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
#
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)## Benchmark Results
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen3-Coder-Next
|
| 4 |
+
tags:
|
| 5 |
+
- qwen3
|
| 6 |
+
- moe
|
| 7 |
+
- int2
|
| 8 |
+
- quantized
|
| 9 |
+
- autoround
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
<p align="center">
|
| 15 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/685e122d50df66f41587d406/XU7ovrDdgsNFAzahuyvI1.png" alt="Tone">
|
| 16 |
+
</p>
|
| 17 |
+
|
| 18 |
+
语言 [中文](https://huggingface.co/YCWTG/Qwen3-Coder-Next-int2-mixed-AutoRound/blob/main/README_zh.md)|English
|
| 19 |
+
## Model Details
|
| 20 |
+
|
| 21 |
+
This model is an int2 model with group_size 512 and symmetric quantization of [Qwen/Qwen3-Coder-Next](https://huggingface.co/Qwen/Qwen3-Coder-Next) generated by [intel/auto-round](https://github.com/intel/auto-round). Please follow the license of the original model.
|
| 22 |
+
|
| 23 |
+
### Quantization Strategy (Intel MoE Recipe)
|
| 24 |
+
|
| 25 |
+
| Layer Type | Bits | Notes |
|
| 26 |
+
|------------|------|-------|
|
| 27 |
+
| Expert layers (512 experts) | 2-bit | MoE expert MLPs |
|
| 28 |
+
| Non-expert layers (attention, gate) | 16-bit | Higher precision for quality |
|
| 29 |
+
| shared_expert_gate | 16-bit | Skipped (shape not divisible by 32) |
|
| 30 |
+
| lm_head | Original | Excluded by AutoRound |
|
| 31 |
+
|
| 32 |
+
### MMLU-Pro
|
| 33 |
+
|
| 34 |
+
| Model | Accuracy | Delta |
|
| 35 |
+
|-------|----------|-------|
|
| 36 |
+
| BF16 | 52.90% | - |
|
| 37 |
+
| **W2A16** | **51.27%** | **-1.63%** |
|
| 38 |
+
|
| 39 |
+
## How to Use
|
| 40 |
+
|
| 41 |
+
### HF Usage
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 45 |
+
|
| 46 |
+
model_name = "YCWTG/Qwen3-Coder-Next-int2-AutoRound-best"
|
| 47 |
+
|
| 48 |
+
# load the tokenizer and the model
|
| 49 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 50 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
|
| 51 |
+
|
| 52 |
+
# prepare the model input
|
| 53 |
+
prompt = "Write a quick sort algorithm."
|
| 54 |
+
messages = [{"role": "user", "content": prompt}]
|
| 55 |
+
text = tokenizer.apply_chat_template(
|
| 56 |
+
messages,
|
| 57 |
+
tokenize=False,
|
| 58 |
+
add_generation_prompt=True,
|
| 59 |
+
)
|
| 60 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 61 |
+
|
| 62 |
+
# conduct text completion
|
| 63 |
+
generated_ids = model.generate(**model_inputs, max_new_tokens=65536)
|
| 64 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :].tolist()
|
| 65 |
+
|
| 66 |
+
content = tokenizer.decode(output_ids, skip_special_tokens=True)
|
| 67 |
+
|
| 68 |
+
print("content:", content)
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Generate the Model
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
from auto_round import AutoRound
|
| 77 |
+
|
| 78 |
+
model_name = "/home/ycwtg/PycharmProjects/MMLU-Pro/~/.cache/model/Qwen3-Coder-Next"
|
| 79 |
+
|
| 80 |
+
# Build layer config for mixed-bits (Intel recipe)
|
| 81 |
+
layer_config = {}
|
| 82 |
+
for i in range(48): # 48 layers
|
| 83 |
+
prefix = f"model.layers.{i}"
|
| 84 |
+
|
| 85 |
+
# Attention layers -> 8-bit
|
| 86 |
+
if i in [3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47]: # self_attn layers
|
| 87 |
+
for proj in ["q_proj", "k_proj", "v_proj", "o_proj"]:
|
| 88 |
+
layer_config[f"{prefix}.self_attn.{proj}"] = {"bits": 16}
|
| 89 |
+
else: # linear_attn layers
|
| 90 |
+
for proj in ["in_proj_qkvz", "in_proj_ba", "out_proj"]:
|
| 91 |
+
layer_config[f"{prefix}.linear_attn.{proj}"] = {"bits": 16}
|
| 92 |
+
|
| 93 |
+
# MLP gate -> 8-bit
|
| 94 |
+
layer_config[f"{prefix}.mlp.gate"] = {"bits": 16}
|
| 95 |
+
|
| 96 |
+
# shared_expert_gate -> 16-bit (skipped)
|
| 97 |
+
layer_config[f"{prefix}.mlp.shared_expert_gate"] = {"bits": 16}
|
| 98 |
+
|
| 99 |
+
autoround = AutoRound(
|
| 100 |
+
model_name,
|
| 101 |
+
bits=2, # Default for experts
|
| 102 |
+
group_size=128,
|
| 103 |
+
sym=True,
|
| 104 |
+
iters=1000,
|
| 105 |
+
nsamples=512,
|
| 106 |
+
lr=2e-3,
|
| 107 |
+
layer_config=layer_config,
|
| 108 |
+
low_gpu_mem_usage=True,
|
| 109 |
+
enable_alg_ext=True
|
| 110 |
+
)
|
| 111 |
+
output_dir="/home/ycwtg/PycharmProjects/MMLU-Pro/~/.cache/model/Qwen3-Coder-Next-int2-mixed-AutoRound"
|
| 112 |
+
autoround.quantize_and_save(output_dir,format="auto_round" )
|
| 113 |
+
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
## Ethical Considerations and Limitations
|
| 117 |
+
|
| 118 |
+
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
|
| 119 |
+
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
| 120 |
+
|
| 121 |
+
## Caveats and Recommendations
|
| 122 |
+
|
| 123 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
| 124 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
| 125 |
+
|
| 126 |
+
- [Intel Neural Compressor](https://github.com/intel/neural-compressor)
|
| 127 |
+
- [AutoRound](https://github.com/intel/auto-round)
|
| 128 |
+
|
| 129 |
+
## Disclaimer
|
| 130 |
+
|
| 131 |
+
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
|
| 132 |
+
|
| 133 |
+
## Cite
|
| 134 |
+
|
| 135 |
+
```
|
| 136 |
+
@article{cheng2023optimize,
|
| 137 |
+
title={Optimize weight rounding via signed gradient descent for the quantization of llms},
|
| 138 |
+
author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi},
|
| 139 |
+
journal={arXiv preprint arXiv:2309.05516},
|
| 140 |
+
year={2023}
|
| 141 |
+
}
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)## Benchmark Results
|