From 37bfee92bf4159f5839d9bed6b2fb2b96db4e741 Mon Sep 17 00:00:00 2001 From: yihong Date: Thu, 3 Apr 2025 11:53:19 +0800 Subject: [PATCH] fix: better error message for get_config close #13889 (#15943) Signed-off-by: yihong0618 --- vllm/transformers_utils/config.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/vllm/transformers_utils/config.py b/vllm/transformers_utils/config.py index 71990468c315a..d27a126ddbc06 100644 --- a/vllm/transformers_utils/config.py +++ b/vllm/transformers_utils/config.py @@ -262,6 +262,11 @@ def get_config( MISTRAL_CONFIG_NAME, revision=revision): config_format = ConfigFormat.MISTRAL + else: + raise ValueError( + "Could not detect config format for no config file found. " + "Ensure your model has either config.json (HF format) " + "or params.json (Mistral format).") except Exception as e: error_message = ( @@ -324,7 +329,14 @@ def get_config( elif config_format == ConfigFormat.MISTRAL: config = load_params_config(model, revision, token=HF_TOKEN, **kwargs) else: - raise ValueError(f"Unsupported config format: {config_format}") + supported_formats = [ + fmt.value for fmt in ConfigFormat if fmt != ConfigFormat.AUTO + ] + raise ValueError( + f"Unsupported config format: {config_format}. " + f"Supported formats are: {', '.join(supported_formats)}. " + f"Ensure your model uses one of these configuration formats " + f"or specify the correct format explicitly.") # Special architecture mapping check for GGUF models if is_gguf: