A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 22:15 UTC
[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>
Chen1022 committed
Feb 25, 2025 at 18:12 UTC
32c3b6bfd180ee931d5a50c1d80e4b6dd92861dc
1 file changed
+22
-8
vllm/transformers_utils/config.py
+22
-8
@@ -253,14 +253,28 @@ def get_config(
253
model = Path(model).parent
254
255
if config_format == ConfigFormat.AUTO:
256
- if is_gguf or file_or_path_exists(
257
- model, HF_CONFIG_NAME, revision=revision):
258
- config_format = ConfigFormat.HF
259
- elif file_or_path_exists(model, MISTRAL_CONFIG_NAME,
260
- revision=revision):
261
- config_format = ConfigFormat.MISTRAL
262
- else:
263
- raise ValueError(f"No supported config format found in {model}.")
256
+ try:
257
+ if is_gguf or file_or_path_exists(
258
+ model, HF_CONFIG_NAME, revision=revision):
259
+ config_format = ConfigFormat.HF
260
+ elif file_or_path_exists(model,
261
+ MISTRAL_CONFIG_NAME,
262
+ revision=revision):
263
+ config_format = ConfigFormat.MISTRAL
264
+
265
+ except Exception as e:
266
+ error_message = (
267
+ "Invalid repository ID or local directory specified:"
268
+ " '{model}'.\nPlease verify the following requirements:\n"
269
+ "1. Provide a valid Hugging Face repository ID.\n"
270
+ "2. Specify a local directory that contains a recognized "
271
+ "configuration file.\n"
272
+ " - For Hugging Face models: ensure the presence of a "
273
+ "'config.json'.\n"
274
+ " - For Mistral models: ensure the presence of a "
275
+ "'params.json'.\n")
276
+
277
+ raise ValueError(error_message) from e
278
279
if config_format == ConfigFormat.HF:
280
config_dict, _ = PretrainedConfig.get_config_dict(