Skip to content

Add "/server_info" endpoint in api_server to retrieve the vllm_config.  #16572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025

Conversation

Cangxihui
Copy link
Contributor

@Cangxihui Cangxihui commented Apr 14, 2025

Add a server_info endpoint to allow users to directly retrieve the vllm configuration parameters without the need to parse logs..

Example APi -http://localhost:8000/server_info
{"vllm_config":"model='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', speculative_config=None, tokenizer='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, override_neuron_config=None, tokenizer_revision=None, trust_remote_code=True, dtype=torch.bfloat16, max_seq_len=32768, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=True, kv_cache_dtype=auto, device_config=cuda, decoding_config=DecodingConfig(guided_decoding_backend='xgrammar', reasoning_backend=None), observability_config=ObservabilityConfig(show_hidden_metrics=False, otlp_traces_endpoint=None, collect_model_forward_time=False, collect_model_execute_time=False), seed=None, served_model_name=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B, num_scheduler_steps=1, multi_step_stream_outputs=True, enable_prefix_caching=True, chunked_prefill_enabled=True, use_async_output_proc=False, disable_mm_preprocessor_cache=False, mm_processor_kwargs=None, pooler_config=None, compilation_config={\"splitting_ops\":[],\"compile_sizes\":[],\"cudagraph_capture_sizes\":[],\"max_capture_size\":0}"}

Copy link

👋 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.

🚀

@mergify mergify bot added the frontend label Apr 14, 2025
@DarkLight1337
Copy link
Member

For security reasons, this information should only be dev facing. Can you move this endpoint under the if envs.VLLM_SERVER_DEV_MODE: guard?

# Store global states
@dataclasses.dataclass
class _GlobalState:
vllmconfig: VllmConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vllmconfig: VllmConfig
vllm_config: VllmConfig

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also do we really need the whole vLLM config? We can avoid creating a new global state object if we can simply use model_config.

Copy link
Member

@DarkLight1337 DarkLight1337 Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we need the whole vLLM config, we should initialize it in init_app_state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the information provided by model_config is sometimes insufficient. We want to record and display all the parameters used when starting the vllm serve server. On one hand, this allows users to more easily understand all the server's configurations. On the other hand, it facilitates comparisons between different runs and makes it easier to fully reproduce previous experiments based on these parameters. Currently, the only way to obtain and record this information is by parsing logs, which has limitations. Moreover, if the log format changes, the parsing logic also needs to be adjusted accordingly. Thank you for your suggestions, I will try to initialize it in init_app_state.

…E is 1, then add "/server_info" endpoint in api_server.

Signed-off-by: Xihui Cang <[email protected]>
Comment on lines 732 to 735
@router.get("/server_info")
async def show_server_info(raw_request: Request):
server_info = {"vllm_config": str(raw_request.app.state.vllm_config)}
return JSONResponse(content=server_info)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place this at the top of the block since it's more "basic"?

…w_server_info, get_vllm_config

Signed-off-by: Xihui Cang <[email protected]>
Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) April 15, 2025 06:47
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Apr 15, 2025
@DarkLight1337 DarkLight1337 merged commit 1666e66 into vllm-project:main Apr 15, 2025
64 checks passed
yangw-dev pushed a commit to yangw-dev/vllm that referenced this pull request Apr 21, 2025
jikunshang pushed a commit to jikunshang/vllm that referenced this pull request Apr 29, 2025
lk-chen pushed a commit to lk-chen/vllm that referenced this pull request Apr 29, 2025
RichardoMrMu pushed a commit to RichardoMrMu/vllm that referenced this pull request May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend ready ONLY add when PR is ready to merge/full CI is needed v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants