compressed-tensors 0.9.5a20250502__py3-none-any.whl → 0.9.5a20250507__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.
@@ -573,8 +573,8 @@ class ModelCompressor:
573
573
  :param model: The model whose weights are to be updated.
574
574
  """
575
575
 
576
- for name, data in tqdm(dense_weight_generator, desc="Decompressing model"):
577
- module = operator.attrgetter(name)(model)
576
+ for mod_path, data in tqdm(dense_weight_generator, desc="Decompressing model"):
577
+ module = operator.attrgetter(mod_path)(model)
578
578
 
579
579
  params_device = next(module.parameters()).device
580
580
  device = "cpu" if has_offloaded_params(module) else params_device
@@ -195,33 +195,33 @@ class BaseQuantizationCompressor(BaseCompressor):
195
195
  weight_mappings = get_nested_weight_mappings(
196
196
  path_to_model, self.compression_param_names
197
197
  )
198
- for weight_name in weight_mappings.keys():
198
+ for module_path in weight_mappings.keys():
199
199
  weight_data = {}
200
- for param_name, safe_path in weight_mappings[weight_name].items():
201
- full_name = merge_names(weight_name, param_name)
200
+ for param_name, safe_path in weight_mappings[module_path].items():
201
+ full_name = merge_names(module_path, param_name)
202
202
  with safe_open(safe_path, framework="pt", device=device) as f:
203
203
  weight_data[param_name] = f.get_tensor(full_name)
204
204
  if "weight_scale" in weight_data:
205
- quant_args = names_to_scheme[weight_name].weights
205
+ quant_args = names_to_scheme[module_path].weights
206
206
  decompressed = self.decompress_weight(
207
207
  compressed_data=weight_data, quantization_args=quant_args
208
208
  )
209
209
  weight_data["weight"] = decompressed
210
- yield weight_name, weight_data
210
+ yield module_path, weight_data
211
211
 
212
212
  def _decompress_from_state_dict(self, state_dict, names_to_scheme):
213
213
  weight_mappings = get_nested_mappings_from_state_dict(
214
214
  state_dict, self.compression_param_names
215
215
  )
216
- for weight_name in weight_mappings.keys():
216
+ for module_path in weight_mappings.keys():
217
217
  weight_data = {}
218
- for param_name, param_value in weight_mappings[weight_name].items():
218
+ for param_name, param_value in weight_mappings[module_path].items():
219
219
  weight_data[param_name] = param_value
220
220
 
221
221
  if "weight_scale" in weight_data:
222
- quant_args = names_to_scheme[weight_name]
222
+ quant_args = names_to_scheme[module_path]
223
223
  decompressed = self.decompress_weight(
224
224
  compressed_data=weight_data, quantization_args=quant_args
225
225
  )
226
226
  weight_data["weight"] = decompressed
227
- yield weight_name, weight_data
227
+ yield module_path, weight_data
@@ -234,11 +234,11 @@ def get_nested_weight_mappings(
234
234
  for key, file_location in weight_mappings.items():
235
235
  matched = False
236
236
  for param_name in params_to_nest:
237
- dense_param = match_param_name(key, param_name)
238
- if dense_param:
239
- if dense_param not in nested_weight_mappings:
240
- nested_weight_mappings[dense_param] = {}
241
- nested_weight_mappings[dense_param][param_name] = file_location
237
+ module_path = match_param_name(key, param_name)
238
+ if module_path:
239
+ if module_path not in nested_weight_mappings:
240
+ nested_weight_mappings[module_path] = {}
241
+ nested_weight_mappings[module_path][param_name] = file_location
242
242
  matched = True
243
243
  if return_unmatched_params and not matched:
244
244
  unmatched_params[key] = file_location
@@ -271,11 +271,11 @@ def get_nested_mappings_from_state_dict(
271
271
  nested_weight_mappings = {}
272
272
  for key in state_dict.keys():
273
273
  for param_name in params_to_nest:
274
- dense_param = match_param_name(key, param_name)
275
- if dense_param:
276
- if dense_param not in nested_weight_mappings:
277
- nested_weight_mappings[dense_param] = {}
278
- nested_weight_mappings[dense_param][param_name] = state_dict[key]
274
+ module_path = match_param_name(key, param_name)
275
+ if module_path:
276
+ if module_path not in nested_weight_mappings:
277
+ nested_weight_mappings[module_path] = {}
278
+ nested_weight_mappings[module_path][param_name] = state_dict[key]
279
279
  return nested_weight_mappings
280
280
 
281
281
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.9.5.a20250502'
20
+ __version__ = version = '0.9.5.a20250507'
21
21
  __version_tuple__ = version_tuple = (0, 9, 5)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressed-tensors
3
- Version: 0.9.5a20250502
3
+ Version: 0.9.5a20250507
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.
@@ -1,13 +1,13 @@
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=QslujVV7iD8WT1DLVg4E2J0ixOMYOrpmN9XdxgP4qoA,521
3
+ compressed_tensors/version.py,sha256=9uyHdJcjtC13iNJagGPGRejL7_ESUhf48c_dyUk-TGw,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
7
7
  compressed_tensors/compressors/model_compressors/__init__.py,sha256=5RGGPFu4YqEt_aOdFSQYFYFDjcZFJN0CsMqRtDZz3Js,666
8
- compressed_tensors/compressors/model_compressors/model_compressor.py,sha256=QzyJqWqrCXauobs8aLgnylNhFJmlyoid8aDjdbLc_-s,26547
8
+ compressed_tensors/compressors/model_compressors/model_compressor.py,sha256=uh3Rbyqhjvt8o8On6ioOn6utBKv2siRRmAvgM1lDrxU,26555
9
9
  compressed_tensors/compressors/quantized_compressors/__init__.py,sha256=09UJq68Pht6Bf-4iP9xYl3tetKsncNPHD8IAGbePsr4,714
10
- compressed_tensors/compressors/quantized_compressors/base.py,sha256=m0hv95ojOCQJkJ2WDukXPDRas7AS0PIlWjAQHhUeVXQ,8828
10
+ compressed_tensors/compressors/quantized_compressors/base.py,sha256=n0L2QH2_Y1vWtLeQ0uV78y2lV4bviFEAtUKODl8L_nw,8828
11
11
  compressed_tensors/compressors/quantized_compressors/naive_quantized.py,sha256=fd0KlkSx6bvZ3xwIkK3jEUdPSUPs56Eua4dEDOtzKW0,5150
12
12
  compressed_tensors/compressors/quantized_compressors/pack_quantized.py,sha256=SPIHlk8ewip2LcjgkCw02K21EkfUSFSd9qQqL0Pt5eM,11162
13
13
  compressed_tensors/compressors/sparse_compressors/__init__.py,sha256=Atuz-OdEgn8OCUhx7Ovd6gXdyImAI186uCR-uR0t_Nk,737
@@ -43,10 +43,10 @@ compressed_tensors/utils/helpers.py,sha256=Le3LWskSQRr7pw8fWy5qmfDKYlKiQFy0id83u
43
43
  compressed_tensors/utils/offload.py,sha256=JNQ66_6vhSsizhlUaMgyEdBuFolYxbgUuT1mAZrCfKY,15436
44
44
  compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVyah6BUUir_StT28,2530
45
45
  compressed_tensors/utils/permute.py,sha256=V6tJLKo3Syccj-viv4F7ZKZgJeCB-hl-dK8RKI_kBwI,2355
46
- compressed_tensors/utils/safetensors_load.py,sha256=rwj0ufU5561ScWDoCG7tzLBRDtiykNno2Iq4PM_JA7E,11499
46
+ compressed_tensors/utils/safetensors_load.py,sha256=kkkUDmS1H40MFy6FDP-DFGiAYbtqke6bKE7YrAtORtA,11499
47
47
  compressed_tensors/utils/semi_structured_conversions.py,sha256=XKNffPum54kPASgqKzgKvyeqWPAkair2XEQXjkp7ho8,13489
48
- compressed_tensors-0.9.5a20250502.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
- compressed_tensors-0.9.5a20250502.dist-info/METADATA,sha256=T3yJT1zfyt8iGD_V5iH2CXqwWC9xAR50PSy7VSxkjjY,7004
50
- compressed_tensors-0.9.5a20250502.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
51
- compressed_tensors-0.9.5a20250502.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
52
- compressed_tensors-0.9.5a20250502.dist-info/RECORD,,
48
+ compressed_tensors-0.9.5a20250507.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
49
+ compressed_tensors-0.9.5a20250507.dist-info/METADATA,sha256=DUcVYkCy5Fa5ayrcaz_7mJ1XjvIMOlAFkVkOQMaClrE,7004
50
+ compressed_tensors-0.9.5a20250507.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
51
+ compressed_tensors-0.9.5a20250507.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
52
+ compressed_tensors-0.9.5a20250507.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.1.0)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5