Skip to content

Commit

Permalink
WOQ models export workaround for autoround different device (#1710)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
changwangss and pre-commit-ci[bot] authored Apr 2, 2024
1 parent 2ee53a9 commit 7ee7215
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neural_compressor/model/torch_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def export_compressed_model(

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

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

self.model = pack_model(
Expand Down

0 comments on commit 7ee7215

Please sign in to comment.