From fb8ee9f7ff164aff95a747c73d3924e9613a76b8 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:32:58 -0800 Subject: [PATCH] Add a specific error if HQQ is missing --- modules/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/models.py b/modules/models.py index f37f3d60..70316952 100644 --- a/modules/models.py +++ b/modules/models.py @@ -413,8 +413,12 @@ def ExLlamav2_HF_loader(model_name): def HQQ_loader(model_name): - from hqq.engine.hf import HQQModelForCausalLM - from hqq.core.quantize import HQQLinear, HQQBackend + try: + from hqq.engine.hf import HQQModelForCausalLM + from hqq.core.quantize import HQQLinear, HQQBackend + except ModuleNotFoundError: + logger.error("HQQ is not installed. You can install it with:\n\npip install hqq") + return None logger.info(f"Loading HQQ model with backend: {shared.args.hqq_backend}")