Vishva007 commited on
Commit
b3bb4eb
·
verified ·
1 Parent(s): 5f53f83

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +98 -0
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: google/gemma-4-12B-it
4
+ tags:
5
+ - multimodal
6
+ - vision
7
+ - audio
8
+ - quantization
9
+ - autoround
10
+ - vllm
11
+ - tensor_type:q4
12
+ ---
13
+
14
+ # Gemma 4 12B IT - W4A16 AutoRound Quantized Variants
15
+
16
+ This repository hosts 4-bit weight, 16-bit activation (W4A16) quantized variants of **google/gemma-4-12B-it**. The models were quantized using Intel's AutoRound framework tailored specifically for the architectural requirements of the Gemma 4 family.
17
+
18
+ Available formats in the series:
19
+ * `Vishva007/gemma-4-12B-it-W4A16-AutoRound` (Standard AutoRound format)
20
+ * `Vishva007/gemma-4-12B-it-W4A16-AutoRound-AWQ` (AWQ format conversion)
21
+ * `Vishva007/gemma-4-12B-it-W4A16-AutoRound-GPTQ` (GPTQ format conversion)
22
+
23
+ ## Architectural Advantage: Gemma 4 12B Unified
24
+
25
+ The **Gemma 4 12B Unified** model features a ground-breaking **encoder-free multimodal architecture**. Unlike traditional vision-language models that rely on separate heavy visual/audio encoders (like ViT or Whisper), the 12B Unified model projects raw image patches and audio waveforms directly into the main LLM's embedding space via lightweight linear layers.
26
+
27
+ Because text, image, and audio flow natively into a single decoder-only transformer, this model benefits dramatically from weight-only quantization, offering minimal multimodal latency and a highly streamlined memory footprint.
28
+
29
+ ---
30
+
31
+ ## Quantization Recipe & Environment
32
+
33
+ The models were generated using the following computational setup and tuning parameters. Notably, it leverages **RTN mode (`iters: 0`) with non-text module protection**, which is mandatory for maintaining performance stability on the Gemma 4 native multimodal layers.
34
+
35
+ ### Environment Setup
36
+ * **PyTorch Version:** `2.10.0+cu128`
37
+ * **CUDA Version:** `12.8` (CUDA Available: `True`)
38
+ * **Hardware:** NVIDIA L40 (48 GB VRAM)
39
+
40
+ ### Tuning Configuration
41
+ ```python
42
+ TUNING_CONFIG = {
43
+ "group_size": 128,
44
+ "sym": True,
45
+ "iters": 0, # RTN mode — required for Gemma 4 stability
46
+ "disable_opt_rtn": True,
47
+ "nsamples": 256,
48
+ "seqlen": 2048,
49
+ "low_gpu_mem_usage": False,
50
+ "quant_nontext_module": False, # Keeps linear projection layers intact for vision/audio inputs
51
+ "layer_config": layer_config,
52
+ }
53
+
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Deployment & Inference Guide
59
+
60
+ Due to the unique unified nature of Gemma 4's multimodal inputs, deployment requires the specialized vLLM unified image containing updated parser configurations.
61
+
62
+ ### Running with Docker (vLLM)
63
+
64
+ Deploy a production-ready OpenAI-compatible API server using the custom `vllm-openai:gemma4-unified` engine:
65
+
66
+ ```bash
67
+ docker run --gpus all \
68
+ -v ~/.cache/huggingface:/root/.cache/huggingface \
69
+ -p 8000:8000 \
70
+ --ipc=host \
71
+ vllm/vllm-openai:gemma4-unified \
72
+ --model Vishva007/gemma-4-12B-it-W4A16-AutoRound \
73
+ --quantization autoround \
74
+ --port 8000 \
75
+ --max-model-len 4096 \
76
+ --trust-remote-code
77
+
78
+ ```
79
+
80
+ *(Note: Change `--quantization` flag to `awq` or `gptq` depending on the specific variant file path you mount).*
81
+
82
+ ---
83
+
84
+ ## 🛠️ Reproduction & Source Code
85
+
86
+ The complete script used to perform this quantization, manage the layer configurations, and optimize the memory footprint is fully open-sourced.
87
+
88
+ You can find the step-by-step Jupyter Notebook containing the exact execution environment, dependency setups, and layer configurations in the GitHub repository:
89
+
90
+ 👉 **[AutoRound-Quantization: Gemma 4 12B RTN Notebook](https://github.com/vishvaRam/AutoRound-Quantaization/blob/main/Gemma4/auto_round_Gemma4-12B-RTN.ipynb)**
91
+
92
+ ### How to Reproduce
93
+ To replicate this quantization run on your own hardware (e.g., NVIDIA L40 or similar 40GB+ VRAM instances), clone the setup and run the notebook:
94
+
95
+ ```bash
96
+ git clone [https://github.com/vishvaRam/AutoRound-Quantaization.git](https://github.com/vishvaRam/AutoRound-Quantaization.git)
97
+ cd AutoRound-Quantaization/Gemma4
98
+