compressed-tensors-nightly 0.7.1.20241101__py3-none-any.whl → 0.7.1.20241102__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/lifecycle/forward.py +2 -2
- compressed_tensors/quantization/quant_args.py +10 -14
- compressed_tensors/quantization/utils/helpers.py +0 -2
- compressed_tensors/registry/registry.py +1 -1
- {compressed_tensors_nightly-0.7.1.20241101.dist-info → compressed_tensors_nightly-0.7.1.20241102.dist-info}/METADATA +1 -1
- {compressed_tensors_nightly-0.7.1.20241101.dist-info → compressed_tensors_nightly-0.7.1.20241102.dist-info}/RECORD +9 -9
- {compressed_tensors_nightly-0.7.1.20241101.dist-info → compressed_tensors_nightly-0.7.1.20241102.dist-info}/LICENSE +0 -0
- {compressed_tensors_nightly-0.7.1.20241101.dist-info → compressed_tensors_nightly-0.7.1.20241102.dist-info}/WHEEL +0 -0
- {compressed_tensors_nightly-0.7.1.20241101.dist-info → compressed_tensors_nightly-0.7.1.20241102.dist-info}/top_level.txt +0 -0
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
from functools import wraps
|
16
16
|
from math import ceil
|
17
|
-
from typing import
|
17
|
+
from typing import Optional
|
18
18
|
|
19
19
|
import torch
|
20
20
|
from compressed_tensors.quantization.quant_args import (
|
@@ -28,7 +28,7 @@ from compressed_tensors.quantization.utils import (
|
|
28
28
|
calculate_range,
|
29
29
|
compute_dynamic_scales_and_zp,
|
30
30
|
)
|
31
|
-
from compressed_tensors.utils import safe_permute
|
31
|
+
from compressed_tensors.utils import safe_permute
|
32
32
|
from torch.nn import Module
|
33
33
|
|
34
34
|
|
@@ -114,12 +114,6 @@ class QuantizationArgs(BaseModel, use_enum_values=True):
|
|
114
114
|
"""
|
115
115
|
:return: torch quantization FakeQuantize built based on these QuantizationArgs
|
116
116
|
"""
|
117
|
-
|
118
|
-
# No observer required for the dynamic case
|
119
|
-
if self.dynamic:
|
120
|
-
self.observer = None
|
121
|
-
return self.observer
|
122
|
-
|
123
117
|
return self.observer
|
124
118
|
|
125
119
|
@field_validator("type", mode="before")
|
@@ -203,6 +197,7 @@ class QuantizationArgs(BaseModel, use_enum_values=True):
|
|
203
197
|
"activation ordering"
|
204
198
|
)
|
205
199
|
|
200
|
+
# infer observer w.r.t. dynamic
|
206
201
|
if dynamic:
|
207
202
|
if strategy not in (
|
208
203
|
QuantizationStrategy.TOKEN,
|
@@ -214,18 +209,19 @@ class QuantizationArgs(BaseModel, use_enum_values=True):
|
|
214
209
|
"quantization",
|
215
210
|
)
|
216
211
|
if observer is not None:
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
212
|
+
if observer != "memoryless": # avoid annoying users with old configs
|
213
|
+
warnings.warn(
|
214
|
+
"No observer is used for dynamic quantization, setting to None"
|
215
|
+
)
|
216
|
+
observer = None
|
221
217
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
model.observer = "minmax"
|
218
|
+
elif observer is None:
|
219
|
+
# default to minmax for non-dynamic cases
|
220
|
+
observer = "minmax"
|
226
221
|
|
227
222
|
# write back modified values
|
228
223
|
model.strategy = strategy
|
224
|
+
model.observer = observer
|
229
225
|
return model
|
230
226
|
|
231
227
|
def pytorch_dtype(self) -> torch.dtype:
|
@@ -233,7 +233,6 @@ def iter_named_leaf_modules(model: Module) -> Generator[Tuple[str, Module], None
|
|
233
233
|
named_children, children = zip(*list(submodule.named_children()))
|
234
234
|
has_non_observer_children = False
|
235
235
|
for i in range(len(children)):
|
236
|
-
child = children[i]
|
237
236
|
child_name = named_children[i]
|
238
237
|
|
239
238
|
if "observer" not in child_name:
|
@@ -268,7 +267,6 @@ def iter_named_quantizable_modules(
|
|
268
267
|
has_non_observer_children = False
|
269
268
|
for i in range(len(children)):
|
270
269
|
child_name = named_children[i]
|
271
|
-
child = children[i]
|
272
270
|
|
273
271
|
if "observer" not in child_name:
|
274
272
|
has_non_observer_children = True
|
@@ -258,7 +258,7 @@ def get_from_registry(
|
|
258
258
|
retrieved_value = _import_and_get_value_from_module(module_path, value_name)
|
259
259
|
else:
|
260
260
|
# look up name in alias registry
|
261
|
-
name = _ALIAS_REGISTRY[parent_class].get(name)
|
261
|
+
name = _ALIAS_REGISTRY[parent_class].get(name, name)
|
262
262
|
# look up name in registry
|
263
263
|
retrieved_value = _REGISTRY[parent_class].get(name)
|
264
264
|
if retrieved_value is None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: compressed-tensors-nightly
|
3
|
-
Version: 0.7.1.
|
3
|
+
Version: 0.7.1.20241102
|
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.
|
@@ -23,19 +23,19 @@ compressed_tensors/config/sparse_bitmask.py,sha256=pZUboRNZTu6NajGOQEFExoPknak5y
|
|
23
23
|
compressed_tensors/linear/__init__.py,sha256=fH6rjBYAxuwrTzBTlTjTgCYNyh6TCvCqajCz4Im4YrA,617
|
24
24
|
compressed_tensors/linear/compressed_linear.py,sha256=0jTTf6XxOAjAYs3tvFtgiNMAO4W10sSeR-pdH2M413g,3218
|
25
25
|
compressed_tensors/quantization/__init__.py,sha256=83J5bPB7PavN2TfCoW7_vEDhfYpm4TDrqYO9vdSQ5bk,760
|
26
|
-
compressed_tensors/quantization/quant_args.py,sha256=
|
26
|
+
compressed_tensors/quantization/quant_args.py,sha256=osjNwCSB6tcyH9Qeg5sHEiB-bHyi3XJ8TzkGVJuGTc4,8711
|
27
27
|
compressed_tensors/quantization/quant_config.py,sha256=NCiMvUMnnz5kTyAkDylxjtEGQnjgsIYIeNR2zyHEdTQ,10371
|
28
28
|
compressed_tensors/quantization/quant_scheme.py,sha256=5ggPz5sqEfTUgvJJeiPIINA74QtO-08hb3szsm7UHGE,6000
|
29
29
|
compressed_tensors/quantization/lifecycle/__init__.py,sha256=_uItzFWusyV74Zco_pHLOTdE9a83cL-R-ZdyQrBkIyw,772
|
30
30
|
compressed_tensors/quantization/lifecycle/apply.py,sha256=pdCqxXnVw7HoDDanaOtek13g8x_nb54CBUlfuMdhFG4,14993
|
31
31
|
compressed_tensors/quantization/lifecycle/compressed.py,sha256=Fj9n66IN0EWsOAkBHg3O0GlOQpxstqjCcs0ttzMXrJ0,2296
|
32
|
-
compressed_tensors/quantization/lifecycle/forward.py,sha256=
|
32
|
+
compressed_tensors/quantization/lifecycle/forward.py,sha256=QPL6-vKOFuKdKIEsVqMhsw4x552Jpm2sqO0oeChbnrM,12941
|
33
33
|
compressed_tensors/quantization/lifecycle/helpers.py,sha256=C0mhy2vJ0fCjVeN4kFNhw8Eq1wkteBGHiZ36RVLThRY,944
|
34
34
|
compressed_tensors/quantization/lifecycle/initialize.py,sha256=C41hKA5VANyEwkB5FxzEn3Z0Da5tfxF1I07P8rUcyS0,8537
|
35
35
|
compressed_tensors/quantization/utils/__init__.py,sha256=VdtEmP0bvuND_IGQnyqUPc5lnFp-1_yD7StKSX4x80w,656
|
36
|
-
compressed_tensors/quantization/utils/helpers.py,sha256=
|
36
|
+
compressed_tensors/quantization/utils/helpers.py,sha256=DBP-sGRpGAY01K0LFE7qqonNj4hkTYL_mXrMs2LtAD8,14100
|
37
37
|
compressed_tensors/registry/__init__.py,sha256=FwLSNYqfIrb5JD_6OK_MT4_svvKTN_nEhpgQlQvGbjI,658
|
38
|
-
compressed_tensors/registry/registry.py,sha256=
|
38
|
+
compressed_tensors/registry/registry.py,sha256=vRcjVB1ITfSbfYUaGndBBmqhip_5vsS62weorVg0iXo,11896
|
39
39
|
compressed_tensors/utils/__init__.py,sha256=gS4gSU2pwcAbsKj-6YMaqhm25udFy6ISYaWBf-myRSM,808
|
40
40
|
compressed_tensors/utils/helpers.py,sha256=hWGIR0W7ENHwdC7wW2SQJJiCF9-xOu_u3fY2RzLyYg4,4101
|
41
41
|
compressed_tensors/utils/offload.py,sha256=d9q8LNe8HyF8tOjgjA7QGLD3HRysmNp0d8eBbdqBgIM,4089
|
@@ -43,8 +43,8 @@ compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVy
|
|
43
43
|
compressed_tensors/utils/permute.py,sha256=V6tJLKo3Syccj-viv4F7ZKZgJeCB-hl-dK8RKI_kBwI,2355
|
44
44
|
compressed_tensors/utils/safetensors_load.py,sha256=m08ANVuTBxQdoa6LufDgcNJ7wCLDJolyZljB8VEybAU,8578
|
45
45
|
compressed_tensors/utils/semi_structured_conversions.py,sha256=XKNffPum54kPASgqKzgKvyeqWPAkair2XEQXjkp7ho8,13489
|
46
|
-
compressed_tensors_nightly-0.7.1.
|
47
|
-
compressed_tensors_nightly-0.7.1.
|
48
|
-
compressed_tensors_nightly-0.7.1.
|
49
|
-
compressed_tensors_nightly-0.7.1.
|
50
|
-
compressed_tensors_nightly-0.7.1.
|
46
|
+
compressed_tensors_nightly-0.7.1.20241102.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
47
|
+
compressed_tensors_nightly-0.7.1.20241102.dist-info/METADATA,sha256=pQ8FXKctjUHKkisrXYyeDUuunknVPkjHnHvS-uJ89oI,6799
|
48
|
+
compressed_tensors_nightly-0.7.1.20241102.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
49
|
+
compressed_tensors_nightly-0.7.1.20241102.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
|
50
|
+
compressed_tensors_nightly-0.7.1.20241102.dist-info/RECORD,,
|
File without changes
|
File without changes
|