Skip to content

Conversation

@lengrongfu
Copy link
Contributor

@lengrongfu lengrongfu commented Jul 30, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)". [Bug]: vLLM 0.10.0 breaks skip_tokenizer_init=True #21846
  • The test plan, such as providing test command.
  • 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.

Purpose

Fix when set skip_tokenizer_init after can't running vllm.

Test success.

import vllm
from transformers import AutoTokenizer

model_name = "Qwen/Qwen2.5-1.5B-Instruct"
llm = vllm.LLM(model_name, skip_tokenizer_init=True)
tokenizer = AutoTokenizer.from_pretrained(model_name)
input_ids = tokenizer.encode("test")
print(llm.generate([{"prompt_token_ids": input_ids}]))
image

Resolves #21846.

Test Plan

Test Result

(Optional) Documentation Update

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

The pull request aims to fix a crash when skip_tokenizer_init=True. The changes correctly guard against a None tokenizer in two places, preventing crashes during input validation and processing. However, the fix is incomplete and will still lead to a crash during output processing because detokenization is attempted without a tokenizer. I've identified this critical issue and suggested a more comprehensive fix to make the skip_tokenizer_init feature robust.

Comment on lines +92 to +95
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

This change correctly handles the case where allowed_token_ids are provided with skip_tokenizer_init=True. However, the PR is incomplete and will still lead to a crash in other common scenarios.

When skip_tokenizer_init=True, OutputProcessor is initialized with tokenizer=None. This will cause a crash in process_outputs when it tries to create a Detokenizer, which will raise a ValueError: Tokenizer not initialized. This happens even if the user sets detokenize=False in SamplingParams, because the default SamplingParams has detokenize=True. The test case in the PR description will trigger this crash.

Additionally, if bad_words are provided, they are silently ignored as update_from_tokenizer is skipped, but no warning or error is raised to the user.

To properly fix this, we should validate these unsupported parameter combinations when skip_tokenizer_init=True and raise an error, similar to how structured output is handled. A good place for these checks would be in _validate_params or at the beginning of this method (_validate_sampling_params).

For example:

if self.tokenizer is None:
    if params.detokenize:
        raise ValueError(
            "Detokenization is not supported when `skip_tokenizer_init=True`. "
            "Please set `detokenize=False` in `SamplingParams`."
        )
    if params.bad_words:
        raise ValueError(
            "`bad_words` is not supported when `skip_tokenizer_init=True`."
        )

Without this, the bug is not fully fixed and the feature remains partially broken.

Copy link
Member

Choose a reason for hiding this comment

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

This will cause a crash in process_outputs when it tries to create a Detokenizer, which will raise a ValueError: Tokenizer not initialized.

I don't think this is correct, may be getting confused with v0.

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

🚀

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 @lengrongfu! Do you think you could also add a unit test?

I thought we had test coverage for this already but perhaps it was only for the V0 case...

@lengrongfu lengrongfu force-pushed the fix/skip_tokenizer_init branch from 76b0cee to ffe0fe3 Compare July 30, 2025 13:18
@lengrongfu
Copy link
Contributor Author

Thanks @lengrongfu! Do you think you could also add a unit test?

I thought we had test coverage for this already but perhaps it was only for the V0 case...

I add a unit test, can test this case.

@njhill njhill added bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed labels Jul 31, 2025
@DarkLight1337
Copy link
Member

Can you merge from main to fix the CI failures?

@lengrongfu lengrongfu force-pushed the fix/skip_tokenizer_init branch from ffe0fe3 to dc047a7 Compare August 1, 2025 13:10
@vllm-bot vllm-bot merged commit b879ecd into vllm-project:main Aug 1, 2025
38 of 40 checks passed
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
noamgat pushed a commit to noamgat/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 28, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
@lengrongfu lengrongfu deleted the fix/skip_tokenizer_init branch October 21, 2025 02:55
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 v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: vLLM 0.10.0 breaks skip_tokenizer_init=True

4 participants