compressed-tensors-nightly 0.3.3.20240605__py3-none-any.whl → 0.3.3.20240606__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.
@@ -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, Tuple
15
+ from typing import Any, Iterable, Optional, Tuple, Union
16
16
 
17
17
  import torch
18
18
  from compressed_tensors.quantization.quant_args import (
@@ -114,15 +114,21 @@ class Observer(Module, RegistryMixin):
114
114
  # use dim 1, assume the obsersed.shape = [batch, token, hidden]
115
115
  # should be batch, token
116
116
  self._scale, self._zero_point = self.get_qparams_along_dim(
117
- observed, dim=1
117
+ observed,
118
+ dim={0, 1},
118
119
  )
119
120
 
120
121
  return self._scale, self._zero_point
121
122
 
122
123
  def get_qparams_along_dim(
123
- self, observed, dim: int, tensor_id: Optional[Any] = None
124
+ self,
125
+ observed,
126
+ dim: Union[int, Iterable[int]],
127
+ tensor_id: Optional[Any] = None,
124
128
  ):
125
- reduce_dims = tuple(idx for idx in range(observed.ndim) if idx != dim)
129
+ dim = set(dim)
130
+
131
+ reduce_dims = tuple(idx for idx in range(observed.ndim) if idx not in dim)
126
132
  return self.calculate_qparams(
127
133
  observed, reduce_dims=reduce_dims, tensor_id=tensor_id
128
134
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: compressed-tensors-nightly
3
- Version: 0.3.3.20240605
3
+ Version: 0.3.3.20240606
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.
@@ -25,7 +25,7 @@ compressed_tensors/quantization/lifecycle/forward.py,sha256=_1TwffkyaaXL5QpFgXH1
25
25
  compressed_tensors/quantization/lifecycle/frozen.py,sha256=h1XYt89MouBTf3jTYLG_6OdFxIu5q2N8tPjsy6J4E6Y,1726
26
26
  compressed_tensors/quantization/lifecycle/initialize.py,sha256=pFfcu-pxdQKzlnn-18-RlkEktt2yDi6woNXJsiv1A2c,3732
27
27
  compressed_tensors/quantization/observers/__init__.py,sha256=DNH31NQYrIBBcmHsMyFA6whh4pbRsLwuNa6L8AeXaGc,745
28
- compressed_tensors/quantization/observers/base.py,sha256=kywLVwycFvGxuZMU2cy8-KYyNrZCHkinN6YzCL7boLE,5121
28
+ compressed_tensors/quantization/observers/base.py,sha256=z_JC-CRz-PY7WlpSoyOoSQQWz5ekTEd5LbXt0iHQRes,5239
29
29
  compressed_tensors/quantization/observers/helpers.py,sha256=JwALNfBYY9Eyl8Q180t0lGh8szumQj8TygfNl-isErs,2166
30
30
  compressed_tensors/quantization/observers/memoryless.py,sha256=jH_c6K3gxf4W3VNXQ7tbnP-J_86QTrEfjBn6Kh1C-H8,2165
31
31
  compressed_tensors/quantization/observers/min_max.py,sha256=UK7zCMzxv9GGn6BflBxdajV20RiWaCY2RHcvZodCP1w,3669
@@ -36,8 +36,8 @@ compressed_tensors/registry/registry.py,sha256=fxjOjh2wklCvJhQxwofdy-zV8q7MkQ85S
36
36
  compressed_tensors/utils/__init__.py,sha256=5DrYjoZbaEvSkJcC-GRSbM_RBHVF4tG9gMd3zsJnjLw,665
37
37
  compressed_tensors/utils/helpers.py,sha256=5ull5yFT31M2zVxKeFvpvvlvX5f1Sk1LGuj_wrfZWCY,2267
38
38
  compressed_tensors/utils/safetensors_load.py,sha256=wo9UirGrGlenBqZeqotvpCT7D5MEdjCo2J3HeRaIFoU,8502
39
- compressed_tensors_nightly-0.3.3.20240605.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
40
- compressed_tensors_nightly-0.3.3.20240605.dist-info/METADATA,sha256=qwDaJJ2ESwS0volHF_lVUVFrjl4Wl_exZiKRCDUGfTA,5668
41
- compressed_tensors_nightly-0.3.3.20240605.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
42
- compressed_tensors_nightly-0.3.3.20240605.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
43
- compressed_tensors_nightly-0.3.3.20240605.dist-info/RECORD,,
39
+ compressed_tensors_nightly-0.3.3.20240606.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
40
+ compressed_tensors_nightly-0.3.3.20240606.dist-info/METADATA,sha256=FKB5KuGhB_Kns-IIqIQSJorAuuV39xUgbfx8g1RlwgM,5668
41
+ compressed_tensors_nightly-0.3.3.20240606.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
42
+ compressed_tensors_nightly-0.3.3.20240606.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
43
+ compressed_tensors_nightly-0.3.3.20240606.dist-info/RECORD,,