Skip to content

Commit

Permalink
enable non-cuda awq model support without modify version (#35334)
Browse files Browse the repository at this point in the history
Signed-off-by: jiqing-feng <[email protected]>
  • Loading branch information
jiqing-feng authored Dec 24, 2024
1 parent ccc4a5a commit d8c1db2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/transformers/quantizers/quantizer_awq.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def validate_environment(self, device_map, **kwargs):
if not is_accelerate_available():
raise ImportError("Loading an AWQ quantized model requires accelerate (`pip install accelerate`)")

if self.quantization_config.version == AWQLinearVersion.GEMM and not torch.cuda.is_available():
logger.warning_once("No CUDA found, replace GEMM with IPEX version to support non-cuda AWQ model.")
self.quantization_config.version = AWQLinearVersion.IPEX

if self.quantization_config.version == AWQLinearVersion.IPEX:
if version.parse(importlib.metadata.version("autoawq")) < version.parse("0.2.6"):
raise RuntimeError(
Expand Down

0 comments on commit d8c1db2

Please sign in to comment.