Skip to content

Commit 1403bc4

Browse files
authored
fix compress on meta device issue (#444)
* fix compress on meta device issue Signed-off-by: shanjiaz <[email protected]> * fix style Signed-off-by: shanjiaz <[email protected]> * fix style Signed-off-by: shanjiaz <[email protected]> --------- Signed-off-by: shanjiaz <[email protected]>
1 parent ca1c7f7 commit 1403bc4

File tree

1 file changed

+5
-1
lines changed
  • src/compressed_tensors/compressors/quantized_compressors

1 file changed

+5
-1
lines changed

src/compressed_tensors/compressors/quantized_compressors/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ def compress(
131131

132132
# omit saving for g_idx if uninitialized
133133
# TODO: does this case actually occur?
134-
elif name.endswith("g_idx") and torch.any(value <= -1):
134+
elif (
135+
name.endswith("g_idx")
136+
and value.device.type != "meta"
137+
and torch.any(value <= -1)
138+
):
135139
continue
136140
compressed_dict[name] = value.to(compression_device)
137141

0 commit comments

Comments
 (0)