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

Support logprobs for ChatCompletionRequest in openai api server? #2276

Closed
beginlner opened this issue Dec 27, 2023 · 2 comments
Closed

Support logprobs for ChatCompletionRequest in openai api server? #2276

beginlner opened this issue Dec 27, 2023 · 2 comments

Comments

@beginlner
Copy link
Contributor

No description provided.

@jlcmoore
Copy link
Contributor

jlcmoore commented Feb 8, 2024

This would be great to have, if possible.

E.g. python -m vllm.entrypoints.openai.api_server --model meta-llama/Llama-2-7b-hf and

from openai import OpenAI

# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
client = OpenAI(
    api_key=openai_api_key,
    base_url=openai_api_base,
)
completion = client.completions.create(model="meta-llama/Llama-2-7b-hf",
                                      prompt="Hello!",
                                      logprobs=5)
print("Completion result:", completion)

works but python -m vllm.entrypoints.openai.api_server --model meta-llama/Llama-2-7b-chat-hf

from openai import OpenAI

# Modify OpenAI's API key and API base to use vLLM's API server.
openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"
client = OpenAI(
    api_key=openai_api_key,
    base_url=openai_api_base,
)
completion = client.completions.create(model="meta-llama/Llama-2-7b-chat-hf",
                                      messages= [{'role' : 'user', 'content': "Hello!"}],
                                      logprobs=5)
print("Completion result:", completion)

does not.

For some reason log probs are currently only set up for completions end points, not chat end points. I think the fix would simply entail changing serving_chat.py link to incorporate log probs like serving_completion.py does link.

Thanks!

@simon-mo
Copy link
Collaborator

Closed by #2918

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

No branches or pull requests

3 participants