Skip to content

Refactor _check_chat_template method to improve tokenizer compatibility checks#1855

Open
Ki-Seki wants to merge 1 commit intodottxt-ai:mainfrom
Ki-Seki:Ki-Seki/issue1854
Open

Refactor _check_chat_template method to improve tokenizer compatibility checks#1855
Ki-Seki wants to merge 1 commit intodottxt-ai:mainfrom
Ki-Seki:Ki-Seki/issue1854

Conversation

@Ki-Seki
Copy link
Copy Markdown
Contributor

@Ki-Seki Ki-Seki commented Apr 26, 2026

Fixes #1854

This PR removes strict type‑based checks against vLLM’s internal tokenizer classes (PreTrainedTokenizer, PreTrainedTokenizerFast, TokenizerBase), which were removed or renamed in newer vLLM releases. Instead, the logic now uses capability‑based detection (hasattr + safe apply_chat_template invocation), ensuring compatibility across:

  • vLLM<0.19 (old tokenizer stack)
  • vLLM>=0.19 (new TokenizerLike interface)
  • future vLLM versions (as long as apply_chat_template exists)

This makes Outlines robust to upstream API changes and eliminates fragile imports from vLLM internals.

🚧 Thank you for opening a PR!

A few important guidelines and requirements before we can merge your PR:

  • We should be able to understand what the PR does from its title only;
  • There is a high-level description of the changes;
  • If I add a new feature, there is an issue discussing it already;
  • There are links to all the relevant issues, discussions and PRs;
  • The branch is rebased on the latest main commit;
  • Commit messages follow these guidelines;
  • One commit per logical change;
  • The code respects the current naming conventions;
  • Docstrings follow the numpy style guide;
  • pre-commit is installed and configured on your machine, and you ran it before opening the PR;
  • There are tests covering the changes;
  • The documentation is up-to-date;

Consider opening a Draft PR if your work is still in progress but you would
like some feedback from other contributors.

Copilot AI review requested due to automatic review settings April 26, 2026 03:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Ki-Seki
Copy link
Copy Markdown
Contributor Author

Ki-Seki commented Apr 26, 2026

@RobinPicard Could you take a look at my PR and review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility with vllm==0.19 because of some api changes

2 participants