Skip to content

Commit

Permalink
Fix gptq exllamav2 check (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil authored Mar 13, 2024
1 parent cafe343 commit 5bf349d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions optimum_benchmark/backends/pytorch/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,13 @@ def is_awq_quantized(self) -> bool:
def is_exllamav2(self) -> bool:
return (self.is_gptq_quantized or self.is_awq_quantized) and (
(
hasattr(self.pretrained_config, "quantization_config")
and hasattr(self.pretrained_config.quantization_config, "exllama_config")
and "exllama_version" in self.pretrained_config.quantization_config.exllama_config
and self.pretrained_config.quantization_config.exllama_config["exllama_version"] == 2
getattr(self.pretrained_config, "quantization_config", None) is not None
and getattr(self.pretrained_config.quantization_config, "exllama_config", None) is not None
and self.pretrained_config.quantization_config.exllama_config.get("exllama_version", None) == 2
)
or (
hasattr(self.quantization_config, "exllama_config")
and "exllama_version" in self.quantization_config.exllama_config
and self.quantization_config.exllama_config["exllama_version"] == 2
self.config.quantization_config.get("exllama_config", None) is not None
and self.config.quantization_config.exllama_config.get("exllama_version", None) == 2
)
)

Expand Down
4 changes: 2 additions & 2 deletions optimum_benchmark/trackers/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def __sub__(self, other: "Energy") -> "Energy":
"""Enables subtraction of two Energy instances using the '-' operator."""
if self.unit != other.unit:
raise ValueError("Energy units must match to perform subtraction")

return Energy(
cpu=self.cpu - other.cpu,
gpu=self.gpu - other.gpu,
ram=self.ram - other.ram,
total=self.total - other.total,
unit=self.unit
unit=self.unit,
)


Expand Down

0 comments on commit 5bf349d

Please sign in to comment.