compressed-tensors 0.10.3a20250814__py3-none-any.whl → 0.10.3a20250815__py3-none-any.whl
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.
- compressed_tensors/quantization/quant_scheme.py +6 -0
- compressed_tensors/utils/match.py +16 -8
- compressed_tensors/version.py +1 -1
- {compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/METADATA +1 -1
- {compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/RECORD +8 -8
- {compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/WHEEL +0 -0
- {compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/licenses/LICENSE +0 -0
- {compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/top_level.txt +0 -0
@@ -57,6 +57,7 @@ class QuantizationScheme(BaseModel):
|
|
57
57
|
inputs = model.input_activations
|
58
58
|
outputs = model.output_activations
|
59
59
|
weights = model.weights
|
60
|
+
format = model.format
|
60
61
|
|
61
62
|
if inputs is not None:
|
62
63
|
if inputs.actorder is not None:
|
@@ -66,6 +67,11 @@ class QuantizationScheme(BaseModel):
|
|
66
67
|
if outputs.actorder is not None:
|
67
68
|
raise ValueError("Cannot apply actorder to output activations")
|
68
69
|
|
70
|
+
if format == CompressionFormat.mixed_precision.value:
|
71
|
+
raise ValueError(
|
72
|
+
"mixed-precision cannot be set as a format for a QuantizationScheme"
|
73
|
+
)
|
74
|
+
|
69
75
|
if (
|
70
76
|
inputs
|
71
77
|
and weights
|
@@ -15,7 +15,7 @@
|
|
15
15
|
import logging
|
16
16
|
import re
|
17
17
|
from collections.abc import Generator
|
18
|
-
from typing import Iterable, Mapping, Optional, Tuple
|
18
|
+
from typing import Iterable, List, Mapping, Optional, Tuple, Union
|
19
19
|
|
20
20
|
import torch
|
21
21
|
from compressed_tensors.utils.internal import InternalModule
|
@@ -57,10 +57,10 @@ def match_named_modules(
|
|
57
57
|
unmatched_targets = set(targets)
|
58
58
|
for name, module in model.named_modules():
|
59
59
|
for target in targets:
|
60
|
-
if is_match(name, module, target, fused):
|
60
|
+
if is_match(name, module, target, fused=fused):
|
61
61
|
unmatched_targets -= {target}
|
62
62
|
|
63
|
-
if not
|
63
|
+
if not is_match(name, module, ignore, fused=fused):
|
64
64
|
yield name, module
|
65
65
|
|
66
66
|
if warn_on_fail:
|
@@ -155,9 +155,7 @@ def match_modules_set(
|
|
155
155
|
for name, module in model.named_modules():
|
156
156
|
# match until we get a full set
|
157
157
|
for target in targets:
|
158
|
-
if is_match(name, module, target)
|
159
|
-
is_match(name, module, ign) for ign in ignore
|
160
|
-
):
|
158
|
+
if is_match(name, module, target, ignore):
|
161
159
|
if matches[target] is not None:
|
162
160
|
raise ValueError(f"Matched a {target} twice before completing set")
|
163
161
|
matches[target] = module
|
@@ -176,7 +174,8 @@ def match_modules_set(
|
|
176
174
|
def is_match(
|
177
175
|
name: str,
|
178
176
|
module: torch.nn.Module,
|
179
|
-
|
177
|
+
targets: Union[str, Iterable[str]],
|
178
|
+
ignore: Union[str, Iterable[str]] = tuple(),
|
180
179
|
fused: Optional[FusedMappping] = None,
|
181
180
|
) -> bool:
|
182
181
|
"""
|
@@ -198,8 +197,17 @@ def is_match(
|
|
198
197
|
:fused: optional mapping from suffixes of fused modules to the suffixes of their
|
199
198
|
corresponding shards
|
200
199
|
"""
|
200
|
+
targets = [targets] if isinstance(targets, str) else targets
|
201
|
+
ignore = [ignore] if isinstance(ignore, str) else ignore
|
202
|
+
|
201
203
|
return not isinstance(module, InternalModule) and (
|
202
|
-
|
204
|
+
any(
|
205
|
+
_match_name(name, target, fused) or _match_class(module, target)
|
206
|
+
for target in targets
|
207
|
+
)
|
208
|
+
and not any(
|
209
|
+
_match_name(name, ign, fused) or _match_class(module, ign) for ign in ignore
|
210
|
+
)
|
203
211
|
)
|
204
212
|
|
205
213
|
|
compressed_tensors/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: compressed-tensors
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.3a20250815
|
4
4
|
Summary: Library for utilization of compressed safetensors of neural network models
|
5
5
|
Home-page: https://github.com/neuralmagic/compressed-tensors
|
6
6
|
Author: Neuralmagic, Inc.
|
{compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/RECORD
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
compressed_tensors/__init__.py,sha256=UtKmifNeBCSE2TZSAfduVNNzHY-3V7bLjZ7n7RuXLOE,812
|
2
2
|
compressed_tensors/base.py,sha256=-gxWvDF4LCkyeDP8YlGzvBBKxo4Dk9h4NINPD61drFU,921
|
3
|
-
compressed_tensors/version.py,sha256=
|
3
|
+
compressed_tensors/version.py,sha256=1JqJh97eWZXfHLksxjnDuB_L_AnpoTmOX1f4q6YZeM4,523
|
4
4
|
compressed_tensors/compressors/__init__.py,sha256=smSygTSfcfuujRrAXDc6uZm4L_ccV1tWZewqVnOb4lM,825
|
5
5
|
compressed_tensors/compressors/base.py,sha256=nvWsv4xEw1Tkxkxth6TmHplDYXfBeP22xWxOsZERyDY,7204
|
6
6
|
compressed_tensors/compressors/helpers.py,sha256=OK6qxX9j3bHwF9JfIYSGMgBJe2PWjlTA3byXKCJaTIQ,5431
|
@@ -28,7 +28,7 @@ compressed_tensors/linear/compressed_linear.py,sha256=1yo9RyjA0aQ--iuIknFfcSorJn
|
|
28
28
|
compressed_tensors/quantization/__init__.py,sha256=83J5bPB7PavN2TfCoW7_vEDhfYpm4TDrqYO9vdSQ5bk,760
|
29
29
|
compressed_tensors/quantization/quant_args.py,sha256=PMoaa6hpyJLGGSeCWefGmzGVxbOtxAdDunHJi_L5gNs,12894
|
30
30
|
compressed_tensors/quantization/quant_config.py,sha256=2NgDwKuQn0f-ojiHC8c6tXtYX_zQlk26Rj-bU71QKvA,10598
|
31
|
-
compressed_tensors/quantization/quant_scheme.py,sha256=
|
31
|
+
compressed_tensors/quantization/quant_scheme.py,sha256=aTdGWz_JenLlTqCeNFcujCJjgWQYkXEq2FXoN0YSNqI,8883
|
32
32
|
compressed_tensors/quantization/lifecycle/__init__.py,sha256=_uItzFWusyV74Zco_pHLOTdE9a83cL-R-ZdyQrBkIyw,772
|
33
33
|
compressed_tensors/quantization/lifecycle/apply.py,sha256=wM8mVcbKvZjBo18pSXMp28i30YWwUXJPSS7_HCakH9U,17892
|
34
34
|
compressed_tensors/quantization/lifecycle/compressed.py,sha256=Fj9n66IN0EWsOAkBHg3O0GlOQpxstqjCcs0ttzMXrJ0,2296
|
@@ -56,15 +56,15 @@ compressed_tensors/transform/utils/matrix.py,sha256=FIHCUlpWVIIhdr3c6EbQec41JeiP
|
|
56
56
|
compressed_tensors/utils/__init__.py,sha256=spzbjUO4-hZ2jXGST27r3MIt2yzIXsjdbEaYyaMcizo,873
|
57
57
|
compressed_tensors/utils/helpers.py,sha256=Q3iRAa2XSdmmn4vSpUplnvKOmWwn4Clao9ZkPBHXtpI,12604
|
58
58
|
compressed_tensors/utils/internal.py,sha256=7SSWgDoNFRnlfadwkoFhLW-T2jOc7Po_WzWv5h32Sa8,982
|
59
|
-
compressed_tensors/utils/match.py,sha256=
|
59
|
+
compressed_tensors/utils/match.py,sha256=wXzcfUWlVE5Wc_OAvN7oUFqLhVHJ83oSt1Nhzw01igg,9701
|
60
60
|
compressed_tensors/utils/offload.py,sha256=gFoEDaissHsLM5-JDbgPxh5hiE9VFN4HFxvszYvReos,24446
|
61
61
|
compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVyah6BUUir_StT28,2530
|
62
62
|
compressed_tensors/utils/permute.py,sha256=V6tJLKo3Syccj-viv4F7ZKZgJeCB-hl-dK8RKI_kBwI,2355
|
63
63
|
compressed_tensors/utils/safetensors_load.py,sha256=DMfZBuUbA6qp_BG_zIWT3ckiEE33K9ob34s-OgzReO4,12057
|
64
64
|
compressed_tensors/utils/semi_structured_conversions.py,sha256=XKNffPum54kPASgqKzgKvyeqWPAkair2XEQXjkp7ho8,13489
|
65
65
|
compressed_tensors/utils/type.py,sha256=bNwoo_FWlvLuDpYAGGzZJITRg0JA_Ngk9LGPo-kvjeU,2554
|
66
|
-
compressed_tensors-0.10.
|
67
|
-
compressed_tensors-0.10.
|
68
|
-
compressed_tensors-0.10.
|
69
|
-
compressed_tensors-0.10.
|
70
|
-
compressed_tensors-0.10.
|
66
|
+
compressed_tensors-0.10.3a20250815.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
67
|
+
compressed_tensors-0.10.3a20250815.dist-info/METADATA,sha256=kvr-VW6uApIV2l4GOuY4Zdldsw2aBccQkbZTXMKIXOU,7031
|
68
|
+
compressed_tensors-0.10.3a20250815.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
69
|
+
compressed_tensors-0.10.3a20250815.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
|
70
|
+
compressed_tensors-0.10.3a20250815.dist-info/RECORD,,
|
{compressed_tensors-0.10.3a20250814.dist-info → compressed_tensors-0.10.3a20250815.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|