Skip to content

Conversation

@junpuf
Copy link
Contributor

@junpuf junpuf commented Oct 27, 2025

Purpose

FIX #27595

Now:

    outputs = llm.generate(promtps, priority=[0, 0, 0])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/inference_playground/vllm/vllm/entrypoints/llm.py", line 432, in generate
    self._validate_and_add_requests(
  File "/home/ec2-user/inference_playground/vllm/vllm/entrypoints/llm.py", line 1591, in _validate_and_add_requests
    priority=priority[i] if priority else 0,
             ~~~~~~~~^^^
IndexError: list index out of range

After fix:

    outputs = llm.generate(promtps, priority=[0, 0, 0])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/inference_playground/vllm/vllm/entrypoints/llm.py", line 432, in generate
    self._validate_and_add_requests(
  File "/home/ec2-user/inference_playground/vllm/vllm/entrypoints/llm.py", line 1568, in _validate_and_add_requests
    raise ValueError("The lengths of prompts and priority must be the same.")
ValueError: The lengths of prompts and priority must be the same.

Test Plan

pytest -s -v tests/entrypoints/llm/test_generate.py

Test Result

Unit Test

Pass

Full CI Test:


Essential Elements of an Effective PR Description Checklist
  • [x ] The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • [x ] The test plan, such as providing test command.
  • [x ] The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@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 ask your reviewers to trigger select CI tests on top of fastcheck CI.

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.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@mergify mergify bot added the frontend label Oct 27, 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 addresses a bug where the priority argument in the llm.generate function was not validated for length against the prompts argument, leading to an IndexError. The fix adds a check to ensure that the lengths of prompts and priority are the same, raising a ValueError if they differ. Additionally, a test case has been added to verify this validation.

Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

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

Thanks @junpuf!

I guess we don't support priority here being a single int shared by all the requests?

@junpuf
Copy link
Contributor Author

junpuf commented Oct 27, 2025

Thanks @junpuf!

I guess we don't support priority here being a single int shared by all the requests?

Looks like so, for now if priority is None then 0 will be used.

@njhill njhill added the ready ONLY add when PR is ready to merge/full CI is needed label Oct 27, 2025
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) October 28, 2025 04:37
@DarkLight1337
Copy link
Member

DarkLight1337 commented Oct 28, 2025

Can you merge with main to fix CI?

Sorry I didn't see your latest merge

@junpuf
Copy link
Contributor Author

junpuf commented Oct 28, 2025

Can you merge with main to fix CI?

Branch is up to date with main, thanks for checking in.

@DarkLight1337 DarkLight1337 merged commit b186149 into vllm-project:main Oct 28, 2025
49 checks passed
@junpuf junpuf deleted the bugfix-python-frontend branch October 28, 2025 14:38
bhagyashrigai pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Oct 29, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: IndexError: list index out of range when priority length not matching length of prompts in LLM class

3 participants