Skip to content

Fix: Echo without asking for new tokens or logprobs in OpenAI Completions API#2995

Closed
matheper wants to merge 10 commits intovllm-project:mainfrom
matheper:echo-max-token-zero
Closed

Fix: Echo without asking for new tokens or logprobs in OpenAI Completions API#2995
matheper wants to merge 10 commits intovllm-project:mainfrom
matheper:echo-max-token-zero

Conversation

@matheper
Copy link

@matheper matheper commented Feb 22, 2024

Hi,

I've noticed that a recent modification to the OpenAI entrypoint has made these two use cases inoperable, which were previously supported by vLLM:

  1. Echoing the prompt without generating anything (max_tokens=0).
  2. Echoing along with generation, but without logprobs.

This PR adds these use cases back by adding the prompt to the engine.generate, resolving an issue of referencing logprobs when they are non-existent, and fixes the usage calculation. Closes #2706.

Here are the error logs of both use cases prior to this PR:

  1. echo=True, max_tokens=0
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  ...
  File "/vllm/entrypoints/openai/serving_completion.py", line 341, in create_completion
    response = request_output_to_completion_response(
  File "/vllm/entrypoints/openai/serving_completion.py", line 193, in request_output_to_completion_response
    choice_data = CompletionResponseChoice(
  File "/.env/lib/python3.10/site-packages/pydantic/main.py", line 171, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for CompletionResponseChoice
text
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
  1. echo=True, max_tokens>0, logprobs=None
File "/vllm/entrypoints/openai/serving_completion.py", line 177, in request_output_to_completion_response
    top_logprobs = prompt_logprobs + output.logprobs
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

@matheper matheper changed the title Support Echo without new tokens or ask for logprobs in OpenAI Entrypoint Support Echo without asking for new tokens or logprobs in OpenAI Entrypoint Feb 22, 2024
@matheper
Copy link
Author

matheper commented Feb 23, 2024

Hi @simon-mo , could you take a look at this PR when you have a chance? It fixes #2706. Any insights would be appreciated. Thanks!

@matheper matheper changed the title Support Echo without asking for new tokens or logprobs in OpenAI Entrypoint Fix: Echo without asking for new tokens or logprobs in OpenAI Entrypoint Feb 26, 2024
@DarkLight1337
Copy link
Member

DarkLight1337 commented Jun 2, 2024

Sorry for the long wait! From a quick search, it appears that since then, a related PR (#3441) has been merged, but it does not fully address the cases mentioned in this PR.

If you're still interested, update your code and I'll help get your changes merged.

@DarkLight1337 DarkLight1337 self-assigned this Jun 2, 2024
@DarkLight1337 DarkLight1337 changed the title Fix: Echo without asking for new tokens or logprobs in OpenAI Entrypoint Fix: Echo without asking for new tokens or logprobs in OpenAI Completions API Jun 2, 2024
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale Over 90 days of inactivity label Oct 30, 2024
@mergify mergify bot added the frontend label Oct 30, 2024
@mergify
Copy link

mergify bot commented Oct 30, 2024

This pull request has merge conflicts that must be resolved before it can be
merged. @matheper please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Oct 30, 2024
@github-actions github-actions bot added unstale Recieved activity after being labelled stale and removed stale Over 90 days of inactivity labels Nov 2, 2024
@hmellor hmellor closed this Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend needs-rebase unstale Recieved activity after being labelled stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The echo parameters and request logs seem to have some issues in vLLM v0.3.0 version (/v1/completions)

3 participants