compressed-tensors 0.9.4a20250421__py3-none-any.whl → 0.9.5a20250424__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 +20 -16
- compressed_tensors/version.py +2 -2
- {compressed_tensors-0.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.dist-info}/METADATA +1 -1
- {compressed_tensors-0.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.dist-info}/RECORD +7 -7
- {compressed_tensors-0.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.dist-info}/WHEEL +1 -1
- {compressed_tensors-0.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.dist-info}/licenses/LICENSE +0 -0
- {compressed_tensors-0.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.dist-info}/top_level.txt +0 -0
@@ -94,22 +94,6 @@ def is_module_offloaded(module: torch.nn.Module) -> bool:
|
|
94
94
|
return has_offloaded_params(module)
|
95
95
|
|
96
96
|
|
97
|
-
def get_execution_device(module: torch.nn.Module) -> torch.device:
|
98
|
-
"""
|
99
|
-
:param module: module to check
|
100
|
-
:return: device module is loaded onto during forward pass
|
101
|
-
"""
|
102
|
-
if has_offloaded_params(module):
|
103
|
-
return module._hf_hook.execution_device
|
104
|
-
device = next(module.parameters()).device
|
105
|
-
|
106
|
-
# offload only gets set for leaf modules, fallback to checking for device type
|
107
|
-
if device.type == "meta":
|
108
|
-
return module._hf_hook.execution_device
|
109
|
-
|
110
|
-
return device
|
111
|
-
|
112
|
-
|
113
97
|
def get_offloaded_device(module: torch.nn.Module) -> torch.device:
|
114
98
|
"""
|
115
99
|
:param module: module to check
|
@@ -158,6 +142,26 @@ def update_parameter_data(
|
|
158
142
|
""" Candidates for Upstreaming """
|
159
143
|
|
160
144
|
|
145
|
+
def get_execution_device(module: torch.nn.Module) -> torch.device:
|
146
|
+
"""
|
147
|
+
Get the device which inputs should be moved to before module execution
|
148
|
+
|
149
|
+
:param module: module to check, may be offloaded
|
150
|
+
:return: onload device of module
|
151
|
+
"""
|
152
|
+
if has_offloaded_params(module):
|
153
|
+
return module._hf_hook.execution_device
|
154
|
+
|
155
|
+
first_param = next(module.parameters(), None)
|
156
|
+
if first_param is None:
|
157
|
+
warnings.warn(
|
158
|
+
f"Unable able to infer execution device of {module}, falling back to CPU"
|
159
|
+
)
|
160
|
+
return torch.device("cpu")
|
161
|
+
|
162
|
+
return first_param.device
|
163
|
+
|
164
|
+
|
161
165
|
def register_offload_parameter(
|
162
166
|
module: torch.nn.Module,
|
163
167
|
name: str,
|
compressed_tensors/version.py
CHANGED
@@ -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.
|
21
|
-
__version_tuple__ = version_tuple = (0, 9,
|
20
|
+
__version__ = version = '0.9.5.a20250424'
|
21
|
+
__version_tuple__ = version_tuple = (0, 9, 5)
|
{compressed_tensors-0.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: compressed-tensors
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.5a20250424
|
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.9.4a20250421.dist-info → compressed_tensors-0.9.5a20250424.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=fMpLfUNedNFTmTmQeHxGZnMaXAKOKiqpI9xyx46F2gI,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
|
@@ -40,13 +40,13 @@ compressed_tensors/registry/__init__.py,sha256=FwLSNYqfIrb5JD_6OK_MT4_svvKTN_nEh
|
|
40
40
|
compressed_tensors/registry/registry.py,sha256=vRcjVB1ITfSbfYUaGndBBmqhip_5vsS62weorVg0iXo,11896
|
41
41
|
compressed_tensors/utils/__init__.py,sha256=gS4gSU2pwcAbsKj-6YMaqhm25udFy6ISYaWBf-myRSM,808
|
42
42
|
compressed_tensors/utils/helpers.py,sha256=RrNvzD08naEjEiXdU-FdZjQVda1nQywu1hA_GCDj0vg,10415
|
43
|
-
compressed_tensors/utils/offload.py,sha256=
|
43
|
+
compressed_tensors/utils/offload.py,sha256=Fmb4jBJhH5OdSQFaecFSHK_UreSyZdynEkadZ_oKcvM,14153
|
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
46
|
compressed_tensors/utils/safetensors_load.py,sha256=rwj0ufU5561ScWDoCG7tzLBRDtiykNno2Iq4PM_JA7E,11499
|
47
47
|
compressed_tensors/utils/semi_structured_conversions.py,sha256=XKNffPum54kPASgqKzgKvyeqWPAkair2XEQXjkp7ho8,13489
|
48
|
-
compressed_tensors-0.9.
|
49
|
-
compressed_tensors-0.9.
|
50
|
-
compressed_tensors-0.9.
|
51
|
-
compressed_tensors-0.9.
|
52
|
-
compressed_tensors-0.9.
|
48
|
+
compressed_tensors-0.9.5a20250424.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
49
|
+
compressed_tensors-0.9.5a20250424.dist-info/METADATA,sha256=P0oAhrS28ZU90nUEi9yjIu3CE-968yZTsTLTx1Uj1nM,7004
|
50
|
+
compressed_tensors-0.9.5a20250424.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
51
|
+
compressed_tensors-0.9.5a20250424.dist-info/top_level.txt,sha256=w2i-GyPs2s1UwVxvutSvN_lM22SXC2hQFBmoMcPnV7Y,19
|
52
|
+
compressed_tensors-0.9.5a20250424.dist-info/RECORD,,
|
File without changes
|
File without changes
|