Skip to content

[Misc] add return token strs for tokenize#18941

Merged
DarkLight1337 merged 2 commits intovllm-project:mainfrom
reidliu41:add-token-str
May 31, 2025
Merged

[Misc] add return token strs for tokenize#18941
DarkLight1337 merged 2 commits intovllm-project:mainfrom
reidliu41:add-token-str

Conversation

@reidliu41
Copy link
Copy Markdown
Contributor

@reidliu41 reidliu41 commented May 30, 2025

FIX #18928 (link existing issues this PR will resolve)

$ curl -X POST http://localhost:8000/tokenize   -H "Content-Type: application/json"   -d '{
    "model": "meta-llama/Meta-Llama-3-8B-Instruct",
    "prompt": "Hello world!",
    "return_token_strs": true
}'|jq

{
  "count": 4,
  "max_model_len": 8192,
  "tokens": [
    128000,
    9906,
    1917,
    0
  ],
  "token_strs": [
    "<|begin_of_text|>",
    "Hello",
    "Ġworld",
    "!"
  ]
}

Signed-off-by: reidliu41 <reid201711@gmail.com>
@mergify mergify bot added the frontend label May 30, 2025
@github-actions
Copy link
Copy Markdown

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

🚀

@reidliu41
Copy link
Copy Markdown
Contributor Author

@DarkLight1337 hi, could you please help to take a look this if you have time? thanks

@DarkLight1337
Copy link
Copy Markdown
Member

Can you add a test?

Signed-off-by: reidliu41 <reid201711@gmail.com>
Copy link
Copy Markdown
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

Thanks for adding this!

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) May 31, 2025 14:36
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label May 31, 2025
@DarkLight1337 DarkLight1337 merged commit 20079c6 into vllm-project:main May 31, 2025
73 checks passed
amitm02 pushed a commit to amitm02/vllm that referenced this pull request Jun 1, 2025
Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: reidliu41 <reid201711@gmail.com>
Signed-off-by: amit <amit.man@gmail.com>
amitm02 pushed a commit to amitm02/vllm that referenced this pull request Jun 1, 2025
Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: reidliu41 <reid201711@gmail.com>
Signed-off-by: amit <amit.man@gmail.com>
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.

[Feature]: Return token strings in addition to token ids for /tokenize

2 participants