compressed-tensors-nightly 0.5.0.20240804__py3-none-any.whl → 0.5.0.20240806__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.
@@ -15,6 +15,7 @@
15
15
  import logging
16
16
  import re
17
17
  from collections import OrderedDict
18
+ from copy import deepcopy
18
19
  from typing import Dict, Iterable, List, Optional
19
20
  from typing import OrderedDict as OrderedDictType
20
21
  from typing import Union
@@ -110,6 +111,10 @@ def apply_quantization_config(model: Module, config: QuantizationConfig) -> Dict
110
111
  :param model: model to apply quantization config to
111
112
  :param config: quantization config
112
113
  """
114
+ # remove reference to the original `config`
115
+ # argument. This function can mutate it, and we'd
116
+ # like to keep the original `config` as it is.
117
+ config = deepcopy(config)
113
118
  # build mapping of targets to schemes for easier matching
114
119
  # use ordered dict to preserve target ordering in config
115
120
  target_to_scheme = OrderedDict()
@@ -103,7 +103,7 @@ LIFECYCLE_ORDER = [
103
103
  QuantizationStatus.COMPRESSED,
104
104
  ]
105
105
 
106
- DEFAULT_QUANTIZATION_METHOD = "compressed-tensors"
106
+ DEFAULT_QUANTIZATION_METHOD = "compressed_tensors"
107
107
  DEFAULT_QUANTIZATION_FORMAT = "fakequant"
108
108
 
109
109
 
@@ -40,7 +40,13 @@ def get_execution_device(module: Module) -> torch.device:
40
40
  """
41
41
  if is_module_offloaded(module):
42
42
  return module._hf_hook.execution_device
43
- return next(module.parameters()).device
43
+ device = next(module.parameters()).device
44
+
45
+ # offload only gets set for leaf modules, fallback to checking for device type
46
+ if device.type == "meta":
47
+ return module._hf_hook.execution_device
48
+
49
+ return device
44
50
 
45
51
 
46
52
  def get_offloaded_device(module: Module) -> torch.device:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: compressed-tensors-nightly
3
- Version: 0.5.0.20240804
3
+ Version: 0.5.0.20240806
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.
@@ -16,10 +16,10 @@ compressed_tensors/config/dense.py,sha256=NgSxnFCnckU9-iunxEaqiFwqgdO7YYxlWKR74j
16
16
  compressed_tensors/config/sparse_bitmask.py,sha256=pZUboRNZTu6NajGOQEFExoPknak5ynVAUeiiYpS1Gt8,1308
17
17
  compressed_tensors/quantization/__init__.py,sha256=83J5bPB7PavN2TfCoW7_vEDhfYpm4TDrqYO9vdSQ5bk,760
18
18
  compressed_tensors/quantization/quant_args.py,sha256=Vc_tWSTcbZZsMJlACpLq4JEPvGx87izc8VEx-mcXjoM,5621
19
- compressed_tensors/quantization/quant_config.py,sha256=NpVu8YJ4Xw2pIQW_PGaNaml8kx1bUnxkvb0jBYWbKdE,9971
19
+ compressed_tensors/quantization/quant_config.py,sha256=a9U2Iydwi0AIZ30-7J403nBBBHXVCNEzz4HbvnD4_B8,9971
20
20
  compressed_tensors/quantization/quant_scheme.py,sha256=_RKOFJI0T5xJVBLX63UeYkSY4EFAecsBnqzUIVBjeU0,6014
21
21
  compressed_tensors/quantization/lifecycle/__init__.py,sha256=MXE2E7GfIfRRfhrdGy2Og3AZOz5N59B0ZGFcsD89y6c,821
22
- compressed_tensors/quantization/lifecycle/apply.py,sha256=aamouy1IWCSGl5_lfC7rZrUNbMEfhyHQrZFGEm2VH4w,13242
22
+ compressed_tensors/quantization/lifecycle/apply.py,sha256=FDKw6AaQjOwNtcX6oFXNx5b_bwm6BpuFtly1Ll6-WFE,13451
23
23
  compressed_tensors/quantization/lifecycle/calibration.py,sha256=n-m4xwa9Ds2xrltp6r0rhuVLJhE8bQ1LnifrcrbA-ig,2448
24
24
  compressed_tensors/quantization/lifecycle/compressed.py,sha256=VreB10xPwgSLQQlTu20UCrFpRS--cA7-lx5s7nrPPrg,2247
25
25
  compressed_tensors/quantization/lifecycle/forward.py,sha256=6PSXYcf-R1dOY8zsuIWnBaoyARNymYc3-qvV6-L7SlI,12397
@@ -37,12 +37,12 @@ compressed_tensors/registry/__init__.py,sha256=FwLSNYqfIrb5JD_6OK_MT4_svvKTN_nEh
37
37
  compressed_tensors/registry/registry.py,sha256=fxjOjh2wklCvJhQxwofdy-zV8q7MkQ85SLG77nml2iA,11890
38
38
  compressed_tensors/utils/__init__.py,sha256=rvbIJlvdKYn4iX7r3KP6peCbU5uyMzgxwhsQstLoMxQ,785
39
39
  compressed_tensors/utils/helpers.py,sha256=d3yP9ViQ8R3GzMHfohxNlaokzyrRuj2PyjxWAJZmSws,3156
40
- compressed_tensors/utils/offload.py,sha256=BL7_cNAHTKbSta179R5R4ASk6oXuZhTJDY4D_8Lv2OE,3717
40
+ compressed_tensors/utils/offload.py,sha256=qAMwoFT3WEQ9nB_SegE12ob8ghDugddQseE6z4vpZEE,3900
41
41
  compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVyah6BUUir_StT28,2530
42
42
  compressed_tensors/utils/safetensors_load.py,sha256=0MheXwx1jeY12PeISppiSIZHs6rmN2YddwPpFb9V67I,8527
43
43
  compressed_tensors/utils/semi_structured_conversions.py,sha256=g1EZHzdv-ko7ufPX430dp7wE33o6FWJXuSP4zZydCu0,13488
44
- compressed_tensors_nightly-0.5.0.20240804.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
- compressed_tensors_nightly-0.5.0.20240804.dist-info/METADATA,sha256=H78U9c-Vx4toSi_Hxc8V4zEfgvofEROPHcA_ICVjeFs,5680
46
- compressed_tensors_nightly-0.5.0.20240804.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
47
- compressed_tensors_nightly-0.5.0.20240804.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
48
- compressed_tensors_nightly-0.5.0.20240804.dist-info/RECORD,,
44
+ compressed_tensors_nightly-0.5.0.20240806.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
+ compressed_tensors_nightly-0.5.0.20240806.dist-info/METADATA,sha256=h7Y9E6J9JViwHSrAt7Ir3oBGRJ3CbXbQHiraPnonmNE,5680
46
+ compressed_tensors_nightly-0.5.0.20240806.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
47
+ compressed_tensors_nightly-0.5.0.20240806.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
48
+ compressed_tensors_nightly-0.5.0.20240806.dist-info/RECORD,,