vllm
[Misc]Clarify Error Handling for Non-existent Model Paths and HF Repo IDs
#13724
Merged

[Misc]Clarify Error Handling for Non-existent Model Paths and HF Repo IDs #13724

mgoin merged 5 commits into vllm-project:main from main
Chen-0210
Chen-0210172 days ago (edited 172 days ago)

Background

The --model option (no need in vllm serve) accepts either a Hugging Face (HF) repo ID or a local path. Currently, two confusing scenarios occur:

  • Local Path:
    When a non-existent local path (e.g., "/xxx/xxx") is provided, an error is raised at this line. The error message,

    HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name'
    

    misleadingly suggests that the input should be an HF repo ID.

  • HF Repo ID:
    When a non-existent HF repo ID (e.g., "xxx/xxx", without a leading /) is provided, the error does not occur immediately at this line. Instead, it fails later in the code, as described in issue #13510.

Changes

This PR unifies error handling for both cases by:

  • Clear Messaging: Providing consistent and clear error messages so users immediately understand whether the issue is with a local path or an HF repo ID.

Example Usage

vllm serve /home/model-does-not-exist
INFO 02-24 04:15:43 __init__.py:207] Automatically detected platform cuda.
INFO 02-24 04:15:43 api_server.py:912] vLLM API server version 0.7.3
INFO 02-24 04:15:43 api_server.py:913] args: Namespace(subparser='serve', model_tag='/home/model-does-not-exist', config='', host=None, port=8000, uvicorn_log_level='info', allow_credentials=False, allowed_origins=['*'], allowed_methods=['*'], allowed_headers=['*'], api_key=None, lora_modules=None, prompt_adapters=None, chat_template=None, chat_template_content_format='auto', response_role='assistant', ssl_keyfile=None, ssl_certfile=None, ssl_ca_certs=None, ssl_cert_reqs=0, root_path=None, middleware=[], return_tokens_as_token_ids=False, disable_frontend_multiprocessing=False, enable_request_id_headers=False, enable_auto_tool_choice=False, enable_reasoning=False, reasoning_parser=None, tool_call_parser=None, tool_parser_plugin='', model='/home/model-does-not-exist', task='auto', tokenizer=None, skip_tokenizer_init=False, revision=None, code_revision=None, tokenizer_revision=None, tokenizer_mode='auto', trust_remote_code=False, allowed_local_media_path=None, download_dir=None, load_format='auto', config_format=<ConfigFormat.AUTO: 'auto'>, dtype='auto', kv_cache_dtype='auto', max_model_len=None, guided_decoding_backend='xgrammar', logits_processor_pattern=None, model_impl='auto', distributed_executor_backend=None, pipeline_parallel_size=1, tensor_parallel_size=1, max_parallel_loading_workers=None, ray_workers_use_nsight=False, block_size=None, enable_prefix_caching=None, disable_sliding_window=False, use_v2_block_manager=True, num_lookahead_slots=0, seed=0, swap_space=4, cpu_offload_gb=0, gpu_memory_utilization=0.9, num_gpu_blocks_override=None, max_num_batched_tokens=None, max_num_partial_prefills=1, max_long_partial_prefills=1, long_prefill_token_threshold=0, max_num_seqs=None, max_logprobs=20, disable_log_stats=False, quantization=None, rope_scaling=None, rope_theta=None, hf_overrides=None, enforce_eager=False, max_seq_len_to_capture=8192, disable_custom_all_reduce=False, tokenizer_pool_size=0, tokenizer_pool_type='ray', tokenizer_pool_extra_config=None, limit_mm_per_prompt=None, mm_processor_kwargs=None, disable_mm_preprocessor_cache=False, enable_lora=False, enable_lora_bias=False, max_loras=1, max_lora_rank=16, lora_extra_vocab_size=256, lora_dtype='auto', long_lora_scaling_factors=None, max_cpu_loras=None, fully_sharded_loras=False, enable_prompt_adapter=False, max_prompt_adapters=1, max_prompt_adapter_token=0, device='auto', num_scheduler_steps=1, multi_step_stream_outputs=True, scheduler_delay_factor=0.0, enable_chunked_prefill=None, speculative_model=None, speculative_model_quantization=None, num_speculative_tokens=None, speculative_disable_mqa_scorer=False, speculative_draft_tensor_parallel_size=None, speculative_max_model_len=None, speculative_disable_by_batch_size=None, ngram_prompt_lookup_max=None, ngram_prompt_lookup_min=None, spec_decoding_acceptance_method='rejection_sampler', typical_acceptance_sampler_posterior_threshold=None, typical_acceptance_sampler_posterior_alpha=None, disable_logprobs_during_spec_decoding=None, model_loader_extra_config=None, ignore_patterns=[], preemption_mode=None, served_model_name=None, qlora_adapter_name_or_path=None, otlp_traces_endpoint=None, collect_detailed_traces=None, disable_async_output_proc=False, scheduling_policy='fcfs', scheduler_cls='vllm.core.scheduler.Scheduler', override_neuron_config=None, override_pooler_config=None, compilation_config=None, kv_transfer_config=None, worker_cls='auto', generation_config=None, override_generation_config=None, enable_sleep_mode=False, calculate_kv_scales=False, additional_config=None, disable_log_requests=False, max_log_len=None, disable_fastapi_docs=False, enable_prompt_tokens_details=False, dispatch_function=<function ServeSubcommand.cmd at 0x7fb16acb5120>)
INFO 02-24 04:15:43 api_server.py:209] Started engine process with PID 40037
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/config.py", line 257, in get_config
    if is_gguf or file_or_path_exists(
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/config.py", line 168, in file_or_path_exists
    cached_filepath = try_to_load_from_cache(repo_id=model,
  File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 106, in _inner_fn
    validate_repo_id(arg_value)
  File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 153, in validate_repo_id
    raise HFValidationError(
huggingface_hub.errors.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/model-does-not-exist'. Use `repo_type` argument if needed.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/vllm", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/cli/main.py", line 73, in main
    args.dispatch_function(args)
  File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/cli/serve.py", line 34, in cmd
    uvloop.run(run_server(args))
  File "/usr/local/lib/python3.10/dist-packages/uvloop/__init__.py", line 82, in run
    return loop.run_until_complete(wrapper())
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.10/dist-packages/uvloop/__init__.py", line 61, in wrapper
    return await main
  File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/openai/api_server.py", line 947, in run_server
    async with build_async_engine_client(args) as engine_client:
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/openai/api_server.py", line 139, in build_async_engine_client
    async with build_async_engine_client_from_engine_args(
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/openai/api_server.py", line 220, in build_async_engine_client_from_engine_args
    engine_config = engine_args.create_engine_config()
  File "/usr/local/lib/python3.10/dist-packages/vllm/engine/arg_utils.py", line 1127, in create_engine_config
    model_config = self.create_model_config()
  File "/usr/local/lib/python3.10/dist-packages/vllm/engine/arg_utils.py", line 1047, in create_model_config
    return ModelConfig(
  File "/usr/local/lib/python3.10/dist-packages/vllm/config.py", line 304, in __init__
    hf_config = get_config(self.model, trust_remote_code, revision,
  File "/usr/local/lib/python3.10/dist-packages/vllm/transformers_utils/config.py", line 274, in get_config
    raise ValueError(error_message) from e
ValueError: Invalid repository ID or local directory specified: '{model}'.
Please verify the following requirements:
1. Provide a valid Hugging Face repository ID.
2. Specify a local directory that contains a recognized configuration file.
   - For Hugging Face models: ensure the presence of a 'config.json'.
   - For MISTRAL models: ensure the presence of a 'params.json'.
Chen-0210 clear error output
ba1f5025
github-actions
github-actions172 days ago

๐Ÿ‘‹ Hi! Thank you for contributing to the vLLM project.

๐Ÿ’ฌ Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

๐Ÿš€

Chen-0210 fix
9e6fa3d1
mergify mergify added ci/build
Chen-0210 fix
20885b9e
Chen-0210 fix
f28e1bf0
Chen-0210 Chen-0210 changed the title [Misc]clear error model messages [Misc]Clarify Error Handling for Non-existent Model Paths and HF Repo IDs 172 days ago
mgoin
mgoin approved these changes on 2025-02-24
mgoin171 days ago

LGTM, thanks for improving the confusing error!

Conversation is marked as resolved
Show resolved
vllm/transformers_utils/config.py
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 "
mgoin171 days ago
Suggested change
" - For MISTRAL models: ensure the presence of a "
" - For Mistral models: ensure the presence of a "
mgoin Update vllm/transformers_utils/config.py
910a7388
mgoin mgoin added ready
mgoin mgoin enabled auto-merge (squash) 171 days ago
Chen-0210 Chen-0210 requested a review from mgoin mgoin 171 days ago
mgoin mgoin merged 32c3b6bf into main 170 days ago

Login to write a write a comment.

Login via GitHub

Reviewers
Assignees
No one assigned
Labels
Milestone