mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 07:04:53 +08:00
[Misc]Clarify Error Handling for Non-existent Model Paths and HF Repo IDs (#13724)
Signed-off-by: Chen-0210 <chenjincong11@gmail.com> Co-authored-by: Michael Goin <mgoin64@gmail.com>
This commit is contained in:
parent
37b6cb4985
commit
32c3b6bfd1
@ -253,14 +253,28 @@ def get_config(
|
||||
model = Path(model).parent
|
||||
|
||||
if config_format == ConfigFormat.AUTO:
|
||||
if is_gguf or file_or_path_exists(
|
||||
model, HF_CONFIG_NAME, revision=revision):
|
||||
config_format = ConfigFormat.HF
|
||||
elif file_or_path_exists(model, MISTRAL_CONFIG_NAME,
|
||||
revision=revision):
|
||||
config_format = ConfigFormat.MISTRAL
|
||||
else:
|
||||
raise ValueError(f"No supported config format found in {model}.")
|
||||
try:
|
||||
if is_gguf or file_or_path_exists(
|
||||
model, HF_CONFIG_NAME, revision=revision):
|
||||
config_format = ConfigFormat.HF
|
||||
elif file_or_path_exists(model,
|
||||
MISTRAL_CONFIG_NAME,
|
||||
revision=revision):
|
||||
config_format = ConfigFormat.MISTRAL
|
||||
|
||||
except Exception as e:
|
||||
error_message = (
|
||||
"Invalid repository ID or local directory specified:"
|
||||
" '{model}'.\nPlease verify the following requirements:\n"
|
||||
"1. Provide a valid Hugging Face repository ID.\n"
|
||||
"2. Specify a local directory that contains a recognized "
|
||||
"configuration file.\n"
|
||||
" - For Hugging Face models: ensure the presence of a "
|
||||
"'config.json'.\n"
|
||||
" - For Mistral models: ensure the presence of a "
|
||||
"'params.json'.\n")
|
||||
|
||||
raise ValueError(error_message) from e
|
||||
|
||||
if config_format == ConfigFormat.HF:
|
||||
config_dict, _ = PretrainedConfig.get_config_dict(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user