compressed-tensors 0.10.2a20250613__py3-none-any.whl → 0.10.2a20250616__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/utils/offload.py +23 -7
- compressed_tensors/version.py +1 -1
- {compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/METADATA +1 -1
- {compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/RECORD +7 -7
- {compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/WHEEL +0 -0
- {compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/licenses/LICENSE +0 -0
- {compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/top_level.txt +0 -0
@@ -206,9 +206,24 @@ def register_offload_parameter(
|
|
206
206
|
has_onload = any(p.device != torch.device("meta") for p in module.parameters())
|
207
207
|
module.register_parameter(name, parameter)
|
208
208
|
|
209
|
+
# do everything AlignDevicesHook.init_hook does
|
210
|
+
# https://github.com/huggingface/accelerate/blob/main/src/accelerate/hooks.py#L281
|
209
211
|
if has_offloaded_params(module):
|
210
|
-
|
211
|
-
|
212
|
+
hook: AlignDevicesHook = module._hf_hook
|
213
|
+
assert hook.weights_map is not None
|
214
|
+
|
215
|
+
# append to original_devices
|
216
|
+
hook.original_devices[name] = parameter.device
|
217
|
+
|
218
|
+
# append to weights map
|
219
|
+
offload_to_weights_map(hook.weights_map, name, parameter.data, offload_device)
|
220
|
+
|
221
|
+
# append to tied_params_map
|
222
|
+
offloaded = hook.weights_map[name]
|
223
|
+
if hook.tied_params_map is not None:
|
224
|
+
hook.tied_params_map[offloaded.data_ptr()] = {} # (1)
|
225
|
+
|
226
|
+
# perform offloading
|
212
227
|
if not has_onload:
|
213
228
|
set_module_tensor_to_device(module, name, "meta")
|
214
229
|
|
@@ -422,7 +437,6 @@ def register_offload_module(base: torch.nn.Module, name: str, module: torch.nn.M
|
|
422
437
|
hook: AlignDevicesHook = base._hf_hook
|
423
438
|
assert hook.offload
|
424
439
|
assert hook.weights_map is not None
|
425
|
-
assert hook.tied_params_map is not None
|
426
440
|
|
427
441
|
# offloading kwargs for submodule
|
428
442
|
place_submodules = False
|
@@ -437,7 +451,8 @@ def register_offload_module(base: torch.nn.Module, name: str, module: torch.nn.M
|
|
437
451
|
module, include_buffers=offload_buffers, recurse=place_submodules
|
438
452
|
):
|
439
453
|
offloaded = param.to(offload_device)
|
440
|
-
hook.tied_params_map
|
454
|
+
if hook.tied_params_map is not None:
|
455
|
+
hook.tied_params_map[offloaded.data_ptr()] = {} # (1)
|
441
456
|
offload_to_weights_map(hook.weights_map, f"{name}.{param_name}", offloaded)
|
442
457
|
|
443
458
|
# if the parent places submodules, offload here
|
@@ -465,9 +480,6 @@ def register_offload_module(base: torch.nn.Module, name: str, module: torch.nn.M
|
|
465
480
|
|
466
481
|
base.register_module(name, module)
|
467
482
|
|
468
|
-
# (1): Since we cannot know which pointers are shared when we add parameters in an
|
469
|
-
# online way, assume that all pointers are shared. This comes at no runtime cost
|
470
|
-
|
471
483
|
|
472
484
|
def delete_offload_module(base: torch.nn.Module, name: str):
|
473
485
|
"""
|
@@ -623,3 +635,7 @@ def align_module_device(
|
|
623
635
|
|
624
636
|
else:
|
625
637
|
yield
|
638
|
+
|
639
|
+
|
640
|
+
# (1): Since we cannot know which pointers are shared when we add parameters in an
|
641
|
+
# online way, assume that all pointers are shared. This has virtually no runtime cost
|
compressed_tensors/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: compressed-tensors
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.2a20250616
|
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.
|
{compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/RECORD
RENAMED
@@ -1,6 +1,6 @@
|
|
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=
|
3
|
+
compressed_tensors/version.py,sha256=luzxcDdA8EA_-n05GudjzinnLHUkR5eQCjyTTNLxDnw,523
|
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
|
@@ -54,13 +54,13 @@ compressed_tensors/transform/utils/hadamards.safetensors,sha256=mFd1GzNodGG-ifA1
|
|
54
54
|
compressed_tensors/transform/utils/utils.py,sha256=PRPTYwPs2nnNaQMq2GEbC4QYKHFKlZwaRyPgdDhl66g,2992
|
55
55
|
compressed_tensors/utils/__init__.py,sha256=gS4gSU2pwcAbsKj-6YMaqhm25udFy6ISYaWBf-myRSM,808
|
56
56
|
compressed_tensors/utils/helpers.py,sha256=cPg-ikdeA92aIGwBONg8GmPNvcGlFhozyJVwsRiXBTA,11981
|
57
|
-
compressed_tensors/utils/offload.py,sha256=
|
57
|
+
compressed_tensors/utils/offload.py,sha256=11k8p3y_0WVbrozYsrPjJb_4Ln8YkeO_4Q8W4ibFVlc,22710
|
58
58
|
compressed_tensors/utils/permutations_24.py,sha256=kx6fsfDHebx94zsSzhXGyCyuC9sVyah6BUUir_StT28,2530
|
59
59
|
compressed_tensors/utils/permute.py,sha256=V6tJLKo3Syccj-viv4F7ZKZgJeCB-hl-dK8RKI_kBwI,2355
|
60
60
|
compressed_tensors/utils/safetensors_load.py,sha256=DMfZBuUbA6qp_BG_zIWT3ckiEE33K9ob34s-OgzReO4,12057
|
61
61
|
compressed_tensors/utils/semi_structured_conversions.py,sha256=XKNffPum54kPASgqKzgKvyeqWPAkair2XEQXjkp7ho8,13489
|
62
|
-
compressed_tensors-0.10.
|
63
|
-
compressed_tensors-0.10.
|
64
|
-
compressed_tensors-0.10.
|
65
|
-
compressed_tensors-0.10.
|
66
|
-
compressed_tensors-0.10.
|
62
|
+
compressed_tensors-0.10.2a20250616.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
compressed_tensors-0.10.2a20250616.dist-info/METADATA,sha256=V_L8-0yZM5t7FG0knLacaaIAHNTuEmTe1f7CqmDCAXg,7005
|
64
|
+
compressed_tensors-0.10.2a20250616.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
65
|
+
compressed_tensors-0.10.2a20250616.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
|
66
|
+
compressed_tensors-0.10.2a20250616.dist-info/RECORD,,
|
{compressed_tensors-0.10.2a20250613.dist-info → compressed_tensors-0.10.2a20250616.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|