Skip to content

Commit 77c8627

Browse files
committed
handle case where base_model_name_or_path is invalid
1 parent 19dbc44 commit 77c8627

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

convert_lora_to_gguf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,12 @@ def load_hparams_from_hf(hf_model_id: str) -> dict[str, Any]:
317317
if "base_model_name_or_path" in lparams:
318318
model_id = lparams["base_model_name_or_path"]
319319
logger.info(f"Loading base model from Hugging Face: {model_id}")
320-
hparams = load_hparams_from_hf(model_id)
320+
try:
321+
hparams = load_hparams_from_hf(model_id)
322+
except OSError as e:
323+
logger.error(f"Failed to load base model config: {e}")
324+
logger.error("Please try downloading the base model and add its path to --base")
325+
sys.exit(1)
321326
else:
322327
logger.error("'base_model_name_or_path' is not found in adapter_config.json")
323328
logger.error("Base model config is required. Please download the base model and add its path to --base")

0 commit comments

Comments
 (0)