dtometzki commited on
Commit
cf92b27
·
verified ·
1 Parent(s): 3d12532

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +141 -0
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
+ ```