compressed-tensors-nightly 0.8.0.20241201__py3-none-any.whl → 0.8.0.20241204__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_args.py +16 -3
- compressed_tensors/quantization/quant_scheme.py +1 -0
- compressed_tensors/utils/helpers.py +33 -1
- {compressed_tensors_nightly-0.8.0.20241201.dist-info → compressed_tensors_nightly-0.8.0.20241204.dist-info}/METADATA +1 -1
- {compressed_tensors_nightly-0.8.0.20241201.dist-info → compressed_tensors_nightly-0.8.0.20241204.dist-info}/RECORD +8 -8
- {compressed_tensors_nightly-0.8.0.20241201.dist-info → compressed_tensors_nightly-0.8.0.20241204.dist-info}/LICENSE +0 -0
- {compressed_tensors_nightly-0.8.0.20241201.dist-info → compressed_tensors_nightly-0.8.0.20241204.dist-info}/WHEEL +0 -0
- {compressed_tensors_nightly-0.8.0.20241201.dist-info → compressed_tensors_nightly-0.8.0.20241204.dist-info}/top_level.txt +0 -0
@@ -17,6 +17,7 @@ from enum import Enum
|
|
17
17
|
from typing import Any, Dict, Optional, Union
|
18
18
|
|
19
19
|
import torch
|
20
|
+
from compressed_tensors.utils import Aliasable
|
20
21
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
21
22
|
|
22
23
|
|
@@ -53,17 +54,29 @@ class QuantizationStrategy(str, Enum):
|
|
53
54
|
TOKEN = "token"
|
54
55
|
|
55
56
|
|
56
|
-
class ActivationOrdering(str, Enum):
|
57
|
+
class ActivationOrdering(Aliasable, str, Enum):
|
57
58
|
"""
|
58
59
|
Enum storing strategies for activation ordering
|
59
60
|
|
60
61
|
Group: reorder groups and weight\n
|
61
|
-
Weight: only reorder weight, not groups. Slightly lower
|
62
|
-
|
62
|
+
Weight: only reorder weight, not groups. Slightly lower accuracy but also lower
|
63
|
+
latency when compared to group actorder\n
|
64
|
+
Dynamic: alias for Group\n
|
65
|
+
Static: alias for Weight\n
|
63
66
|
"""
|
64
67
|
|
65
68
|
GROUP = "group"
|
66
69
|
WEIGHT = "weight"
|
70
|
+
# aliases
|
71
|
+
DYNAMIC = "dynamic"
|
72
|
+
STATIC = "static"
|
73
|
+
|
74
|
+
@staticmethod
|
75
|
+
def get_aliases() -> Dict[str, str]:
|
76
|
+
return {
|
77
|
+
"dynamic": "group",
|
78
|
+
"static": "weight",
|
79
|
+
}
|
67
80
|
|
68
81
|
|
69
82
|
class QuantizationArgs(BaseModel, use_enum_values=True):
|
@@ -12,7 +12,7 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
from typing import Any, Optional
|
15
|
+
from typing import Any, Dict, Optional
|
16
16
|
|
17
17
|
import torch
|
18
18
|
from transformers import AutoConfig
|
@@ -24,6 +24,7 @@ __all__ = [
|
|
24
24
|
"tensor_follows_mask_structure",
|
25
25
|
"replace_module",
|
26
26
|
"is_compressed_tensors_config",
|
27
|
+
"Aliasable",
|
27
28
|
]
|
28
29
|
|
29
30
|
FSDP_WRAPPER_NAME = "_fsdp_wrapped_module"
|
@@ -119,3 +120,34 @@ def is_compressed_tensors_config(compression_config: Any) -> bool:
|
|
119
120
|
return isinstance(compression_config, CompressedTensorsConfig)
|
120
121
|
except ImportError:
|
121
122
|
return False
|
123
|
+
|
124
|
+
|
125
|
+
class Aliasable:
|
126
|
+
"""
|
127
|
+
A mixin for enums to allow aliasing of enum members
|
128
|
+
|
129
|
+
Example:
|
130
|
+
>>> class MyClass(Aliasable, int, Enum):
|
131
|
+
>>> ...
|
132
|
+
"""
|
133
|
+
|
134
|
+
@staticmethod
|
135
|
+
def get_aliases() -> Dict[str, str]:
|
136
|
+
raise NotImplementedError()
|
137
|
+
|
138
|
+
def __eq__(self, other):
|
139
|
+
if isinstance(other, self.__class__):
|
140
|
+
aliases = self.get_aliases()
|
141
|
+
return self.value == other.value or (
|
142
|
+
aliases.get(self.value, self.value)
|
143
|
+
== aliases.get(other.value, other.value)
|
144
|
+
)
|
145
|
+
else:
|
146
|
+
aliases = self.get_aliases()
|
147
|
+
self_value = aliases.get(self.value, self.value)
|
148
|
+
other_value = aliases.get(other, other)
|
149
|
+
return self_value == other_value
|
150
|
+
|
151
|
+
def __hash__(self):
|
152
|
+
canonical_value = self.aliases.get(self.value, self.value)
|
153
|
+
return hash(canonical_value)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: compressed-tensors-nightly
|
3
|
-
Version: 0.8.0.
|
3
|
+
Version: 0.8.0.20241204
|
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,9 +23,9 @@ 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=MJa-UfoKhIkdUWRD1shrXXri2cOwR5GK0a4t4bNYosM,3268
|
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=jwC__lSmuiJ2qSJYYZGgWgQNbZu6YhhS0e-qugrTNXE,9058
|
27
27
|
compressed_tensors/quantization/quant_config.py,sha256=K6kOZ6LDXpFlqsVzR4NEATV6y6Ea83rJWnNyVlvw-pI,10379
|
28
|
-
compressed_tensors/quantization/quant_scheme.py,sha256=
|
28
|
+
compressed_tensors/quantization/quant_scheme.py,sha256=eQ0JrRZ80GX69fpwW87VzPzzhajhk4mUaJScjk82OY4,6010
|
29
29
|
compressed_tensors/quantization/lifecycle/__init__.py,sha256=_uItzFWusyV74Zco_pHLOTdE9a83cL-R-ZdyQrBkIyw,772
|
30
30
|
compressed_tensors/quantization/lifecycle/apply.py,sha256=jCUSgeOBtagE5IhgIbyYMZ4kv8Rm20VGJ4IxXZ5HAnw,15066
|
31
31
|
compressed_tensors/quantization/lifecycle/compressed.py,sha256=Fj9n66IN0EWsOAkBHg3O0GlOQpxstqjCcs0ttzMXrJ0,2296
|
@@ -37,14 +37,14 @@ compressed_tensors/quantization/utils/helpers.py,sha256=DBP-sGRpGAY01K0LFE7qqonN
|
|
37
37
|
compressed_tensors/registry/__init__.py,sha256=FwLSNYqfIrb5JD_6OK_MT4_svvKTN_nEhpgQlQvGbjI,658
|
38
38
|
compressed_tensors/registry/registry.py,sha256=vRcjVB1ITfSbfYUaGndBBmqhip_5vsS62weorVg0iXo,11896
|
39
39
|
compressed_tensors/utils/__init__.py,sha256=gS4gSU2pwcAbsKj-6YMaqhm25udFy6ISYaWBf-myRSM,808
|
40
|
-
compressed_tensors/utils/helpers.py,sha256=
|
40
|
+
compressed_tensors/utils/helpers.py,sha256=T3p0TbhWbQIRjL6Up2Z7UhZO5jpR6WxBhYPPvrhE6lE,5018
|
41
41
|
compressed_tensors/utils/offload.py,sha256=d9q8LNe8HyF8tOjgjA7QGLD3HRysmNp0d8eBbdqBgIM,4089
|
42
42
|
compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVyah6BUUir_StT28,2530
|
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.8.0.
|
47
|
-
compressed_tensors_nightly-0.8.0.
|
48
|
-
compressed_tensors_nightly-0.8.0.
|
49
|
-
compressed_tensors_nightly-0.8.0.
|
50
|
-
compressed_tensors_nightly-0.8.0.
|
46
|
+
compressed_tensors_nightly-0.8.0.20241204.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
47
|
+
compressed_tensors_nightly-0.8.0.20241204.dist-info/METADATA,sha256=mJKzlqPsJpyOYHaxnaF2c9tnasEwHgbAkK1D566IW3U,6799
|
48
|
+
compressed_tensors_nightly-0.8.0.20241204.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
49
|
+
compressed_tensors_nightly-0.8.0.20241204.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
|
50
|
+
compressed_tensors_nightly-0.8.0.20241204.dist-info/RECORD,,
|
File without changes
|
File without changes
|