Skip to content

Conversation

@chaunceyjiang
Copy link
Collaborator

@chaunceyjiang chaunceyjiang commented Jul 16, 2025

Purpose

Fix https://buildkite.com/vllm/ci/builds/24047/steps/canvas?jid=01980fe5-71cd-4800-b119-932abd62ee98

Test Plan

Test Result

vllm serve Qwen/Qwen2.5-VL-3B-Instruct --max-model-len 2048  --max-num-seqs 5  --enable-prompt-tokens-details
curl -X POST -H 'Content-Type: application/json' -d '{"prompt_embeds": []}' --insecure http://localhost:8000/v1/completions
{"id":"cmpl-cf6bf8ab61894062928739ad1962f141","object":"text_completion","created":1752671527,"model":"Qwen/Qwen2.5-VL-3B-Instruct","choices":[],"service_tier":null,"system_fingerprint":null,"usage":{"prompt_tokens":0,"total_tokens":0,"completion_tokens":0,"prompt_tokens_details":null},"kv_transfer_params":null}

(Optional) Documentation Update

@chaunceyjiang chaunceyjiang requested a review from aarnphm as a code owner July 16, 2025 13:10
@github-actions
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 Jul 16, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a list index out of range error that occurs when an empty list of prompts is provided. The change prevents accessing final_res_batch[0] when the list is empty. I've added one critical comment pointing out a related NameError that can occur under the same conditions, with a suggestion on how to resolve it to make the function fully robust.

@chaunceyjiang
Copy link
Collaborator Author

@DarkLight1337 PTAL.

total_tokens=num_prompt_tokens + num_generated_tokens,
)

if self.enable_prompt_tokens_details and final_res.num_cached_tokens:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: final_res is an internal variable from the for-loop above. If final_res_batch is an empty list ([]), then final_res will not be initialized.

@mergify mergify bot added the v1 label Jul 17, 2025
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) July 17, 2025 02:55
auto-merge was automatically disabled July 17, 2025 03:48

Head branch was pushed to by a user without write access

@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 17, 2025
@vllm-bot vllm-bot merged commit fdc5b43 into vllm-project:main Jul 17, 2025
67 of 69 checks passed
@chaunceyjiang chaunceyjiang deleted the prompt_embeds branch July 17, 2025 07:29
x22x22 pushed a commit to x22x22/vllm that referenced this pull request Aug 5, 2025
Pradyun92 pushed a commit to Pradyun92/vllm that referenced this pull request Aug 6, 2025
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 27, 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.

3 participants