Skip to content

Commit 7ee7215

Browse files
WOQ models export workaround for autoround different device (#1710)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2ee53a9 commit 7ee7215

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

neural_compressor/model/torch_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def export_compressed_model(
499499

500500
autoround_config = self.autoround_config if hasattr(self, "autoround_config") else {}
501501

502-
if gptq_config:
502+
if gptq_config or (autoround_config and device == "xpu"):
503503
for k, v in weight_config.items():
504504
logger.debug(f"Compressing {k} on device {device}")
505505
if v["dtype"] == "fp32":
@@ -558,7 +558,7 @@ def export_compressed_model(
558558
)
559559
new_module.pack(int_weight, gptq_scale, gptq_zp, m.bias, gptq_perm)
560560
set_module(self.model, k, new_module)
561-
elif autoround_config:
561+
elif autoround_config and (device == "cpu" or device == "auto"):
562562
from auto_round.export.export_to_itrex.export import pack_model # pylint: disable=E0401
563563

564564
self.model = pack_model(

0 commit comments

Comments
 (0)