compressed-tensors 0.9.5a20250520__py3-none-any.whl → 0.9.5a20250521__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/initialize.py +3 -0
- compressed_tensors/quantization/quant_args.py +2 -2
- compressed_tensors/registry/registry.py +12 -11
- compressed_tensors/version.py +1 -1
- {compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/METADATA +1 -1
- {compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/RECORD +9 -9
- {compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/WHEEL +0 -0
- {compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/licenses/LICENSE +0 -0
- {compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/top_level.txt +0 -0
@@ -304,6 +304,9 @@ def update_fused_layer_weight_global_scales(model: torch.nn.Module):
|
|
304
304
|
):
|
305
305
|
|
306
306
|
if _is_attention_module(submodule):
|
307
|
+
# already fused/treated as one layer
|
308
|
+
if hasattr(submodule, "qkv_proj"):
|
309
|
+
continue
|
307
310
|
|
308
311
|
if not _valid_fp4_quant(
|
309
312
|
[submodule.q_proj, submodule.v_proj, submodule.k_proj]
|
@@ -269,8 +269,8 @@ class QuantizationArgs(BaseModel, use_enum_values=True):
|
|
269
269
|
observer = None
|
270
270
|
|
271
271
|
elif observer is None:
|
272
|
-
# default to
|
273
|
-
observer = "
|
272
|
+
# default to mse for non-dynamic cases
|
273
|
+
observer = "mse"
|
274
274
|
|
275
275
|
# write back modified values
|
276
276
|
model.strategy = strategy
|
@@ -19,7 +19,7 @@ of neuralmagic utilities
|
|
19
19
|
|
20
20
|
import importlib
|
21
21
|
from collections import defaultdict
|
22
|
-
from typing import Any, Dict, List, Optional,
|
22
|
+
from typing import Any, Dict, List, Optional, TypeVar, Union
|
23
23
|
|
24
24
|
|
25
25
|
__all__ = [
|
@@ -32,8 +32,9 @@ __all__ = [
|
|
32
32
|
]
|
33
33
|
|
34
34
|
|
35
|
-
_ALIAS_REGISTRY: Dict[
|
36
|
-
_REGISTRY: Dict[
|
35
|
+
_ALIAS_REGISTRY: Dict[type, Dict[str, str]] = defaultdict(dict)
|
36
|
+
_REGISTRY: Dict[type, Dict[str, Any]] = defaultdict(dict)
|
37
|
+
T = TypeVar("", bound="RegistryMixin")
|
37
38
|
|
38
39
|
|
39
40
|
def standardize_lookup_name(name: str) -> str:
|
@@ -159,7 +160,7 @@ class RegistryMixin:
|
|
159
160
|
)
|
160
161
|
|
161
162
|
@classmethod
|
162
|
-
def load_from_registry(cls, name: str, **constructor_kwargs) ->
|
163
|
+
def load_from_registry(cls: type[T], name: str, **constructor_kwargs) -> T:
|
163
164
|
"""
|
164
165
|
:param name: name of registered class to load
|
165
166
|
:param constructor_kwargs: arguments to pass to the constructor retrieved
|
@@ -172,7 +173,7 @@ class RegistryMixin:
|
|
172
173
|
return constructor(**constructor_kwargs)
|
173
174
|
|
174
175
|
@classmethod
|
175
|
-
def get_value_from_registry(cls, name: str):
|
176
|
+
def get_value_from_registry(cls: type[T], name: str) -> T:
|
176
177
|
"""
|
177
178
|
:param name: name to retrieve from the registry
|
178
179
|
:return: value from retrieved the registry for the given name, raises
|
@@ -200,7 +201,7 @@ class RegistryMixin:
|
|
200
201
|
|
201
202
|
|
202
203
|
def register(
|
203
|
-
parent_class:
|
204
|
+
parent_class: type,
|
204
205
|
value: Any,
|
205
206
|
name: Optional[str] = None,
|
206
207
|
alias: Union[List[str], str, None] = None,
|
@@ -240,7 +241,7 @@ def register(
|
|
240
241
|
|
241
242
|
|
242
243
|
def get_from_registry(
|
243
|
-
parent_class:
|
244
|
+
parent_class: type, name: str, require_subclass: bool = False
|
244
245
|
) -> Any:
|
245
246
|
"""
|
246
247
|
:param parent_class: class that the name is registered under
|
@@ -276,7 +277,7 @@ def get_from_registry(
|
|
276
277
|
return retrieved_value
|
277
278
|
|
278
279
|
|
279
|
-
def registered_names(parent_class:
|
280
|
+
def registered_names(parent_class: type) -> List[str]:
|
280
281
|
"""
|
281
282
|
:param parent_class: class to look up the registry of
|
282
283
|
:return: all names registered to the given class
|
@@ -284,7 +285,7 @@ def registered_names(parent_class: Type) -> List[str]:
|
|
284
285
|
return list(_REGISTRY[parent_class].keys())
|
285
286
|
|
286
287
|
|
287
|
-
def registered_aliases(parent_class:
|
288
|
+
def registered_aliases(parent_class: type) -> List[str]:
|
288
289
|
"""
|
289
290
|
:param parent_class: class to look up the registry of
|
290
291
|
:return: all aliases registered to the given class
|
@@ -297,7 +298,7 @@ def registered_aliases(parent_class: Type) -> List[str]:
|
|
297
298
|
|
298
299
|
|
299
300
|
def register_alias(
|
300
|
-
name: str, parent_class:
|
301
|
+
name: str, parent_class: type, alias: Union[str, List[str], None] = None
|
301
302
|
):
|
302
303
|
"""
|
303
304
|
Updates the mapping from the alias(es) to the given name.
|
@@ -352,7 +353,7 @@ def _import_and_get_value_from_module(module_path: str, value_name: str) -> Any:
|
|
352
353
|
return value
|
353
354
|
|
354
355
|
|
355
|
-
def _validate_subclass(parent_class:
|
356
|
+
def _validate_subclass(parent_class: type, child_class: type):
|
356
357
|
if not issubclass(child_class, parent_class):
|
357
358
|
raise ValueError(
|
358
359
|
f"class {child_class} is not a subclass of the class it is "
|
compressed_tensors/version.py
CHANGED
{compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: compressed-tensors
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.5a20250521
|
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.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.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=73HYH7HY7O2roC89yG_piPFnZwrBfn_i7HmKl90SKc0,875
|
3
|
-
compressed_tensors/version.py,sha256=
|
3
|
+
compressed_tensors/version.py,sha256=FJ5OPohL511E88TFF_Jipl_3ikvZ6NgmdrYxPbi2vo8,521
|
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
|
@@ -26,7 +26,7 @@ compressed_tensors/config/sparse_bitmask.py,sha256=pZUboRNZTu6NajGOQEFExoPknak5y
|
|
26
26
|
compressed_tensors/linear/__init__.py,sha256=fH6rjBYAxuwrTzBTlTjTgCYNyh6TCvCqajCz4Im4YrA,617
|
27
27
|
compressed_tensors/linear/compressed_linear.py,sha256=1yo9RyjA0aQ--iuIknFfcSorJn43Mn4CoV-q4JlTJ_o,4052
|
28
28
|
compressed_tensors/quantization/__init__.py,sha256=83J5bPB7PavN2TfCoW7_vEDhfYpm4TDrqYO9vdSQ5bk,760
|
29
|
-
compressed_tensors/quantization/quant_args.py,sha256=
|
29
|
+
compressed_tensors/quantization/quant_args.py,sha256=5-mq43RmbI81z9Xl9pYNv4bqIP5AIT65FgT--4ERsE8,10502
|
30
30
|
compressed_tensors/quantization/quant_config.py,sha256=MxSUcb5dOqMN6LFyD5K2h8X0TvEtcWIAoiUJqD2dHGE,10159
|
31
31
|
compressed_tensors/quantization/quant_scheme.py,sha256=Fx7Ma4bDlFB6OWkHKhOB6_0AOVIOPRgNE_qTwmDLSbc,6586
|
32
32
|
compressed_tensors/quantization/lifecycle/__init__.py,sha256=_uItzFWusyV74Zco_pHLOTdE9a83cL-R-ZdyQrBkIyw,772
|
@@ -34,11 +34,11 @@ compressed_tensors/quantization/lifecycle/apply.py,sha256=-OKZ-FFFfIIoeGTrho8lXx
|
|
34
34
|
compressed_tensors/quantization/lifecycle/compressed.py,sha256=Fj9n66IN0EWsOAkBHg3O0GlOQpxstqjCcs0ttzMXrJ0,2296
|
35
35
|
compressed_tensors/quantization/lifecycle/forward.py,sha256=WY-HY5kXY2Zs9HMpaq44bpolQUAQ1ELrNZC7GM5C4jw,14494
|
36
36
|
compressed_tensors/quantization/lifecycle/helpers.py,sha256=C0mhy2vJ0fCjVeN4kFNhw8Eq1wkteBGHiZ36RVLThRY,944
|
37
|
-
compressed_tensors/quantization/lifecycle/initialize.py,sha256=
|
37
|
+
compressed_tensors/quantization/lifecycle/initialize.py,sha256=dWXxjYLemjmtrSnb8vyuvNoNTSm8ywmUswze3soKY4o,12041
|
38
38
|
compressed_tensors/quantization/utils/__init__.py,sha256=VdtEmP0bvuND_IGQnyqUPc5lnFp-1_yD7StKSX4x80w,656
|
39
39
|
compressed_tensors/quantization/utils/helpers.py,sha256=w3Ucpdog88b0MnZdJ37VzgtYi1fqrwJafYdfWPc0hTk,16852
|
40
40
|
compressed_tensors/registry/__init__.py,sha256=FwLSNYqfIrb5JD_6OK_MT4_svvKTN_nEhpgQlQvGbjI,658
|
41
|
-
compressed_tensors/registry/registry.py,sha256=
|
41
|
+
compressed_tensors/registry/registry.py,sha256=0s15BxdGgzBv8RL4kUJCYcuDOFUh_KZYvNvLEeRqWTc,11956
|
42
42
|
compressed_tensors/utils/__init__.py,sha256=gS4gSU2pwcAbsKj-6YMaqhm25udFy6ISYaWBf-myRSM,808
|
43
43
|
compressed_tensors/utils/helpers.py,sha256=RrNvzD08naEjEiXdU-FdZjQVda1nQywu1hA_GCDj0vg,10415
|
44
44
|
compressed_tensors/utils/offload.py,sha256=JNQ66_6vhSsizhlUaMgyEdBuFolYxbgUuT1mAZrCfKY,15436
|
@@ -46,8 +46,8 @@ compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVy
|
|
46
46
|
compressed_tensors/utils/permute.py,sha256=V6tJLKo3Syccj-viv4F7ZKZgJeCB-hl-dK8RKI_kBwI,2355
|
47
47
|
compressed_tensors/utils/safetensors_load.py,sha256=DMfZBuUbA6qp_BG_zIWT3ckiEE33K9ob34s-OgzReO4,12057
|
48
48
|
compressed_tensors/utils/semi_structured_conversions.py,sha256=XKNffPum54kPASgqKzgKvyeqWPAkair2XEQXjkp7ho8,13489
|
49
|
-
compressed_tensors-0.9.
|
50
|
-
compressed_tensors-0.9.
|
51
|
-
compressed_tensors-0.9.
|
52
|
-
compressed_tensors-0.9.
|
53
|
-
compressed_tensors-0.9.
|
49
|
+
compressed_tensors-0.9.5a20250521.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
50
|
+
compressed_tensors-0.9.5a20250521.dist-info/METADATA,sha256=Xl6EbYwMlKhFyy6VXtxD2x0TsiTDG36YszGdub5wLqM,7004
|
51
|
+
compressed_tensors-0.9.5a20250521.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
52
|
+
compressed_tensors-0.9.5a20250521.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
|
53
|
+
compressed_tensors-0.9.5a20250521.dist-info/RECORD,,
|
{compressed_tensors-0.9.5a20250520.dist-info → compressed_tensors-0.9.5a20250521.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|