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

[Frontend] Support for chat completions input in the tokenize endpoint #5923

Merged
merged 8 commits into from
Jul 16, 2024

Conversation

sasha0552
Copy link
Contributor

Related: #5054 (#5054 (comment))

Example:

$ curl -H "Authorization: Bearer token-abc123" -H "Content-Type: application/json" -d '{"model":"meta-llama/Meta-Llama-3-8B-Instruct","prompt":"test"}' http://localhost:8000/tokenize
{
  "count": 1,
  "max_model_len": 8192,
  "tokens": [1985],
}

$ curl -H "Authorization: Bearer token-abc123" -H "Content-Type: application/json" -d '{"model":"meta-llama/Meta-Llama-3-8B-Instruct","messages":[{"role":"user","content":"Hi"}]}' http://localhost:8000/tokenize
{
  "count": 11,
  "max_model_len": 8192,
  "tokens": [128000,128006,882,128007,271,13347,128009,128006,78191,128007,271]
}

$ curl -H "Authorization: Bearer token-abc123" -H "Content-Type: application/json" -d '{"model":"meta-llama/Meta-Llama-3-8B-Instruct","tokens":[128000,128006,882,128007,271,13347,128009,128006,78191,128007,271]}' http://localhost:8000/detokenize
{
  "prompt": "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHi<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
}

@DarkLight1337
Copy link
Member

DarkLight1337 commented Jun 28, 2024

To speed up the CI queue for #5905, I've cancelled the distributed tests for the latest CI run in this PR since they won't pass anyway until #5905 has been merged. Please merge main into your branch after that happens so that the CI can pass once again.

@DarkLight1337
Copy link
Member

DarkLight1337 commented Jun 29, 2024

Hmm, I think we can move this to a new file (as in create a new subclass of OpenAIServing) since it's not really a part of OpenAI's Chat or Completions API. We can support both Chat and Completions input.

@DarkLight1337 DarkLight1337 self-assigned this Jul 16, 2024
Copy link
Contributor Author

@sasha0552 sasha0552 left a comment

Choose a reason for hiding this comment

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

Just a reminder for myself (so I don't cancel the CI).

tests/entrypoints/openai/test_tokenization.py Outdated Show resolved Hide resolved
@sasha0552
Copy link
Contributor Author

/ready

@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 16, 2024
Copy link
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.

LGTM, thanks for extending this feature!

@DarkLight1337 DarkLight1337 merged commit 7a3d2a5 into vllm-project:main Jul 16, 2024
88 checks passed
@sasha0552 sasha0552 deleted the te-chat branch July 16, 2024 13:16
dtrifiro pushed a commit to opendatahub-io/vllm that referenced this pull request Jul 17, 2024
Alvant pushed a commit to compressa-ai/vllm that referenced this pull request Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants