vllm-quantpack 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. vllm_quantpack-0.1.0/LICENSE +202 -0
  2. vllm_quantpack-0.1.0/NOTICE +25 -0
  3. vllm_quantpack-0.1.0/PKG-INFO +73 -0
  4. vllm_quantpack-0.1.0/README.md +59 -0
  5. vllm_quantpack-0.1.0/pyproject.toml +25 -0
  6. vllm_quantpack-0.1.0/setup.cfg +4 -0
  7. vllm_quantpack-0.1.0/tests/test_pure.py +125 -0
  8. vllm_quantpack-0.1.0/vllm_quantpack/__init__.py +61 -0
  9. vllm_quantpack-0.1.0/vllm_quantpack/exl3/__init__.py +0 -0
  10. vllm_quantpack-0.1.0/vllm_quantpack/exl3/embedding.py +85 -0
  11. vllm_quantpack-0.1.0/vllm_quantpack/exl3/hooks.py +11 -0
  12. vllm_quantpack-0.1.0/vllm_quantpack/exl3/layers.py +89 -0
  13. vllm_quantpack-0.1.0/vllm_quantpack/exl3/linear.py +328 -0
  14. vllm_quantpack-0.1.0/vllm_quantpack/exl3/moe.py +280 -0
  15. vllm_quantpack-0.1.0/vllm_quantpack/exl3/names.py +92 -0
  16. vllm_quantpack-0.1.0/vllm_quantpack/exl3/ops.py +49 -0
  17. vllm_quantpack-0.1.0/vllm_quantpack/exl3/spec_decode.py +37 -0
  18. vllm_quantpack-0.1.0/vllm_quantpack/exl3/tp_ranges.py +54 -0
  19. vllm_quantpack-0.1.0/vllm_quantpack/families/__init__.py +0 -0
  20. vllm_quantpack-0.1.0/vllm_quantpack/families/flint/__init__.py +31 -0
  21. vllm_quantpack-0.1.0/vllm_quantpack/families/flint/config.py +83 -0
  22. vllm_quantpack-0.1.0/vllm_quantpack/families/flint/interm_div.py +71 -0
  23. vllm_quantpack-0.1.0/vllm_quantpack/families/flint/model.py +580 -0
  24. vllm_quantpack-0.1.0/vllm_quantpack/families/nemotron/__init__.py +14 -0
  25. vllm_quantpack-0.1.0/vllm_quantpack/families/nemotron/model.py +112 -0
  26. vllm_quantpack-0.1.0/vllm_quantpack/families/qwen.py +105 -0
  27. vllm_quantpack-0.1.0/vllm_quantpack/families/spark/__init__.py +25 -0
  28. vllm_quantpack-0.1.0/vllm_quantpack/families/spark/config.py +68 -0
  29. vllm_quantpack-0.1.0/vllm_quantpack/families/spark/model.py +240 -0
  30. vllm_quantpack-0.1.0/vllm_quantpack.egg-info/PKG-INFO +73 -0
  31. vllm_quantpack-0.1.0/vllm_quantpack.egg-info/SOURCES.txt +32 -0
  32. vllm_quantpack-0.1.0/vllm_quantpack.egg-info/dependency_links.txt +1 -0
  33. vllm_quantpack-0.1.0/vllm_quantpack.egg-info/entry_points.txt +2 -0
  34. vllm_quantpack-0.1.0/vllm_quantpack.egg-info/top_level.txt +1 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,25 @@
1
+ vllm-quantpack
2
+ Copyright 2026 Jorge Ramírez Espejo
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This product includes code from OrcaSAQ2 (https://github.com/Continuum-AI-Corp/OrcaSAQ2-kernel, commit 7ddffb1),
7
+ licensed under the Apache License, Version 2.0: the EXL3 quantization config, linear and embedding methods, the shard
8
+ GEMM custom op and the embedding-layer constructor wrapper (vllm_quantpack/exl3/). Modified: prefix normalisation, empty
9
+ draft heads, padding, dtype conversion, host-memory release, tensor parallelism, MoE dispatch.
10
+
11
+ The Flint model (vllm_quantpack/families/flint/model.py) is adapted from vLLM's AfMoE model
12
+ (https://github.com/vllm-project/vllm, Apache-2.0); its configuration class (config.py) comes from the SGLang serving kit
13
+ published with RecursiveSI Flint (https://huggingface.co/RecursiveSI, Apache-2.0).
14
+
15
+ The quantized-embedding support for Qwen3.5-family GPTQ checkpoints (vllm_quantpack/families/qwen.py and
16
+ vllm_quantpack/exl3/layers.py) replaces, without modifying vLLM, qwen3_5-embed-quant.patch from
17
+ syv-ai/qwen38-27b-rtx3090 (https://github.com/syv-ai/qwen38-27b-rtx3090, Apache-2.0).
18
+
19
+ The EXL3 format and its CUDA kernels come from exllamav3 (https://github.com/turboderp-org/exllamav3, MIT), which is a
20
+ runtime dependency and is not included here. EXL3 is a streamlined variant of QTIP (https://github.com/Cornell-RelaxML/qtip).
21
+
22
+ Developed with the support of the Department of Computer Science (Departament de Ciències de la Computació),
23
+ Universitat Autònoma de Barcelona, which provided the hardware used to build and measure it.
24
+
25
+ This repository contains no model weights.
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: vllm-quantpack
3
+ Version: 0.1.0
4
+ Summary: vLLM plugin: serve EXL3 (exllamav3 trellis) checkpoints and the model-family fixes they need, with no patch to vLLM
5
+ Author: Jorge Ramírez Espejo
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/jramirez-uab/vllm-quantpack
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Dynamic: license-file
14
+
15
+ # vllm-quantpack
16
+
17
+ **Experimental, early stage.** A vLLM general plugin that serves EXL3 (exllamav3 trellis) checkpoints, and the
18
+ model-family fixes they need, in stock vLLM: no patch to vLLM, no per-model plugin.
19
+
20
+ ## What it does
21
+
22
+ - Registers `quant_method: "exl3"`, so `vllm serve <repo>` loads EXL3 packs with no extra flag:
23
+ - linear layers at any per-tensor bitrate, including fused layers whose shards have different bitrates;
24
+ - `lm_head` as an EXL3 tensor (`head_bits`) or dense;
25
+ - `embed_tokens` as int8 rows with a per-row scale, dequantized on the gathered rows;
26
+ - routed MoE experts on exllamav3's fused kernel, capturable in CUDA graphs;
27
+ - tensor parallelism for dense layers (`-tp N`) and expert parallelism for MoE (`-tp N --enable-expert-parallel`).
28
+ - Model-family fixes:
29
+ - **Qwen 3.5 / 3.6 / 3.8**: the vision tower's duplicated attention tensors;
30
+ - **Qwen3.8-Flash-Next**: the FP8 PLE lookup on GPUs below sm_89.
31
+
32
+ ## Requirements
33
+
34
+ - vLLM 0.31 (0.30 also works).
35
+ - The exllamav3 wheel that matches your torch and CUDA. It is not on PyPI:
36
+ ```
37
+ python -c "import torch; print(torch.__version__, torch.version.cuda)"
38
+ # then pick the matching asset from https://github.com/turboderp-org/exllamav3/releases
39
+ ```
40
+ - An NVIDIA GPU of compute capability 8.0 or newer (Ampere, Ada, Hopper, Blackwell).
41
+
42
+ ## Install
43
+
44
+ ```
45
+ pip install vllm-quantpack
46
+ ```
47
+
48
+ It replaces OrcaSAQ2, `qwen38_exl3_vision`, `flint_vllm` and `spark_vllm`. If any of them is installed in the same
49
+ environment, uninstall it, or load only this plugin with `VLLM_PLUGINS=quantpack`.
50
+
51
+ ## Status
52
+
53
+ | Part | State |
54
+ |---|---|
55
+ | EXL3 linear, int8 embedding, lm_head | validated: same scores as the previous stack (dense Qwen 27B) |
56
+ | EXL3 MoE | validated on one GPU (Groot 19B-A3B): same as the previous stack within run-to-run noise |
57
+ | Tensor / expert parallelism | validated with MoE TP2 + EP (Groot 19B-A3B); Flash-Next TP not tested yet |
58
+ | Qwen vision, Flash-Next PLE | validated (Kestrel, Groot, Flash-Next 2.25) |
59
+ | Flint architecture | validated (Flint 3.88): same as flint_vllm within run-to-run noise |
60
+ | GPTQ with int4/int8 embeddings (Qwen3.5 family, vLLM <= 0.31) | validated: loads on unpatched vLLM 0.31, bit-identical to the patched vLLM in eager mode |
61
+ | Spark architecture | served (Spark-X2.5 4B) |
62
+ | Nemotron-3.5-Super-VL (gateless ReLU² MoE, MTP, vision) | served (2.25 bpw, one 96 GB GPU) |
63
+ | Every published JRamirez-UAB checkpoint | each served with its card's Quick start command on a clean vLLM 0.31 install: text, image and tool call answered |
64
+
65
+ ## Credits
66
+
67
+ Includes code from [OrcaSAQ2](https://github.com/Continuum-AI-Corp/OrcaSAQ2-kernel) (Apache-2.0). The EXL3 format and
68
+ kernels are [exllamav3](https://github.com/turboderp-org/exllamav3) by turboderp (MIT), a streamlined variant of
69
+ [QTIP](https://github.com/Cornell-RelaxML/qtip). See NOTICE.
70
+
71
+ ## License
72
+
73
+ Apache-2.0.
@@ -0,0 +1,59 @@
1
+ # vllm-quantpack
2
+
3
+ **Experimental, early stage.** A vLLM general plugin that serves EXL3 (exllamav3 trellis) checkpoints, and the
4
+ model-family fixes they need, in stock vLLM: no patch to vLLM, no per-model plugin.
5
+
6
+ ## What it does
7
+
8
+ - Registers `quant_method: "exl3"`, so `vllm serve <repo>` loads EXL3 packs with no extra flag:
9
+ - linear layers at any per-tensor bitrate, including fused layers whose shards have different bitrates;
10
+ - `lm_head` as an EXL3 tensor (`head_bits`) or dense;
11
+ - `embed_tokens` as int8 rows with a per-row scale, dequantized on the gathered rows;
12
+ - routed MoE experts on exllamav3's fused kernel, capturable in CUDA graphs;
13
+ - tensor parallelism for dense layers (`-tp N`) and expert parallelism for MoE (`-tp N --enable-expert-parallel`).
14
+ - Model-family fixes:
15
+ - **Qwen 3.5 / 3.6 / 3.8**: the vision tower's duplicated attention tensors;
16
+ - **Qwen3.8-Flash-Next**: the FP8 PLE lookup on GPUs below sm_89.
17
+
18
+ ## Requirements
19
+
20
+ - vLLM 0.31 (0.30 also works).
21
+ - The exllamav3 wheel that matches your torch and CUDA. It is not on PyPI:
22
+ ```
23
+ python -c "import torch; print(torch.__version__, torch.version.cuda)"
24
+ # then pick the matching asset from https://github.com/turboderp-org/exllamav3/releases
25
+ ```
26
+ - An NVIDIA GPU of compute capability 8.0 or newer (Ampere, Ada, Hopper, Blackwell).
27
+
28
+ ## Install
29
+
30
+ ```
31
+ pip install vllm-quantpack
32
+ ```
33
+
34
+ It replaces OrcaSAQ2, `qwen38_exl3_vision`, `flint_vllm` and `spark_vllm`. If any of them is installed in the same
35
+ environment, uninstall it, or load only this plugin with `VLLM_PLUGINS=quantpack`.
36
+
37
+ ## Status
38
+
39
+ | Part | State |
40
+ |---|---|
41
+ | EXL3 linear, int8 embedding, lm_head | validated: same scores as the previous stack (dense Qwen 27B) |
42
+ | EXL3 MoE | validated on one GPU (Groot 19B-A3B): same as the previous stack within run-to-run noise |
43
+ | Tensor / expert parallelism | validated with MoE TP2 + EP (Groot 19B-A3B); Flash-Next TP not tested yet |
44
+ | Qwen vision, Flash-Next PLE | validated (Kestrel, Groot, Flash-Next 2.25) |
45
+ | Flint architecture | validated (Flint 3.88): same as flint_vllm within run-to-run noise |
46
+ | GPTQ with int4/int8 embeddings (Qwen3.5 family, vLLM <= 0.31) | validated: loads on unpatched vLLM 0.31, bit-identical to the patched vLLM in eager mode |
47
+ | Spark architecture | served (Spark-X2.5 4B) |
48
+ | Nemotron-3.5-Super-VL (gateless ReLU² MoE, MTP, vision) | served (2.25 bpw, one 96 GB GPU) |
49
+ | Every published JRamirez-UAB checkpoint | each served with its card's Quick start command on a clean vLLM 0.31 install: text, image and tool call answered |
50
+
51
+ ## Credits
52
+
53
+ Includes code from [OrcaSAQ2](https://github.com/Continuum-AI-Corp/OrcaSAQ2-kernel) (Apache-2.0). The EXL3 format and
54
+ kernels are [exllamav3](https://github.com/turboderp-org/exllamav3) by turboderp (MIT), a streamlined variant of
55
+ [QTIP](https://github.com/Cornell-RelaxML/qtip). See NOTICE.
56
+
57
+ ## License
58
+
59
+ Apache-2.0.
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vllm-quantpack"
7
+ version = "0.1.0"
8
+ description = "vLLM plugin: serve EXL3 (exllamav3 trellis) checkpoints and the model-family fixes they need, with no patch to vLLM"
9
+ requires-python = ">=3.10"
10
+ license = "Apache-2.0"
11
+ readme = "README.md"
12
+ authors = [{ name = "Jorge Ramírez Espejo" }]
13
+ classifiers = ["Development Status :: 3 - Alpha"]
14
+ # vLLM, torch and exllamav3 are deliberately not pinned: exllamav3's wheel is ABI-linked to torch and the CUDA major
15
+ # version and is published as a GitHub release asset, not on PyPI. See README.
16
+ dependencies = []
17
+
18
+ [project.urls]
19
+ Repository = "https://github.com/jramirez-uab/vllm-quantpack"
20
+
21
+ [project.entry-points."vllm.general_plugins"]
22
+ quantpack = "vllm_quantpack:register"
23
+
24
+ [tool.setuptools.packages.find]
25
+ include = ["vllm_quantpack*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,125 @@
1
+ """Pure helpers: shard slots, prefix handling, K, tensor-parallel ranges. No GPU, no vLLM."""
2
+ import pytest
3
+
4
+ from vllm_quantpack.exl3.names import expand, manifest_prefixes, norm_prefix, slot, trellis_k
5
+ from vllm_quantpack.exl3.tp_ranges import col_ranges, logical_parts, on_block, row_range
6
+
7
+
8
+ def test_slot_maps_every_loader_shard_id_form():
9
+ assert slot(None) == 0
10
+ assert slot(1) == 1
11
+ assert slot((0, 1, 2)) == 0
12
+ assert [slot(s) for s in ("q", "k", "v")] == [0, 1, 2]
13
+ with pytest.raises(ValueError):
14
+ slot("x")
15
+
16
+
17
+ def test_expand_returns_hf_names_of_fused_layers():
18
+ assert expand("model.layers.3.self_attn.qkv_proj") == [
19
+ "model.layers.3.self_attn.q_proj", "model.layers.3.self_attn.k_proj", "model.layers.3.self_attn.v_proj"]
20
+ assert expand("model.layers.3.linear_attn.in_proj_qkvz") == [
21
+ "model.layers.3.linear_attn.in_proj_qkv", "model.layers.3.linear_attn.in_proj_z"]
22
+ assert expand("model.layers.3.mlp.down_proj") == ["model.layers.3.mlp.down_proj"]
23
+
24
+
25
+ def test_norm_prefix_strips_one_tree_segment():
26
+ assert norm_prefix("language_model.model.layers.0.mlp.down_proj") == "layers.0.mlp.down_proj"
27
+ assert norm_prefix("model.layers.0.mlp.down_proj") == "layers.0.mlp.down_proj"
28
+ assert norm_prefix("backbone.layers.0.mixer.in_proj") == "layers.0.mixer.in_proj"
29
+ assert norm_prefix("visual.blocks.0.mlp.fc1") == "visual.blocks.0.mlp.fc1"
30
+
31
+
32
+ def test_manifest_keeps_only_modules_with_a_trellis():
33
+ ts = {
34
+ "model.layers.0.mlp.down_proj": {"stored_tensors": {"model.layers.0.mlp.down_proj.trellis": {}}},
35
+ "model.layers.0.linear_attn.in_proj_a": {"stored_tensors": {"model.layers.0.linear_attn.in_proj_a.weight": {}}},
36
+ "backbone.layers.1.mixer.in_proj": {"stored_tensors": {"backbone.layers.1.mixer.in_proj.trellis": {}}},
37
+ }
38
+ assert manifest_prefixes(ts) == {"layers.0.mlp.down_proj", "layers.1.mixer.in_proj"}
39
+ assert manifest_prefixes({}) == set()
40
+
41
+
42
+ def test_trellis_k_keeps_mul1_half_rates():
43
+ assert trellis_k(64) == 4 and isinstance(trellis_k(64), int)
44
+ assert trellis_k(56) == 3.5
45
+
46
+
47
+ def test_logical_parts():
48
+ assert logical_parts(None, 3) == [0, 1, 2]
49
+ assert logical_parts(1, 2) == [1]
50
+ assert logical_parts((0, 1, 2), 4) == [0, 1, 2]
51
+ assert logical_parts("k", 3) == [1]
52
+
53
+
54
+ def test_col_ranges_single_partition():
55
+ # gate_proj of 17408 outputs, tp=2: each rank keeps half
56
+ assert col_ranges(17408, [0], [8704, 8704], 0, 2) == [(0, 8704)]
57
+ assert col_ranges(17408, [0], [8704, 8704], 1, 2) == [(8704, 17408)]
58
+
59
+
60
+ def test_col_ranges_tensor_holding_several_partitions():
61
+ # in_proj_qkv = q|k|v of 2048 each, tp=2: rank 1 keeps [q_1, k_1, v_1]
62
+ assert col_ranges(6144, [0, 1, 2], [1024, 1024, 1024, 4096], 1, 2) == [(1024, 2048), (3072, 4096), (5120, 6144)]
63
+
64
+
65
+ def test_col_ranges_replicated_kv_heads():
66
+ # k_proj with 2 KV heads of 256 on tp=4: ranks 0,1 share head 0 and ranks 2,3 share head 1
67
+ local = [1536, 256, 256]
68
+ assert [col_ranges(512, [1], local, r, 4) for r in range(4)] == [[(0, 256)], [(0, 256)], [(256, 512)], [(256, 512)]]
69
+
70
+
71
+ def test_col_ranges_padded_single_layer():
72
+ # Groot vision mlp.linear_fc1: 4304 outputs stored padded to 4352, tp=2; the padding columns belong to no rank
73
+ assert [col_ranges(4352, [0], [2152], r, 2) for r in range(2)] == [[(0, 2152)], [(2152, 4304)]]
74
+ with pytest.raises(NotImplementedError): # 128 extra columns or more is not padding
75
+ col_ranges(4432, [0], [2152], 0, 2)
76
+
77
+
78
+ def test_col_ranges_rejects_a_split_that_does_not_add_up():
79
+ with pytest.raises(NotImplementedError):
80
+ col_ranges(6000, [0, 1, 2], [1024, 1024, 1024], 0, 2)
81
+
82
+
83
+ def test_row_range_and_block_alignment():
84
+ assert row_range(1, 2560) == (2560, 5120)
85
+ assert on_block([(0, 2560), (2560, 5120)])
86
+ assert not on_block([(320, 640)])
87
+
88
+
89
+ def test_flint_interm_div_targets_only_late_layers_of_flint():
90
+ from vllm_quantpack.families.flint.interm_div import kind
91
+ assert kind("model.layers.46.mlp.shared_expert.gate_up_proj", "flint") == "shared_expert.gate_up_proj"
92
+ assert kind("model.layers.48.mlp.shared_expert.down_proj", "flint") == "shared_expert.down_proj"
93
+ assert kind("model.layers.47.mlp.experts", "flint") == "experts"
94
+ assert kind("model.layers.47.mlp.experts.routed", "flint") == "experts" # FusedMoEFactory child
95
+ assert kind("model.layers.45.mlp.experts", "flint") is None
96
+ assert kind("model.layers.46.self_attn.qkv_proj", "flint") is None
97
+ assert kind("model.layers.46.mlp.experts", "qwen3_5_moe") is None
98
+
99
+
100
+ def test_embedding_prefix_is_claimed_once_inside_its_context():
101
+ from vllm_quantpack.exl3.layers import embedding_prefix, take_embedding_prefix
102
+ assert take_embedding_prefix() is None
103
+ with embedding_prefix("model.language_model.embed_tokens"):
104
+ assert take_embedding_prefix() == "model.language_model.embed_tokens"
105
+ assert take_embedding_prefix() is None # only the model's own embed_tokens, not a later embedding
106
+ assert take_embedding_prefix() is None
107
+
108
+
109
+ def test_gateless_moe_is_detected_from_the_stored_projections():
110
+ from vllm_quantpack.exl3.names import gateless_up_key
111
+ gated = {(e, p, "trellis"): 0 for e in range(2) for p in ("gate_proj", "up_proj", "down_proj")}
112
+ relu2 = {(e, p, "trellis"): 0 for e in range(2) for p in ("up_proj", "down_proj")}
113
+ drafter = {(e, p, "trellis"): 0 for e in range(2) for p in ("gate_proj", "down_proj")} # up loaded into w1
114
+ assert gateless_up_key(gated, range(2)) is None
115
+ assert gateless_up_key(relu2, range(2)) == "up_proj"
116
+ assert gateless_up_key(drafter, range(2)) == "gate_proj"
117
+
118
+
119
+ def test_expert_store_key_maps_fused_parameter_names():
120
+ from vllm_quantpack.exl3.names import expert_store_key
121
+ assert expert_store_key("mtp.layers.0.mixer.experts.w13_trellis", "w1", 5) == (5, "gate_proj", "trellis")
122
+ assert expert_store_key("experts.w13_suh", "w3", "7") == (7, "up_proj", "suh")
123
+ assert expert_store_key("experts.w2_svh", "w2", 0) == (0, "down_proj", "svh")
124
+ assert expert_store_key("experts.w2_weight", "w2", 0) is None
125
+ assert expert_store_key("experts.e_score_correction_bias", None, 0) is None
@@ -0,0 +1,61 @@
1
+ """vllm-quantpack: serve EXL3 (exllamav3 trellis) checkpoints, and the model-family fixes they need, in stock vLLM.
2
+
3
+ Installed as a vLLM general plugin (entry point `vllm.general_plugins`), so `vllm serve <repo>` picks up any checkpoint
4
+ whose config says `quant_method: "exl3"` with no flag and no patch to vLLM.
5
+
6
+ Layout:
7
+ exl3/ quantization config, linear / embedding / MoE methods, the custom ops, tensor-parallel cuts
8
+ families/ fixes for specific model families (Qwen vision and Flash-Next PLE) and models vLLM lacks or
9
+ maps incompletely (Flint, Spark, Nemotron-3.5-Super-VL)
10
+
11
+ It replaces OrcaSAQ2 (whose code it includes, Apache-2.0), qwen38_exl3_vision, flint_vllm and spark_vllm, which must
12
+ not be installed alongside.
13
+ """
14
+ __version__ = "0.1.0"
15
+
16
+ # Entry-point names of the plugins this package replaces.
17
+ _CONFLICTS = ("orcasaq2", "qwen38_exl3_vision", "tarninfer_exl3", "flint_vllm", "spark_vllm")
18
+
19
+
20
+ def _conflicts():
21
+ """Replaced plugins that vLLM will also load: installed, and not left out by VLLM_PLUGINS."""
22
+ import os
23
+ from importlib.metadata import entry_points
24
+
25
+ allowed = os.environ.get("VLLM_PLUGINS")
26
+ allowed = None if allowed is None else {p.strip() for p in allowed.split(",")}
27
+ return sorted({ep.name for ep in entry_points(group="vllm.general_plugins")
28
+ if ep.name in _CONFLICTS and (allowed is None or ep.name in allowed)})
29
+
30
+
31
+ def register():
32
+ from vllm.logger import init_logger
33
+ from vllm.model_executor.layers.quantization import register_quantization_config
34
+
35
+ logger = init_logger("vllm.quantpack")
36
+ found = _conflicts()
37
+ if found:
38
+ # They register the same quant_method and patch the same classes; which one wins would depend on plugin order.
39
+ raise RuntimeError(f"vllm-quantpack replaces the vLLM plugin(s) {', '.join(found)}: uninstall them from this "
40
+ "environment, or leave them out with VLLM_PLUGINS=quantpack")
41
+
42
+ from .exl3.layers import patch_embedding_layers
43
+ from .exl3.linear import Exl3Config
44
+
45
+ try:
46
+ register_quantization_config("exl3")(Exl3Config)
47
+ except ValueError:
48
+ return # already registered in this process
49
+ patch_embedding_layers(logger)
50
+
51
+ from .exl3.spec_decode import patch_should_share
52
+ from .families import flint, nemotron, qwen, spark
53
+ patch_should_share(logger)
54
+ qwen.register(logger)
55
+ if flint.register(logger):
56
+ logger.info("vllm-quantpack: Flint model registered")
57
+ if spark.register(logger):
58
+ logger.info("vllm-quantpack: Spark model registered")
59
+ if nemotron.register(logger):
60
+ logger.info("vllm-quantpack: Nemotron-3.5-Super-VL model registered")
61
+ logger.info("vllm-quantpack %s: quant_method 'exl3' is loadable (linear, int8 embedding, MoE, TP)", __version__)
File without changes