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

Serverless inference API endpoints fails to return logprobs via chat completions #1852

Closed
2 of 4 tasks
ggbetz opened this issue May 2, 2024 · 1 comment
Closed
2 of 4 tasks
Labels

Comments

@ggbetz
Copy link

ggbetz commented May 2, 2024

System Info

serverless inference endpoints

Information

  • Docker
  • The CLI directly

Tasks

  • An officially supported command
  • My own modifications

Reproduction

Querying mistral with the following snippet via Messages API ...

from openai import OpenAI

API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2/v1/"
#API_URL = "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/"

client = OpenAI(
    base_url=API_URL,
    api_key=userdata.get('HF_TOKEN')
)

chat_completion = client.chat.completions.create(
    model="tgi",
    messages=[
        {"role": "user", "content": "What is deep learning?"}
    ],
    logprobs=True,
    top_logprobs=5,
    max_tokens=1,
)

print(chat_completion.choices[0].logprobs)

yields:

>>> ChoiceLogprobs(content=[ChatCompletionTokenLogprob(token=' Deep', bytes=None, logprob=-0.00023388863, top_logprobs=[TopLogprob(token='Deep', bytes=None, logprob=-0.00023388863), TopLogprob(token='Deep', bytes=None, logprob=-8.375), TopLogprob(token='deep', bytes=None, logprob=-12.671875), TopLogprob(token='deep', bytes=None, logprob=-15.421875), TopLogprob(token='deeply', bytes=None, logprob=-19.265625)])])

... which is fine. However, changing to zephyr endpoint (uncomment line in snippet) yields:

>>> ChoiceLogprobs(content=[])

Expected behavior

Both serverless inference endpoints should return logprobs.

Copy link

github-actions bot commented Jun 2, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 2, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant