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

[RFC][vllm-API] Support tokenizer registry for customized tokenizer in vLLM #12518

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

youngkent
Copy link
Contributor

@youngkent youngkent commented Jan 28, 2025

To allow customized on-demand registration of tokenizer, this diff is to propose a tokenizer registry in vllm, similar to model registry.

  • Created a TokenizerBase as the standard vLLM tokenizer API
  • Mistral tokenizer now inherit from TokenizerBase
  • Support TokenizerRegistry for register and get tokenizers
  • Add a "custom" tokenizer mode to trigger this behavior.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@DarkLight1337 DarkLight1337 self-assigned this Jan 29, 2025
@DarkLight1337
Copy link
Member

Thanks for cleaning this up, can you update the relevant CLI args to have a similar interface as tool parsing?

@youngkent
Copy link
Contributor Author

Thanks for cleaning this up, can you update the relevant CLI args to have a similar interface as tool parsing?

@DarkLight1337 Sure, I would be happy to. just to make sure I understand correctly, which CLI interface you are referring to? (This PR does not require change of external interface. It only add a new type in tokenizer_mode arg)

@mergify mergify bot added the frontend label Jan 29, 2025
Copy link

mergify bot commented Jan 29, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @youngkent.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@DarkLight1337
Copy link
Member

DarkLight1337 commented Jan 30, 2025

I mean you should update the help text inside vllm serve

Copy link
Contributor

@houseroad houseroad left a comment

Choose a reason for hiding this comment

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

Btw, can we create some unittest to check the custom tokenizer logic?

Comment on lines +213 to +219
@property
def sep_token(self) -> str:
raise NotImplementedError()

@property
def pad_token(self) -> str:
raise NotImplementedError()
Copy link
Member

Choose a reason for hiding this comment

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

Can we get this by decoding the token IDs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DarkLight1337 There is no official corresponding sep_token and pad token in mistral tokenizer. Also decoding special token id is not supported in the mistral tokenizer at the moment.
Since this these two methods in MistralTokenizer is actually not used throughout the code base, maybe we leave it as NotImplemented until we have the need for it?

Copy link
Member

Choose a reason for hiding this comment

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

Ok, let's leave this as is then.

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

Successfully merging this pull request may close these issues.

3 participants