Vishva007 commited on
Commit
c9dbce5
·
verified ·
1 Parent(s): 683a03f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +185 -0
README.md ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: vllm-sr/d3-lite
3
+ library_name: transformers
4
+ tags:
5
+ - auto-round
6
+ - intel
7
+ - quantization
8
+ - 4bit
9
+ - decision-model
10
+ - zero-shot-classification
11
+ - multimodal
12
+ - vision
13
+ - video
14
+ - vllm-semantic-router
15
+ pipeline_tag: zero-shot-classification
16
+ license: apache-2.0
17
+ ---
18
+
19
+ # Vishva007/d3-lite-W4A16-AutoRound
20
+
21
+ This repository hosts a high-precision **W4A16 quantized version** of [`vllm-sr/d3-lite`](https://huggingface.co/vllm-sr/d3-lite) using **Intel AutoRound**.
22
+
23
+ `d3-lite` is the 0.8B multimodal foundation decision model of Decision 3.0 (vLLM Semantic Router). It evaluates inputs (text, JSON, images, and video clips) against decision questions (Choice, Yes/No, Score) and outputs direct probabilities in a single forward pass without generating tokens.
24
+
25
+ ---
26
+
27
+ ## Quantization Details
28
+
29
+ The quantization was performed using [AutoRound](https://github.com/intel/auto-round) with a high-accuracy, production-grade configuration. To preserve zero-shot vision and video grounding fidelity, the vision encoder was explicitly kept unquantized.
30
+
31
+ ### Tuning Configuration
32
+
33
+ | Parameter | Value | Note |
34
+ | :--- | :--- | :--- |
35
+ | **Bit Width** | W4A16 | 4-bit weights, 16-bit activations |
36
+ | **Group Size** | `32` | Fine-grained quantization grouping |
37
+ | **Symmetric (`sym`)** | `True` | Symmetric signed quantization |
38
+ | **Iterations (`iters`)** | `1200` | High convergence / production-grade optimization |
39
+ | **Samples (`nsamples`)** | `512` | Calibration sample size |
40
+ | **Batch Size** | `4` | Calibration batch size |
41
+ | **Sequence Length (`seqlen`)** | `4096` | Max sequence context during calibration |
42
+ | **`quant_nontext_module`** | `False` | **Keeps Vision Encoder in FP16/BF16** to prevent visual drift |
43
+ | **`enable_torch_compile`** | `True` | Accelerated calibration via TorchDynamo |
44
+
45
+ ---
46
+
47
+ ## Installation
48
+
49
+ Ensure you have the required dependencies and compatible `transformers` installed:
50
+
51
+ ```bash
52
+ pip install "transformers==5.17.0" torch torchvision pillow opencv-python-headless safetensors accelerate
53
+ pip install auto-round
54
+ # Optional for linear-attention speedups:
55
+ pip install flash-linear-attention
56
+
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Quickstart & Usage
62
+
63
+ You can load and query the model directly via the standard `system_one` decision API.
64
+
65
+ ### 1. Pure Text Routing
66
+
67
+ ```python
68
+ import json
69
+ from transformers import AutoModel
70
+
71
+ model = AutoModel.from_pretrained(
72
+ "Vishva007/d3-lite-W4A16-AutoRound",
73
+ trust_remote_code=True,
74
+ device_map="auto"
75
+ )
76
+
77
+ result = model.system_one(
78
+ state="The order arrived damaged yesterday. The customer has a receipt and asks for a replacement today.",
79
+ questions={
80
+ "route": {
81
+ "type": "choice",
82
+ "instructions": "Which team should handle this request?",
83
+ "criteria": {
84
+ "returns": "Refunds, replacements and damaged deliveries",
85
+ "billing": "Payments, invoices and charges",
86
+ "technical": "Product setup and faults"
87
+ }
88
+ },
89
+ "receipt": {
90
+ "type": "noul",
91
+ "instructions": "Does the customer have a receipt?"
92
+ },
93
+ "urgency": {
94
+ "type": "score",
95
+ "instructions": "How urgent is this request?",
96
+ "criteria": ["Routine", "Soon", "Today"]
97
+ }
98
+ },
99
+ )
100
+
101
+ print(json.dumps(result["answers"], indent=2))
102
+
103
+ ```
104
+
105
+ ---
106
+
107
+ ### 2. Multimodal Routing (Images & Video)
108
+
109
+ Because the vision tower is preserved in unquantized precision (`quant_nontext_module: False`), full visual resolution and feature fidelity are retained:
110
+
111
+ ```python
112
+ from huggingface_hub import hf_hub_download
113
+
114
+ # Download sample asset from original repo
115
+ receipt_img = hf_hub_download("vllm-sr/d3-lite", "assets/example-receipt.png")
116
+
117
+ result = model.system_one(
118
+ state="The customer says the blender arrived cracked and attached the receipt.",
119
+ images=[receipt_img], # Accepts paths, URLs, PIL images, or base64 strings
120
+ questions={
121
+ "route": {
122
+ "type": "choice",
123
+ "instructions": "Which team should handle this request?",
124
+ "criteria": {
125
+ "returns": "Refunds, replacements and damaged deliveries",
126
+ "billing": "Payments, invoices and charges"
127
+ }
128
+ },
129
+ "on_receipt": {
130
+ "type": "noul",
131
+ "instructions": "Does the receipt list the blender?"
132
+ }
133
+ },
134
+ )
135
+
136
+ print(result["answers"])
137
+
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Memory & Performance Advantages
143
+
144
+ * **VRAM Footprint**: Reduces base language backbone weight footprint by roughly 3–3.5× compared to standard BF16.
145
+ * **Edge Deployment**: Designed to run efficiently on low-memory edge accelerators, discrete workstation GPUs, or embedded hardware.
146
+ * **Visual Accuracy**: Zero degradation in visual QA benchmarks (CV-Bench, Perception Test) due to unquantized vision tower caching.
147
+
148
+ ---
149
+
150
+ ### 🚀 Deploy on RunPod
151
+
152
+ One-click launch environments pre-configured with PyTorch, CUDA, and dependencies for fine-tuning or quantization.
153
+
154
+ > 🎁 **Need GPU compute?** Sign up via [RunPod](https://runpod.io?ref=iabrlp7z) and get **$5–$500 in free credits** when you add your first $10.
155
+
156
+ #### PyTorch 2.14
157
+
158
+ | Template | CUDA Version | Docker Image | Template ID | Deploy |
159
+ | :--- | :--- | :--- | :--- | :--- |
160
+ | **PyTorch 2.14 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.14-runpod` | `d7lxsa4w9m` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=d7lxsa4w9m&ref=iabrlp7z) |
161
+ | **PyTorch 2.14 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.14-runpod` | `yk0y6j6rpg` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=yk0y6j6rpg&ref=iabrlp7z) |
162
+ | **PyTorch 2.14 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.14-runpod` | `gsp4gwx0nw` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=gsp4gwx0nw&ref=iabrlp7z) |
163
+
164
+ #### PyTorch 2.13
165
+
166
+ | Template | CUDA Version | Docker Image | Template ID | Deploy |
167
+ | :--- | :--- | :--- | :--- | :--- |
168
+ | **PyTorch 2.13 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.13-runpod` | `gmlupxnxfk` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=gmlupxnxfk&ref=iabrlp7z) |
169
+ | **PyTorch 2.13 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.13-runpod` | `y3j8xvk4f4` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=y3j8xvk4f4&ref=iabrlp7z) |
170
+ | **PyTorch 2.13 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.13-runpod` | `vigpissn5w` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=vigpissn5w&ref=iabrlp7z) |
171
+
172
+ #### PyTorch 2.12
173
+
174
+ | Template | CUDA Version | Docker Image | Template ID | Deploy |
175
+ | :--- | :--- | :--- | :--- | :--- |
176
+ | **PyTorch 2.12 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.12-runpod` | `ctmz86zmf0` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=ctmz86zmf0&ref=iabrlp7z) |
177
+ | **PyTorch 2.12 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.12-runpod` | `qjko5yiwzi` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=qjko5yiwzi&ref=iabrlp7z) |
178
+ | **PyTorch 2.12 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.12-runpod` | `ifg6xmye0f` | [![Deploy to RunPod](https://img.shields.io/badge/RunPod-Deploy%20Pod-purple?logo=runpod&logoColor=white)](https://runpod.io/console/deploy?template=ifg6xmye0f&ref=iabrlp7z) |
179
+
180
+ ---
181
+
182
+ ## License & Attribution
183
+
184
+ * **Base Model**: [`vllm-sr/d3-lite`](https://huggingface.co/vllm-sr/d3-lite) (Apache-2.0) by the vLLM Semantic Router Team.
185
+ * **License**: Apache-2.0.