---
title: Qwen3-235B-A22B-AWQ
canonical_url: "https://www.modelscope.cn/models/swift/Qwen3-235B-A22B-AWQ"
md_url: "https://www.modelscope.cn/models/swift/Qwen3-235B-A22B-AWQ.md"
repository: swift/Qwen3-235B-A22B-AWQ
last_updated: 2025-05-19
license: "Apache License 2.0"
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - qwen3_moe
architectures:
  - Qwen3MoeForCausalLM
base_model:
  - Qwen/Qwen3-235B-A22B
base_model_relation: quantized
parameters: 32.6B
tensor_type:
  - I32
  - F16
library_name:
  - pytorch
  - safetensors
frameworks:
  - Pytorch
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 11584
stars: 11
---

# Qwen3-235B-A22B-AWQ

> Qwen3-235B-A22B-AWQ - swift 在 ModelScope 开源的模型。The AWQ version is quantized using ms-swift. You may refer to our best practice for training/fine-tuning Qwen3-models here.

swift/Qwen3-235B-A22B-AWQ 是 ModelScope 魔搭社区上的 32.6B 参数text-generation模型，采用 Apache License 2.0 许可，基于 Qwen/Qwen3-235B-A22B 构建，可用 deploy_task text/emb、lmdeploy_turbomind 0.9.1、sglang 0.5.2 部署。

- **Repository**: swift/Qwen3-235B-A22B-AWQ
- **License**: Apache License 2.0
- **Tasks**: text-generation
- **Parameters**: 32.6B
- **Base model**: Qwen/Qwen3-235B-A22B
- **Inference backends**: deploy_task text/emb, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Downloads**: 11584
- **Stars**: 11
- **Last updated**: 2025-05-19

Source: https://www.modelscope.cn/models/swift/Qwen3-235B-A22B-AWQ

---

## Intro

The AWQ version is quantized using [ms-swift](https://github.com/modelscope/ms-swift). You may refer to our best practice for training/fine-tuning Qwen3-models [here](https://github.com/modelscope/ms-swift/issues/4030).

Note that the AWQ version for Qwen3-MoE models are verified to be working on Transformers/vLLM. We have not have the chance to tested them on other engines.

## Inference

```python
import torch
from modelscope import AutoModelForCausalLM, AutoTokenizer

model_name = "swift/Qwen3-235B-A22B-AWQ"

# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.float16,
    device_map="auto"
)

# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() 

# parsing thinking content
try:
    # rindex finding 151668 (</think>)
    index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
    index = 0

thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")

print("thinking content:", thinking_content)
print("content:", content)
```

## Quantization

The model has undergone AWQ int4 quantization using the [ms-swift](https://github.com/modelscope/ms-swift) framework. Since the model is based on the MoE (Mixture of Experts) architecture, all `linear` layers except for `gate` and `lm_head` have been quantized.

If you have fine-tuned the model and wish to quantize the fine-tuned version, you can refer to the following quantization scripts:

- Dense Model Quantization Script: [View Here](https://github.com/modelscope/ms-swift/blob/main/examples/export/quantize/awq.sh)
- MoE Model Quantization Script: [View Here](https://github.com/modelscope/ms-swift/blob/main/examples/export/quantize/moe/awq.sh)

With these scripts, you can easily complete the quantization process for the model.
