From 77c86271c41317d3d6eacce1c797731a9d95d100 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Fri, 1 Nov 2024 00:32:42 +0100 Subject: [PATCH] handle case where base_model_name_or_path is invalid --- convert_lora_to_gguf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/convert_lora_to_gguf.py b/convert_lora_to_gguf.py index eb1e0350744d3..868ffe1841bf8 100755 --- a/convert_lora_to_gguf.py +++ b/convert_lora_to_gguf.py @@ -317,7 +317,12 @@ def load_hparams_from_hf(hf_model_id: str) -> dict[str, Any]: if "base_model_name_or_path" in lparams: model_id = lparams["base_model_name_or_path"] logger.info(f"Loading base model from Hugging Face: {model_id}") - hparams = load_hparams_from_hf(model_id) + try: + hparams = load_hparams_from_hf(model_id) + except OSError as e: + logger.error(f"Failed to load base model config: {e}") + logger.error("Please try downloading the base model and add its path to --base") + sys.exit(1) else: logger.error("'base_model_name_or_path' is not found in adapter_config.json") logger.error("Base model config is required. Please download the base model and add its path to --base")