Text Generation
Transformers
Safetensors
English
Chinese
qwen3_moe
quantization
w4a16
mxfp4
fp4
compressed-tensors
llmcompressor
conversational
8-bit precision
Instructions to use dtometzki/Qwen3-30B-A3B-MXFP4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dtometzki/Qwen3-30B-A3B-MXFP4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dtometzki/Qwen3-30B-A3B-MXFP4A16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dtometzki/Qwen3-30B-A3B-MXFP4A16") model = AutoModelForCausalLM.from_pretrained("dtometzki/Qwen3-30B-A3B-MXFP4A16", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dtometzki/Qwen3-30B-A3B-MXFP4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dtometzki/Qwen3-30B-A3B-MXFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dtometzki/Qwen3-30B-A3B-MXFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dtometzki/Qwen3-30B-A3B-MXFP4A16
- SGLang
How to use dtometzki/Qwen3-30B-A3B-MXFP4A16 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 "dtometzki/Qwen3-30B-A3B-MXFP4A16" \ --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": "dtometzki/Qwen3-30B-A3B-MXFP4A16", "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 "dtometzki/Qwen3-30B-A3B-MXFP4A16" \ --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": "dtometzki/Qwen3-30B-A3B-MXFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dtometzki/Qwen3-30B-A3B-MXFP4A16 with Docker Model Runner:
docker model run hf.co/dtometzki/Qwen3-30B-A3B-MXFP4A16
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen3-30B-A3B
|
| 3 |
+
model_name: Qwen3-30B-A3B-MXFP4A16
|
| 4 |
+
library_name: transformers
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
- zh
|
| 9 |
+
tags:
|
| 10 |
+
- quantization
|
| 11 |
+
- w4a16
|
| 12 |
+
- mxfp4
|
| 13 |
+
- fp4
|
| 14 |
+
- compressed-tensors
|
| 15 |
+
- llmcompressor
|
| 16 |
+
- text-generation
|
| 17 |
+
- safetensors
|
| 18 |
+
pipeline_tag: text-generation
|
| 19 |
+
inference: false
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
```markdown
|
| 23 |
+
---
|
| 24 |
+
base_model: Qwen/Qwen3-30B-A3B
|
| 25 |
+
library_name: transformers
|
| 26 |
+
tags:
|
| 27 |
+
- quantization
|
| 28 |
+
- mxfp4
|
| 29 |
+
- 4-bit
|
| 30 |
+
- compressed-tensors
|
| 31 |
+
- qwen
|
| 32 |
+
- text-generation
|
| 33 |
+
- llmcompressor
|
| 34 |
+
language:
|
| 35 |
+
- en
|
| 36 |
+
pipeline_tag: text-generation
|
| 37 |
+
license: other
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
# Qwen3-30B-A3B-MXFP4A16
|
| 41 |
+
|
| 42 |
+
## Model Description
|
| 43 |
+
|
| 44 |
+
This is a compressed version of **[Qwen/Qwen3-30B-A3B](https://huggingface.co/Qwen/Qwen3-30B-A3B)**.
|
| 45 |
+
|
| 46 |
+
The model was quantized using **Weight-Only Quantization** to **4-bit Floating Point (FP4)** using the **MXFP4** scaling scheme. This format is optimized for next-generation hardware (like NVIDIA Blackwell) but also runs efficiently on current GPUs using software emulation.
|
| 47 |
+
|
| 48 |
+
By using `MXFP4A16` (Microscaling FP4 weights with FP16 activations), this model achieves a massive reduction in size (approx. 70-75%) while maintaining high accuracy, especially for weights distributed around zero, compared to standard INT4 quantization.
|
| 49 |
+
|
| 50 |
+
## Quantization Details
|
| 51 |
+
|
| 52 |
+
This model was created using the `llmcompressor` library with the following configuration:
|
| 53 |
+
|
| 54 |
+
* **Scheme:** `MXFP4A16` (4-bit Weights, 16-bit Activations)
|
| 55 |
+
* **Algorithm:** Weight-Only Quantization (Data-Free)
|
| 56 |
+
* **Target Modules:** Linear Layers
|
| 57 |
+
* **Ignored Modules:** `lm_head` (kept in full precision for stability)
|
| 58 |
+
* **Group Size:** 32 (Block-wise scaling)
|
| 59 |
+
|
| 60 |
+
## Installation
|
| 61 |
+
|
| 62 |
+
You need to install `vllm` or `llmcompressor` to use this model efficiently.
|
| 63 |
+
|
| 64 |
+
```bash
|
| 65 |
+
pip install vllm
|
| 66 |
+
# or
|
| 67 |
+
pip install llmcompressor
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Quickstart
|
| 72 |
+
|
| 73 |
+
### Using vLLM (Recommended)
|
| 74 |
+
|
| 75 |
+
This model is optimized for vLLM, which supports the `compressed-tensors` format natively.
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from vllm import LLM, SamplingParams
|
| 79 |
+
|
| 80 |
+
model_id = "DEIN_USERNAME/Qwen3-30B-A3B-MXFP4A16"
|
| 81 |
+
|
| 82 |
+
llm = LLM(
|
| 83 |
+
model=model_id,
|
| 84 |
+
trust_remote_code=True
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
sampling_params = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=200)
|
| 88 |
+
|
| 89 |
+
prompts = [
|
| 90 |
+
"Hello, my name is",
|
| 91 |
+
"Explain quantum physics in simple terms:",
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
outputs = llm.generate(prompts, sampling_params)
|
| 95 |
+
|
| 96 |
+
for output in outputs:
|
| 97 |
+
prompt = output.prompt
|
| 98 |
+
generated_text = output.outputs[0].text
|
| 99 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
| 100 |
+
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### Using Transformers & LLMCompressor
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 107 |
+
from llmcompressor.utils import dispatch_for_generation
|
| 108 |
+
|
| 109 |
+
model_id = "DEIN_USERNAME/Qwen3-30B-A3B-MXFP4A16"
|
| 110 |
+
|
| 111 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 112 |
+
model_id,
|
| 113 |
+
device_map="auto",
|
| 114 |
+
trust_remote_code=True
|
| 115 |
+
)
|
| 116 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 117 |
+
|
| 118 |
+
# Optimize model for generation
|
| 119 |
+
dispatch_for_generation(model)
|
| 120 |
+
|
| 121 |
+
input_ids = tokenizer("Hello my name is", return_tensors="pt").input_ids.to(model.device)
|
| 122 |
+
output = model.generate(input_ids, max_new_tokens=100)
|
| 123 |
+
|
| 124 |
+
print(tokenizer.decode(output[0]))
|
| 125 |
+
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
## Hardware Requirements
|
| 129 |
+
|
| 130 |
+
* **VRAM:** Significantly reduced compared to the BF16 original.
|
| 131 |
+
* *Original (30B):* ~60 GB VRAM
|
| 132 |
+
* *Quantized (MXFP4):* ~17 GB VRAM
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
* **Compatibility:** Runs on NVIDIA GPUs (Ampere/Ada Lovelace/Hopper/Blackwell).
|
| 136 |
+
|
| 137 |
+
---
|
| 138 |
+
|
| 139 |
+
*Created with [llmcompressor*](https://www.google.com/search?q=https://github.com/neuralmagic/llm-compressor)
|
| 140 |
+
|
| 141 |
+
```
|