bash99 commited on
Commit
973c793
·
verified ·
1 Parent(s): 148d629

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +90 -0
README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: text-generation
4
+ tags:
5
+ - fp8
6
+ - quantized
7
+ - llm-compressor
8
+ - compressed-tensors
9
+ base_model:
10
+ - Qwen/Qwen3-30B-A3B-Instruct-2507
11
+ ---
12
+
13
+
14
+ # Qwen3-30B-A3B-Instruct-2507-FP8-dynamic
15
+
16
+ ## Model Overview
17
+ - **Model Architecture:** Qwen3MoeForCausalLM
18
+ - **Input:** Text
19
+ - **Output:** Text
20
+ - **Model Optimizations:**
21
+ - **Activation quantization:** FP8
22
+ - **Weight quantization:** FP8
23
+ - **Intended Use Cases:**
24
+ - Function calling.
25
+ - Subject matter experts via fine-tuning.
26
+ - Multilingual instruction following.
27
+ - Translation.
28
+
29
+ Quantized version of [Qwen/Qwen3-30B-A3B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507).
30
+
31
+ ### Model Optimizations
32
+
33
+ This model was obtained by quantizing the weights and activations of [Qwen/Qwen3-30B-A3B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507) to FP8 data type.
34
+ This optimization reduces the number of bits per parameter from 16 to 8, reducing the disk size and GPU memory requirements by approximately 50%.
35
+ Only the weights and activations of the linear operators within transformers blocks of the language model are quantized.
36
+
37
+ It's running faster than [Qwen/Qwen3-30B-A3B-Instruct-2507-FP8](https://huggingface.co/Qwen/Qwen3-30B-A3B-Instruct-2507-FP8) in vLLM/sglang in 4090 or H100, with no diffrence on most benchmarks.
38
+
39
+ ## Deployment
40
+
41
+ ### Use with vLLM
42
+
43
+ ```
44
+ vllm serve bash99/Qwen3-30B-A3B-Instruct-2507-FP8-Dynamic --tensor_parallel_size 2
45
+ ```
46
+
47
+
48
+ ## Creation
49
+
50
+ This model was quantized using the [llm-compressor](https://github.com/vllm-project/llm-compressor) library as shown below.
51
+
52
+ <details>
53
+ <summary>Creation details</summary>
54
+
55
+ ```quantize_tofp8.py
56
+ from transformers import AutoProcessor, AutoModelForCausalLM, AutoTokenizer
57
+ from llmcompressor import oneshot
58
+ from llmcompressor.modifiers.quantization import QuantizationModifier
59
+ import sys
60
+
61
+ MODEL_ID = sys.argv[1]
62
+
63
+ # Load model.
64
+ model = AutoModelForCausalLM.from_pretrained(
65
+ MODEL_ID, device_map="auto", torch_dtype="auto"
66
+ )
67
+ processor = AutoProcessor.from_pretrained(MODEL_ID)
68
+
69
+ # Configure the quantization algorithm and scheme.
70
+ # In this case, we:
71
+ # * quantize the weights to fp8 with per channel via ptq
72
+ # * quantize the activations to fp8 with dynamic per token
73
+ recipe = QuantizationModifier(targets="Linear",scheme="FP8_DYNAMIC",
74
+ ignore=["re:.*lm_head", "re:visual.*", 're:.*mlp.gate$', 're:.*mlp.shared_expert_gate$', 're:.*router$']
75
+ )
76
+
77
+ # Apply quantization and save to disk in compressed-tensors format.
78
+ SAVE_DIR = MODEL_ID + "-FP8-Dynamic"
79
+
80
+ oneshot(model=model, recipe=recipe, output_dir=SAVE_DIR)
81
+ processor.save_pretrained(SAVE_DIR)
82
+
83
+ print(f"========== quantizeing to {SAVE_DIR}, done ==============")
84
+ ```
85
+
86
+ ```
87
+ python quantize_tofp8.py Qwen/Qwen3-30B-A3B-Instruct-2507-FP8
88
+ ```
89
+
90
+ </details>