Skip to content
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

[Bugfix] Fix max_num_batched_tokens for MLA #13620

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

mgoin
Copy link
Member

@mgoin mgoin commented Feb 20, 2025

Without this change we are stuck with a very short allowed prompt length by default with deepseek models

Before this PR:

vllm serve /home/vllm-dev/DeepSeek-R1 --trust-remote-code --tensor-parallel-size 8
...
WARNING 02-20 17:08:38 scheduler.py:949] Input prompt (100005 tokens) is too long and exceeds limit of 2048

You can get past this manually by setting max_num_batched_tokens, but we should take care of this automatically

vllm serve /home/vllm-dev/DeepSeek-R1 --trust-remote-code --tensor-parallel-size 8 --max-num-batched-tokens 163840

Client:

from openai import OpenAI

openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"

client = OpenAI(api_key=openai_api_key, base_url=openai_api_base)
model_id = client.models.list().data[0].id

# Query a prompt of roughly 100k tokens by repeating a simple token.
prompt = ("A " * 100000).strip()
chat_response = client.chat.completions.create(
    model=model_id,
    messages=[{"role": "user", "content": [{"type": "text", "text": prompt}]}],
)
print("Text Chat completion output:", chat_response.choices[0].message.content)

Signed-off-by: mgoin <mgoin64@gmail.com>
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.

🚀

Signed-off-by: mgoin <mgoin64@gmail.com>
@mgoin mgoin added the bug Something isn't working label Feb 20, 2025
@mgoin mgoin changed the title Fix max_num_batched_tokens for MLA [Bugfix] Fix max_num_batched_tokens for MLA Feb 20, 2025
@simon-mo simon-mo enabled auto-merge (squash) February 21, 2025 01:44
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 21, 2025
@simon-mo simon-mo disabled auto-merge February 21, 2025 01:45
@simon-mo simon-mo merged commit 71face8 into vllm-project:main Feb 21, 2025
16 of 22 checks passed
kerthcet pushed a commit to kerthcet/vllm that referenced this pull request Feb 21, 2025
JenZhao pushed a commit to JenZhao/vllm that referenced this pull request Feb 21, 2025
michaelrglass pushed a commit to michaelrglass/vllm that referenced this pull request Feb 21, 2025
Signed-off-by: mgoin <mgoin64@gmail.com>
Signed-off-by: Michael Glass <mrglass@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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.

4 participants