compressed-tensors-nightly 0.5.0.20240803__py3-none-any.whl → 0.5.0.20240805__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()
@@ -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.20240803
3
+ Version: 0.5.0.20240805
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.
@@ -8,17 +8,17 @@ Author-email: support@neuralmagic.com
8
8
  License: Apache 2.0
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: torch >=1.7.0
11
+ Requires-Dist: torch>=1.7.0
12
12
  Requires-Dist: transformers
13
13
  Requires-Dist: accelerate
14
- Requires-Dist: pydantic >=2.0
14
+ Requires-Dist: pydantic>=2.0
15
15
  Provides-Extra: dev
16
- Requires-Dist: black ==22.12.0 ; extra == 'dev'
17
- Requires-Dist: isort ==5.8.0 ; extra == 'dev'
18
- Requires-Dist: wheel >=0.36.2 ; extra == 'dev'
19
- Requires-Dist: flake8 >=3.8.3 ; extra == 'dev'
20
- Requires-Dist: pytest >=6.0.0 ; extra == 'dev'
21
- Requires-Dist: nbconvert >=7.16.3 ; extra == 'dev'
16
+ Requires-Dist: black==22.12.0; extra == "dev"
17
+ Requires-Dist: isort==5.8.0; extra == "dev"
18
+ Requires-Dist: wheel>=0.36.2; extra == "dev"
19
+ Requires-Dist: flake8>=3.8.3; extra == "dev"
20
+ Requires-Dist: pytest>=6.0.0; extra == "dev"
21
+ Requires-Dist: nbconvert>=7.16.3; extra == "dev"
22
22
 
23
23
  # compressed_tensors
24
24
 
@@ -19,7 +19,7 @@ compressed_tensors/quantization/quant_args.py,sha256=Vc_tWSTcbZZsMJlACpLq4JEPvGx
19
19
  compressed_tensors/quantization/quant_config.py,sha256=NpVu8YJ4Xw2pIQW_PGaNaml8kx1bUnxkvb0jBYWbKdE,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.20240803.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
- compressed_tensors_nightly-0.5.0.20240803.dist-info/METADATA,sha256=O9Wcw2XA5m0wUQVFg7dPN2vA035T8j4gEEPDT07fBoI,5694
46
- compressed_tensors_nightly-0.5.0.20240803.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
47
- compressed_tensors_nightly-0.5.0.20240803.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
48
- compressed_tensors_nightly-0.5.0.20240803.dist-info/RECORD,,
44
+ compressed_tensors_nightly-0.5.0.20240805.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
45
+ compressed_tensors_nightly-0.5.0.20240805.dist-info/METADATA,sha256=dJq2EwTdS0e84wCPNch9c5UlEQipeZjc9u11piY4MbE,5680
46
+ compressed_tensors_nightly-0.5.0.20240805.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
47
+ compressed_tensors_nightly-0.5.0.20240805.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
48
+ compressed_tensors_nightly-0.5.0.20240805.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5