hsmin92 commited on
Commit
ff32ca7
·
verified ·
1 Parent(s): 8e847fc

Add AWQ W4A16 g128 checkpoint, model card, and quantization metadata

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ InternVL3.5-4B-HF AWQ W4A16 (group size 128)
2
+
3
+ This model is a quantized derivative of:
4
+ OpenGVLab/InternVL3_5-4B-HF
5
+ https://huggingface.co/OpenGVLab/InternVL3_5-4B-HF
6
+
7
+ The upstream project is licensed under the Apache License 2.0.
8
+ The quantized checkpoint preserves the upstream model architecture and files,
9
+ with the language decoder Linear weights compressed to asymmetric INT4
10
+ (group size 128) using the AWQ algorithm via llm-compressor.
11
+
12
+ The vision tower, multimodal projector, input embeddings, and lm_head are
13
+ left unquantized in BF16.
QUANTIZATION_INFO.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_directory": "/home/bellock/projects/internvl35-fp8/models/InternVL3_5-4B-HF",
3
+ "output_directory": "/home/bellock/projects/internvl35-fp8/models/InternVL3_5-4B-AWQ-W4A16-G128",
4
+ "source_revision": "model_id=OpenGVLab/InternVL3_5-4B-HF\nrevision=6bd4487402110ef9889ba50eb7aefeb302526fed",
5
+ "quantization_scheme": "W4A16_ASYM",
6
+ "quantization_algorithm": "AWQ",
7
+ "weight_format": "pack-quantized",
8
+ "weight_num_bits": 4,
9
+ "weight_type": "int",
10
+ "weight_strategy": "group",
11
+ "weight_group_size": 128,
12
+ "weight_symmetric": false,
13
+ "input_activations": null,
14
+ "target_module_type": "Linear (language decoder only, regex-scoped)",
15
+ "target_linear_count": 252,
16
+ "target_attention_linear": 144,
17
+ "target_mlp_linear": 108,
18
+ "protected_linear_count": 147,
19
+ "protected_modules": [
20
+ "vision_tower",
21
+ "multi_modal_projector",
22
+ "lm_head",
23
+ "embed_tokens"
24
+ ],
25
+ "awq_duo_scaling": true,
26
+ "awq_n_grid": 20,
27
+ "calibration_dataset": "lmms-lab/flickr30k",
28
+ "calibration_samples": 128,
29
+ "calibration_skipped": 0,
30
+ "calibration_image_size": "448x448",
31
+ "calibration_image_patches_per_sample": 1,
32
+ "calibration_sequence_length_range": "278-288",
33
+ "source_dtype": "torch.bfloat16",
34
+ "python_version": "3.12.3",
35
+ "torch_version": "2.12.0+cu132",
36
+ "transformers_version": "5.10.1",
37
+ "llmcompressor_version": "0.12.0.1",
38
+ "compressed_tensors_version": "0.17.1",
39
+ "checkpoint_tensors_total": 1597,
40
+ "checkpoint_packed_int4_modules": 252,
41
+ "checkpoint_size_gib": 3.816
42
+ }
README.md ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: image-text-to-text
5
+ base_model: OpenGVLab/InternVL3_5-4B-HF
6
+ base_model_relation: quantized
7
+ language:
8
+ - en
9
+ - zh
10
+ - ko
11
+ tags:
12
+ - internvl
13
+ - internvl3.5
14
+ - vision-language
15
+ - multimodal
16
+ - vllm
17
+ - compressed-tensors
18
+ - awq
19
+ - int4
20
+ - w4a16
21
+ - ampere
22
+ - wsl2
23
+ ---
24
+
25
+ # InternVL3.5-4B-HF AWQ W4A16 (group size 128)
26
+
27
+ A compressed-tensors **AWQ W4A16** quantization of
28
+ [OpenGVLab/InternVL3_5-4B-HF](https://huggingface.co/OpenGVLab/InternVL3_5-4B-HF),
29
+ built for serving a 4B vision-language model on an 8 GB consumer GPU with vLLM.
30
+
31
+ A companion FP8 build of the same base model is at
32
+ [hsmin92/internvl35-fp8](https://huggingface.co/hsmin92/internvl35-fp8).
33
+ See [Choosing between the FP8 and AWQ builds](#choosing-between-the-fp8-and-awq-builds).
34
+
35
+ ## Quantization scope
36
+
37
+ Quantized to asymmetric INT4:
38
+
39
+ - **252** language decoder `Linear` modules
40
+ (144 attention: `q_proj` / `k_proj` / `v_proj` / `o_proj`,
41
+ 108 MLP: `gate_proj` / `up_proj` / `down_proj`)
42
+ - Scheme: `W4A16_ASYM`, algorithm: AWQ (`duo_scaling`, `n_grid=20`)
43
+ - Weight format: `pack-quantized`, group size **128**
44
+ - Activations: **not** quantized (A16)
45
+
46
+ Kept in BF16:
47
+
48
+ - Vision tower (`vision_tower`)
49
+ - Multimodal projector (`multi_modal_projector`)
50
+ - Input embeddings
51
+ - `lm_head`
52
+ - Normalization layers and other protected parameters
53
+
54
+ Generated from the base-model revision:
55
+
56
+ ```text
57
+ 6bd4487402110ef9889ba50eb7aefeb302526fed
58
+ ```
59
+
60
+ Checkpoint contents verified: 1,597 tensors, 252 packed INT4 modules with
61
+ matching scale / zero-point tensors, no packed weights under `vision_tower`,
62
+ `multi_modal_projector`, `lm_head`, or the embeddings, and no NaN/Inf in any
63
+ scale. See [`quantization/recipe.py`](./quantization/recipe.py).
64
+
65
+ ## Calibration
66
+
67
+ AWQ fits per-channel scales against a calibration set, so the calibration
68
+ distribution matters. This build used:
69
+
70
+ | | |
71
+ |---|---|
72
+ | Dataset | `lmms-lab/flickr30k` |
73
+ | Samples | 128 (0 skipped) |
74
+ | Image size | 448×448, 1 patch per sample |
75
+ | Sequence length | 278–288 tokens |
76
+ | Prompts | generic English / Korean scene-description instructions |
77
+
78
+ **This is a general-purpose photo set.** If your target domain is far from
79
+ everyday photography — industrial inspection, thermal imagery, medical,
80
+ document OCR, CCTV at unusual angles — re-run AWQ with in-domain calibration
81
+ images rather than assuming this checkpoint transfers. The FP8 build needs no
82
+ calibration and does not carry this caveat.
83
+
84
+ ## Verified environment
85
+
86
+ | Component | Version / value |
87
+ |---|---|
88
+ | GPU | NVIDIA GeForce RTX 3070 8 GB (Ampere, SM 8.6) |
89
+ | Host | Windows 11 + WSL2 (Ubuntu 24.04), Docker Desktop |
90
+ | NVIDIA driver | 591.86 |
91
+ | Serving image | `vllm/vllm-openai:v0.26.0` |
92
+ | vLLM | 0.26.0 (V1 engine) |
93
+ | PyTorch | 2.11.0+cu130 |
94
+ | Transformers | 5.14.1 |
95
+ | Quantization backend | compressed-tensors 0.17.0 |
96
+ | Attention backend | FlashAttention (auto-selected) |
97
+
98
+ Measured at startup with `--gpu-memory-utilization 0.86 --max-model-len 8192
99
+ --max-num-seqs 1 --max-num-batched-tokens 4096 --dtype bfloat16`:
100
+
101
+ ```text
102
+ Model loading took 3.84 GiB memory
103
+ Available KV cache memory: 2.66 GiB
104
+ GPU KV cache size: 19,344 tokens
105
+ Maximum concurrency for 8,192 tokens per request: 2.36x
106
+ Graph capturing finished in 1 secs, took 0.00 GiB
107
+ ```
108
+
109
+ CUDA graphs capture successfully and full FP16 KV cache fits at an 8,192-token
110
+ context — neither is possible with the FP8 build on the same 8 GB card.
111
+
112
+ ## Serving with vLLM
113
+
114
+ `--dtype bfloat16` is required; see [Do not use `--dtype half`](#do-not-use---dtype-half).
115
+
116
+ ```bash
117
+ vllm serve hsmin92/internvl35-4b-awq-w4a16-g128 \
118
+ --served-model-name internvl35-awq \
119
+ --dtype bfloat16 \
120
+ --max-model-len 8192 \
121
+ --max-num-seqs 1 \
122
+ --max-num-batched-tokens 4096 \
123
+ --limit-mm-per-prompt '{"image":2,"video":0}' \
124
+ --gpu-memory-utilization 0.86 \
125
+ --trust-remote-code
126
+ ```
127
+
128
+ Then use the OpenAI-compatible endpoint at `http://127.0.0.1:8000/v1`.
129
+
130
+ ### Do not use `--dtype half`
131
+
132
+ On this checkpoint family `--dtype half` produces a server that starts
133
+ normally, returns HTTP 200 from `/health`, reports a healthy Docker
134
+ healthcheck — and answers every request with `!!!!!!!!`. Dequantization
135
+ overflows the FP16 range, the logits become NaN, and argmax selects token 0.
136
+ It fails silently, so a liveness probe will not catch it.
137
+
138
+ The checkpoint declares `bfloat16` in `config.json` and Ampere supports BF16
139
+ natively at the same memory cost. Always send a real request after a
140
+ configuration change, not just a health check.
141
+
142
+ ### `--max-num-batched-tokens` and multi-image requests
143
+
144
+ This value also sizes the multimodal encoder cache. InternVL dynamic tiling
145
+ allows up to 12 patches plus a thumbnail, so a single image can reach
146
+ **3,329 embedding tokens**. With a smaller value, large images are rejected:
147
+
148
+ ```text
149
+ image item with 2816 embedding tokens, which exceeds the
150
+ pre-allocated encoder cache size 2048
151
+ ```
152
+
153
+ Use at least 4096 if you send high-resolution or wide-aspect images.
154
+
155
+ ### Image token cost is driven by aspect ratio, not size
156
+
157
+ Tile count is chosen from the aspect ratio, so token cost is not monotonic in
158
+ resolution. Measured on this model:
159
+
160
+ | Input size | Image tokens | Tiles |
161
+ |---|---|---|
162
+ | 448×448 | 257 | 1 |
163
+ | 896×448 | 769 | 3 |
164
+ | 960×544 | 769 | 3 |
165
+ | 200×150 | **3,329** | **13** |
166
+ | 800×450 | 769 | 3 |
167
+ | 4000×300 | **3,329** | **13** |
168
+
169
+ A 200×150 crop costs **4.3× more** than an 800×450 image, because 4:3 maps
170
+ exactly onto a 4×3 tile grid and the crop is upscaled to 1792×1344 for no
171
+ added information. When sending region crops, letterbox them into a fixed
172
+ 448×448 canvas (preserving aspect ratio, no upscaling) to make cost constant.
173
+
174
+ ## Choosing between the FP8 and AWQ builds
175
+
176
+ Measured on the same RTX 3070, same vLLM version, same settings:
177
+
178
+ | | FP8 Dynamic | **AWQ W4A16 G128** |
179
+ |---|---|---|
180
+ | Weights on GPU | 5.51 GiB | **3.84 GiB** |
181
+ | KV cache available | 0.61 GiB | **2.66 GiB** |
182
+ | KV cache capacity | 8,928 tokens | **19,344 tokens** |
183
+ | Max concurrency @ 8192 ctx | 1.09× | **2.36×** |
184
+ | KV cache dtype needed for 8192 ctx | fp8 (compromise) | **fp16** |
185
+ | CUDA graphs on 8 GB | not possible | **yes** |
186
+ | Text generation | 13–17 tok/s | **~55 tok/s** |
187
+ | Calibration data required | **no** | yes (see above) |
188
+ | Weight precision | 8-bit | 4-bit |
189
+
190
+ AWQ is decisively better on memory and speed. **Accuracy has not been compared
191
+ between the two builds, or against the BF16 base model.** 4-bit weights and
192
+ out-of-domain calibration are both reasons to expect the AWQ build to degrade
193
+ first on hard inputs. Benchmark both on your own data before choosing.
194
+
195
+ ## Limitations
196
+
197
+ - A quantized derivative, not an independently trained model.
198
+ - **No accuracy benchmark has been published for this checkpoint.** Functional
199
+ validation only: text generation, a 7k-token context, and multi-image
200
+ (full frame + crop) requests all produce coherent, correct answers on simple
201
+ synthetic probes.
202
+ - Calibration is general-purpose photography; see [Calibration](#calibration).
203
+ - The vision tower and output head remain BF16 and are a meaningful share of
204
+ the loaded weights, so the size reduction is smaller than 4/16 would suggest.
205
+ - The bundled `chat_template.jinja` has no tool-calling support. Passing
206
+ `tools=[...]` is silently ignored regardless of vLLM's tool-parser flags.
207
+ - VRAM figures depend on driver, desktop applications, context length,
208
+ multimodal limits, and vLLM version.
209
+
210
+ ## Attribution and license
211
+
212
+ A quantized derivative of
213
+ [OpenGVLab/InternVL3_5-4B-HF](https://huggingface.co/OpenGVLab/InternVL3_5-4B-HF).
214
+ The original project and this derivative are distributed under the Apache-2.0
215
+ license. Review the upstream model card for original training details,
216
+ limitations, and citation information.
217
+
218
+ ## Citation
219
+
220
+ ```bibtex
221
+ @article{wang2025internvl3_5,
222
+ title={InternVL3.5: Advancing Open-Source Multimodal Models in Versatility, Reasoning, and Efficiency},
223
+ author={Wang, Weiyun and Gao, Zhangwei and Gu, Lixin and Pu, Hengjun and Cui, Long and Wei, Xingguang and Liu, Zhaoyang and Jing, Linglin and Ye, Shenglong and Shao, Jie and others},
224
+ journal={arXiv preprint arXiv:2508.18265},
225
+ year={2025}
226
+ }
227
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {% for message in messages %}{{'<|im_start|>' + message['role'] + '
2
+ '}}{% if message['content'] is string %}{{ message['content'] }}{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' %}{{ '<IMG_CONTEXT>
3
+ ' }}{% elif content['type'] == 'video' %}{{ '<video>
4
+ ' }}{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}{{'<|im_end|>
5
+ '}}{% endfor %}{% if add_generation_prompt %}{{'<|im_start|>assistant
6
+ ' }}{% endif %}
config.json ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "InternVLForConditionalGeneration"
4
+ ],
5
+ "downsample_ratio": 0.5,
6
+ "dtype": "bfloat16",
7
+ "image_seq_length": 256,
8
+ "image_token_id": 151671,
9
+ "model_type": "internvl",
10
+ "projector_hidden_act": "gelu",
11
+ "quantization_config": {
12
+ "config_groups": {
13
+ "group_0": {
14
+ "format": "pack-quantized",
15
+ "input_activations": null,
16
+ "output_activations": null,
17
+ "targets": [
18
+ "re:.*layers\\.\\d+\\.self_attn\\.(q_proj|k_proj|v_proj|o_proj)$",
19
+ "re:.*layers\\.\\d+\\.mlp\\.(gate_proj|up_proj|down_proj)$"
20
+ ],
21
+ "weights": {
22
+ "actorder": null,
23
+ "block_structure": null,
24
+ "dynamic": false,
25
+ "group_size": 128,
26
+ "num_bits": 4,
27
+ "observer": "memoryless_minmax",
28
+ "observer_kwargs": {},
29
+ "scale_dtype": null,
30
+ "strategy": "group",
31
+ "symmetric": false,
32
+ "type": "int",
33
+ "zp_dtype": "torch.int8"
34
+ }
35
+ }
36
+ },
37
+ "format": "pack-quantized",
38
+ "global_compression_ratio": null,
39
+ "ignore": [
40
+ "model.vision_tower.encoder.layer.0.attention.q_proj",
41
+ "model.vision_tower.encoder.layer.0.attention.k_proj",
42
+ "model.vision_tower.encoder.layer.0.attention.v_proj",
43
+ "model.vision_tower.encoder.layer.0.attention.projection_layer",
44
+ "model.vision_tower.encoder.layer.0.mlp.fc1",
45
+ "model.vision_tower.encoder.layer.0.mlp.fc2",
46
+ "model.vision_tower.encoder.layer.1.attention.q_proj",
47
+ "model.vision_tower.encoder.layer.1.attention.k_proj",
48
+ "model.vision_tower.encoder.layer.1.attention.v_proj",
49
+ "model.vision_tower.encoder.layer.1.attention.projection_layer",
50
+ "model.vision_tower.encoder.layer.1.mlp.fc1",
51
+ "model.vision_tower.encoder.layer.1.mlp.fc2",
52
+ "model.vision_tower.encoder.layer.2.attention.q_proj",
53
+ "model.vision_tower.encoder.layer.2.attention.k_proj",
54
+ "model.vision_tower.encoder.layer.2.attention.v_proj",
55
+ "model.vision_tower.encoder.layer.2.attention.projection_layer",
56
+ "model.vision_tower.encoder.layer.2.mlp.fc1",
57
+ "model.vision_tower.encoder.layer.2.mlp.fc2",
58
+ "model.vision_tower.encoder.layer.3.attention.q_proj",
59
+ "model.vision_tower.encoder.layer.3.attention.k_proj",
60
+ "model.vision_tower.encoder.layer.3.attention.v_proj",
61
+ "model.vision_tower.encoder.layer.3.attention.projection_layer",
62
+ "model.vision_tower.encoder.layer.3.mlp.fc1",
63
+ "model.vision_tower.encoder.layer.3.mlp.fc2",
64
+ "model.vision_tower.encoder.layer.4.attention.q_proj",
65
+ "model.vision_tower.encoder.layer.4.attention.k_proj",
66
+ "model.vision_tower.encoder.layer.4.attention.v_proj",
67
+ "model.vision_tower.encoder.layer.4.attention.projection_layer",
68
+ "model.vision_tower.encoder.layer.4.mlp.fc1",
69
+ "model.vision_tower.encoder.layer.4.mlp.fc2",
70
+ "model.vision_tower.encoder.layer.5.attention.q_proj",
71
+ "model.vision_tower.encoder.layer.5.attention.k_proj",
72
+ "model.vision_tower.encoder.layer.5.attention.v_proj",
73
+ "model.vision_tower.encoder.layer.5.attention.projection_layer",
74
+ "model.vision_tower.encoder.layer.5.mlp.fc1",
75
+ "model.vision_tower.encoder.layer.5.mlp.fc2",
76
+ "model.vision_tower.encoder.layer.6.attention.q_proj",
77
+ "model.vision_tower.encoder.layer.6.attention.k_proj",
78
+ "model.vision_tower.encoder.layer.6.attention.v_proj",
79
+ "model.vision_tower.encoder.layer.6.attention.projection_layer",
80
+ "model.vision_tower.encoder.layer.6.mlp.fc1",
81
+ "model.vision_tower.encoder.layer.6.mlp.fc2",
82
+ "model.vision_tower.encoder.layer.7.attention.q_proj",
83
+ "model.vision_tower.encoder.layer.7.attention.k_proj",
84
+ "model.vision_tower.encoder.layer.7.attention.v_proj",
85
+ "model.vision_tower.encoder.layer.7.attention.projection_layer",
86
+ "model.vision_tower.encoder.layer.7.mlp.fc1",
87
+ "model.vision_tower.encoder.layer.7.mlp.fc2",
88
+ "model.vision_tower.encoder.layer.8.attention.q_proj",
89
+ "model.vision_tower.encoder.layer.8.attention.k_proj",
90
+ "model.vision_tower.encoder.layer.8.attention.v_proj",
91
+ "model.vision_tower.encoder.layer.8.attention.projection_layer",
92
+ "model.vision_tower.encoder.layer.8.mlp.fc1",
93
+ "model.vision_tower.encoder.layer.8.mlp.fc2",
94
+ "model.vision_tower.encoder.layer.9.attention.q_proj",
95
+ "model.vision_tower.encoder.layer.9.attention.k_proj",
96
+ "model.vision_tower.encoder.layer.9.attention.v_proj",
97
+ "model.vision_tower.encoder.layer.9.attention.projection_layer",
98
+ "model.vision_tower.encoder.layer.9.mlp.fc1",
99
+ "model.vision_tower.encoder.layer.9.mlp.fc2",
100
+ "model.vision_tower.encoder.layer.10.attention.q_proj",
101
+ "model.vision_tower.encoder.layer.10.attention.k_proj",
102
+ "model.vision_tower.encoder.layer.10.attention.v_proj",
103
+ "model.vision_tower.encoder.layer.10.attention.projection_layer",
104
+ "model.vision_tower.encoder.layer.10.mlp.fc1",
105
+ "model.vision_tower.encoder.layer.10.mlp.fc2",
106
+ "model.vision_tower.encoder.layer.11.attention.q_proj",
107
+ "model.vision_tower.encoder.layer.11.attention.k_proj",
108
+ "model.vision_tower.encoder.layer.11.attention.v_proj",
109
+ "model.vision_tower.encoder.layer.11.attention.projection_layer",
110
+ "model.vision_tower.encoder.layer.11.mlp.fc1",
111
+ "model.vision_tower.encoder.layer.11.mlp.fc2",
112
+ "model.vision_tower.encoder.layer.12.attention.q_proj",
113
+ "model.vision_tower.encoder.layer.12.attention.k_proj",
114
+ "model.vision_tower.encoder.layer.12.attention.v_proj",
115
+ "model.vision_tower.encoder.layer.12.attention.projection_layer",
116
+ "model.vision_tower.encoder.layer.12.mlp.fc1",
117
+ "model.vision_tower.encoder.layer.12.mlp.fc2",
118
+ "model.vision_tower.encoder.layer.13.attention.q_proj",
119
+ "model.vision_tower.encoder.layer.13.attention.k_proj",
120
+ "model.vision_tower.encoder.layer.13.attention.v_proj",
121
+ "model.vision_tower.encoder.layer.13.attention.projection_layer",
122
+ "model.vision_tower.encoder.layer.13.mlp.fc1",
123
+ "model.vision_tower.encoder.layer.13.mlp.fc2",
124
+ "model.vision_tower.encoder.layer.14.attention.q_proj",
125
+ "model.vision_tower.encoder.layer.14.attention.k_proj",
126
+ "model.vision_tower.encoder.layer.14.attention.v_proj",
127
+ "model.vision_tower.encoder.layer.14.attention.projection_layer",
128
+ "model.vision_tower.encoder.layer.14.mlp.fc1",
129
+ "model.vision_tower.encoder.layer.14.mlp.fc2",
130
+ "model.vision_tower.encoder.layer.15.attention.q_proj",
131
+ "model.vision_tower.encoder.layer.15.attention.k_proj",
132
+ "model.vision_tower.encoder.layer.15.attention.v_proj",
133
+ "model.vision_tower.encoder.layer.15.attention.projection_layer",
134
+ "model.vision_tower.encoder.layer.15.mlp.fc1",
135
+ "model.vision_tower.encoder.layer.15.mlp.fc2",
136
+ "model.vision_tower.encoder.layer.16.attention.q_proj",
137
+ "model.vision_tower.encoder.layer.16.attention.k_proj",
138
+ "model.vision_tower.encoder.layer.16.attention.v_proj",
139
+ "model.vision_tower.encoder.layer.16.attention.projection_layer",
140
+ "model.vision_tower.encoder.layer.16.mlp.fc1",
141
+ "model.vision_tower.encoder.layer.16.mlp.fc2",
142
+ "model.vision_tower.encoder.layer.17.attention.q_proj",
143
+ "model.vision_tower.encoder.layer.17.attention.k_proj",
144
+ "model.vision_tower.encoder.layer.17.attention.v_proj",
145
+ "model.vision_tower.encoder.layer.17.attention.projection_layer",
146
+ "model.vision_tower.encoder.layer.17.mlp.fc1",
147
+ "model.vision_tower.encoder.layer.17.mlp.fc2",
148
+ "model.vision_tower.encoder.layer.18.attention.q_proj",
149
+ "model.vision_tower.encoder.layer.18.attention.k_proj",
150
+ "model.vision_tower.encoder.layer.18.attention.v_proj",
151
+ "model.vision_tower.encoder.layer.18.attention.projection_layer",
152
+ "model.vision_tower.encoder.layer.18.mlp.fc1",
153
+ "model.vision_tower.encoder.layer.18.mlp.fc2",
154
+ "model.vision_tower.encoder.layer.19.attention.q_proj",
155
+ "model.vision_tower.encoder.layer.19.attention.k_proj",
156
+ "model.vision_tower.encoder.layer.19.attention.v_proj",
157
+ "model.vision_tower.encoder.layer.19.attention.projection_layer",
158
+ "model.vision_tower.encoder.layer.19.mlp.fc1",
159
+ "model.vision_tower.encoder.layer.19.mlp.fc2",
160
+ "model.vision_tower.encoder.layer.20.attention.q_proj",
161
+ "model.vision_tower.encoder.layer.20.attention.k_proj",
162
+ "model.vision_tower.encoder.layer.20.attention.v_proj",
163
+ "model.vision_tower.encoder.layer.20.attention.projection_layer",
164
+ "model.vision_tower.encoder.layer.20.mlp.fc1",
165
+ "model.vision_tower.encoder.layer.20.mlp.fc2",
166
+ "model.vision_tower.encoder.layer.21.attention.q_proj",
167
+ "model.vision_tower.encoder.layer.21.attention.k_proj",
168
+ "model.vision_tower.encoder.layer.21.attention.v_proj",
169
+ "model.vision_tower.encoder.layer.21.attention.projection_layer",
170
+ "model.vision_tower.encoder.layer.21.mlp.fc1",
171
+ "model.vision_tower.encoder.layer.21.mlp.fc2",
172
+ "model.vision_tower.encoder.layer.22.attention.q_proj",
173
+ "model.vision_tower.encoder.layer.22.attention.k_proj",
174
+ "model.vision_tower.encoder.layer.22.attention.v_proj",
175
+ "model.vision_tower.encoder.layer.22.attention.projection_layer",
176
+ "model.vision_tower.encoder.layer.22.mlp.fc1",
177
+ "model.vision_tower.encoder.layer.22.mlp.fc2",
178
+ "model.vision_tower.encoder.layer.23.attention.q_proj",
179
+ "model.vision_tower.encoder.layer.23.attention.k_proj",
180
+ "model.vision_tower.encoder.layer.23.attention.v_proj",
181
+ "model.vision_tower.encoder.layer.23.attention.projection_layer",
182
+ "model.vision_tower.encoder.layer.23.mlp.fc1",
183
+ "model.vision_tower.encoder.layer.23.mlp.fc2",
184
+ "model.multi_modal_projector.linear_1",
185
+ "model.multi_modal_projector.linear_2",
186
+ "lm_head"
187
+ ],
188
+ "kv_cache_scheme": null,
189
+ "quant_method": "compressed-tensors",
190
+ "quantization_status": "compressed",
191
+ "sparsity_config": {},
192
+ "transform_config": {},
193
+ "version": "0.17.1"
194
+ },
195
+ "text_config": {
196
+ "_name_or_path": "/root/codespace/checkpoints/Qwen3-4B",
197
+ "architectures": [
198
+ "Qwen3ForCausalLM"
199
+ ],
200
+ "attention_bias": false,
201
+ "attention_dropout": 0.0,
202
+ "bos_token_id": 151643,
203
+ "debug": false,
204
+ "dtype": "bfloat16",
205
+ "eos_token_id": 151645,
206
+ "ep_size": 1,
207
+ "head_dim": 128,
208
+ "hidden_act": "silu",
209
+ "hidden_size": 2560,
210
+ "initializer_range": 0.02,
211
+ "intermediate_size": 9728,
212
+ "layer_types": [
213
+ "full_attention",
214
+ "full_attention",
215
+ "full_attention",
216
+ "full_attention",
217
+ "full_attention",
218
+ "full_attention",
219
+ "full_attention",
220
+ "full_attention",
221
+ "full_attention",
222
+ "full_attention",
223
+ "full_attention",
224
+ "full_attention",
225
+ "full_attention",
226
+ "full_attention",
227
+ "full_attention",
228
+ "full_attention",
229
+ "full_attention",
230
+ "full_attention",
231
+ "full_attention",
232
+ "full_attention",
233
+ "full_attention",
234
+ "full_attention",
235
+ "full_attention",
236
+ "full_attention",
237
+ "full_attention",
238
+ "full_attention",
239
+ "full_attention",
240
+ "full_attention",
241
+ "full_attention",
242
+ "full_attention",
243
+ "full_attention",
244
+ "full_attention",
245
+ "full_attention",
246
+ "full_attention",
247
+ "full_attention",
248
+ "full_attention"
249
+ ],
250
+ "max_position_embeddings": 40960,
251
+ "max_window_layers": 36,
252
+ "micro_forward": false,
253
+ "model_type": "qwen3",
254
+ "num_attention_heads": 32,
255
+ "num_hidden_layers": 36,
256
+ "num_key_value_heads": 8,
257
+ "pad_token_id": null,
258
+ "rms_norm_eps": 1e-06,
259
+ "rope_parameters": {
260
+ "rope_theta": 1000000,
261
+ "rope_type": "default"
262
+ },
263
+ "skip_checkpoint": false,
264
+ "sliding_window": null,
265
+ "tie_word_embeddings": false,
266
+ "use_cache": true,
267
+ "use_deepep": false,
268
+ "use_sliding_window": false,
269
+ "vocab_size": 151936
270
+ },
271
+ "tie_word_embeddings": false,
272
+ "transformers_version": "5.10.1",
273
+ "vision_config": {
274
+ "architectures": [
275
+ "InternVisionModel"
276
+ ],
277
+ "attention_bias": true,
278
+ "attention_dropout": 0.0,
279
+ "dropout": 0.0,
280
+ "dtype": "bfloat16",
281
+ "hidden_act": "gelu",
282
+ "hidden_dropout_prob": 0.0,
283
+ "hidden_size": 1024,
284
+ "image_size": [
285
+ 448,
286
+ 448
287
+ ],
288
+ "initializer_factor": 0.1,
289
+ "initializer_range": 1e-10,
290
+ "intermediate_size": 4096,
291
+ "layer_norm_eps": 1e-06,
292
+ "layer_scale_init_value": 0.1,
293
+ "model_type": "internvl_vision",
294
+ "norm_type": "layer_norm",
295
+ "num_attention_heads": 16,
296
+ "num_channels": 3,
297
+ "num_hidden_layers": 24,
298
+ "patch_size": [
299
+ 14,
300
+ 14
301
+ ],
302
+ "projection_dropout": 0.0,
303
+ "use_absolute_position_embeddings": true,
304
+ "use_mask_token": false,
305
+ "use_mean_pooling": true,
306
+ "use_qk_norm": false
307
+ },
308
+ "vision_feature_layer": -1,
309
+ "vision_feature_select_strategy": "default"
310
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 151643,
4
+ "eos_token_id": 151645,
5
+ "transformers_version": "5.10.1"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c42c8a90d5c2c4698e7e043a0d4625ea8df4ef3b8a290f6471064112c5c0a48
3
+ size 4086177728
processor_config.json ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "crop_to_patches": false,
4
+ "data_format": "channels_first",
5
+ "default_to_square": true,
6
+ "do_convert_rgb": true,
7
+ "do_normalize": true,
8
+ "do_rescale": true,
9
+ "do_resize": true,
10
+ "image_mean": [
11
+ 0.485,
12
+ 0.456,
13
+ 0.406
14
+ ],
15
+ "image_processor_type": "GotOcr2ImageProcessor",
16
+ "image_std": [
17
+ 0.229,
18
+ 0.224,
19
+ 0.225
20
+ ],
21
+ "max_patches": 12,
22
+ "min_patches": 1,
23
+ "resample": 3,
24
+ "rescale_factor": 0.00392156862745098,
25
+ "size": {
26
+ "height": 448,
27
+ "width": 448
28
+ }
29
+ },
30
+ "image_seq_length": 256,
31
+ "processor_class": "InternVLProcessor",
32
+ "video_processor": {
33
+ "data_format": "channels_first",
34
+ "default_to_square": true,
35
+ "do_convert_rgb": true,
36
+ "do_normalize": true,
37
+ "do_rescale": true,
38
+ "do_resize": true,
39
+ "do_sample_frames": false,
40
+ "image_mean": [
41
+ 0.48145466,
42
+ 0.4578275,
43
+ 0.40821073
44
+ ],
45
+ "image_std": [
46
+ 0.26862954,
47
+ 0.26130258,
48
+ 0.27577711
49
+ ],
50
+ "initial_shift": true,
51
+ "model_valid_processing_keys": [
52
+ "do_convert_rgb",
53
+ "do_resize",
54
+ "size",
55
+ "size_divisor",
56
+ "default_to_square",
57
+ "resample",
58
+ "do_rescale",
59
+ "rescale_factor",
60
+ "do_normalize",
61
+ "image_mean",
62
+ "image_std",
63
+ "do_pad",
64
+ "do_center_crop",
65
+ "crop_size",
66
+ "data_format",
67
+ "input_data_format",
68
+ "device"
69
+ ],
70
+ "resample": 3,
71
+ "rescale_factor": 0.00392156862745098,
72
+ "return_metadata": false,
73
+ "size": {
74
+ "height": 384,
75
+ "width": 384
76
+ },
77
+ "video_processor_type": "InternVLVideoProcessor"
78
+ }
79
+ }
quantization/recipe.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Compression recipe used to create this checkpoint.
2
+
3
+ Run quantization from the original BF16 checkpoint, not from an already
4
+ quantized checkpoint.
5
+
6
+ AWQ needs calibration data. This build used 128 samples from
7
+ `lmms-lab/flickr30k`, each rendered at 448x448 (a single InternVL patch) with
8
+ generic English/Korean scene-description prompts. Re-run with in-domain images
9
+ if your target distribution is far from everyday photography.
10
+
11
+ Targets are regex-scoped to the language decoder, so the vision tower,
12
+ multimodal projector, input embeddings, and lm_head are never matched and stay
13
+ in BF16. `ignore` is therefore empty by design.
14
+ """
15
+
16
+ from llmcompressor.modifiers.awq import AWQModifier
17
+ from llmcompressor.modifiers.quantization import QuantizationModifier
18
+
19
+ ATTENTION = r"re:^model\.language_model\.layers\.\d+\.self_attn\.(q_proj|k_proj|v_proj|o_proj)$"
20
+ MLP = r"re:^model\.language_model\.layers\.\d+\.mlp\.(gate_proj|up_proj|down_proj)$"
21
+
22
+ RECIPE = [
23
+ AWQModifier(
24
+ mappings=[
25
+ {
26
+ "smooth_layer": r"re:^model\.language_model\.layers\.\d+\.input_layernorm$",
27
+ "balance_layers": [
28
+ r"re:^model\.language_model\.layers\.\d+\.self_attn\.q_proj$",
29
+ r"re:^model\.language_model\.layers\.\d+\.self_attn\.k_proj$",
30
+ r"re:^model\.language_model\.layers\.\d+\.self_attn\.v_proj$",
31
+ ],
32
+ },
33
+ {
34
+ "smooth_layer": r"re:^model\.language_model\.layers\.\d+\.self_attn\.v_proj$",
35
+ "balance_layers": [
36
+ r"re:^model\.language_model\.layers\.\d+\.self_attn\.o_proj$",
37
+ ],
38
+ },
39
+ {
40
+ "smooth_layer": r"re:^model\.language_model\.layers\.\d+\.post_attention_layernorm$",
41
+ "balance_layers": [
42
+ r"re:^model\.language_model\.layers\.\d+\.mlp\.gate_proj$",
43
+ r"re:^model\.language_model\.layers\.\d+\.mlp\.up_proj$",
44
+ ],
45
+ },
46
+ {
47
+ "smooth_layer": r"re:^model\.language_model\.layers\.\d+\.mlp\.up_proj$",
48
+ "balance_layers": [
49
+ r"re:^model\.language_model\.layers\.\d+\.mlp\.down_proj$",
50
+ ],
51
+ },
52
+ ],
53
+ duo_scaling=True,
54
+ n_grid=20,
55
+ ),
56
+ QuantizationModifier(
57
+ targets=[ATTENTION, MLP],
58
+ ignore=[],
59
+ scheme="W4A16_ASYM",
60
+ ),
61
+ ]
recipe.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_stage:
2
+ default_modifiers:
3
+ AWQModifier:
4
+ mappings:
5
+ - smooth_layer: re:^model\.language_model\.layers\.\d+\.input_layernorm$
6
+ balance_layers: ['re:^model\.language_model\.layers\.\d+\.self_attn\.q_proj$', 're:^model\.language_model\.layers\.\d+\.self_attn\.k_proj$',
7
+ 're:^model\.language_model\.layers\.\d+\.self_attn\.v_proj$']
8
+ activation_hook_target: null
9
+ - smooth_layer: re:^model\.language_model\.layers\.\d+\.self_attn\.v_proj$
10
+ balance_layers: ['re:^model\.language_model\.layers\.\d+\.self_attn\.o_proj$']
11
+ activation_hook_target: null
12
+ - smooth_layer: re:^model\.language_model\.layers\.\d+\.post_attention_layernorm$
13
+ balance_layers: ['re:^model\.language_model\.layers\.\d+\.mlp\.gate_proj$', 're:^model\.language_model\.layers\.\d+\.mlp\.up_proj$']
14
+ activation_hook_target: null
15
+ - smooth_layer: re:^model\.language_model\.layers\.\d+\.mlp\.up_proj$
16
+ balance_layers: ['re:^model\.language_model\.layers\.\d+\.mlp\.down_proj$']
17
+ activation_hook_target: null
18
+ duo_scaling: true
19
+ n_grid: 20
20
+ QuantizationModifier:
21
+ targets: ['re:^model\.language_model\.layers\.\d+\.self_attn\.(q_proj|k_proj|v_proj|o_proj)$',
22
+ 're:^model\.language_model\.layers\.\d+\.mlp\.(gate_proj|up_proj|down_proj)$']
23
+ ignore: []
24
+ scheme: W4A16_ASYM
25
+ bypass_divisibility_checks: false
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b9d18660f656ae5a87df2d5d6ed990e80f292d3473c1a35cae8259a5d28cd67
3
+ size 11424484
tokenizer_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "context_image_token": "<IMG_CONTEXT>",
7
+ "end_image_token": "</img>",
8
+ "eos_token": "<|im_end|>",
9
+ "errors": "replace",
10
+ "is_local": true,
11
+ "local_files_only": true,
12
+ "model_max_length": 40960,
13
+ "model_specific_special_tokens": {
14
+ "context_image_token": "<IMG_CONTEXT>",
15
+ "end_image_token": "</img>",
16
+ "start_image_token": "<img>",
17
+ "video_token": "<video>"
18
+ },
19
+ "pad_token": "<|endoftext|>",
20
+ "processor_class": "InternVLProcessor",
21
+ "split_special_tokens": false,
22
+ "start_image_token": "<img>",
23
+ "tokenizer_class": "Qwen2Tokenizer",
24
+ "unk_token": null,
25
+ "video_token": "<video>"
26
+ }