How to use logprobs hyperparameters? #1203
FocusLiwen
announced in
Q&A
Replies: 1 comment 1 reply
-
Hi there. By adding the 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"
# List models API
models = openai.Model.list()
print("Models:", models)
model = models["data"][0]["id"]
# Completion API
stream = False
completion = openai.Completion.create(
model=model,
prompt="A robot may not injure a human being",
echo=False,
stream=stream,
logprobs=5)
print("Completion results:")
if stream:
for c in completion:
print(c)
else:
print(completion) The response should look like something like this
For each token, you can see the top K (5 in this example) most probable tokens and their log probabilities. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
logprobs is one of the sampling parameters. How should we use it exactly?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions