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

Logprobs support #61

Merged
merged 6 commits into from
Feb 9, 2024
Merged

Logprobs support #61

merged 6 commits into from
Feb 9, 2024

Conversation

bdashore3
Copy link
Member

Adds logprobs support to upstream tabby for completions and chat completions

Split the get tokens function into separate wrapper encode and decode
functions for overall code cleanliness.

Signed-off-by: kingbri <[email protected]>
Some logprobs cannot exist, so make the type optional

Signed-off-by: kingbri <[email protected]>
Returns token offsets, selected tokens, probabilities of tokens
post-sampling, and normalized probability of selecting a token
pre-sampling (for efficiency purposes).

Only for text completions. Chat completions in a later commit.

Signed-off-by: kingbri <[email protected]>
Change chat completion and text completion responses to be more
flexible.

Signed-off-by: kingbri <[email protected]>
Adds chat completion logprob support using OAI's spec. Tokens are
not converted to tiktoken here since that will add an extra dependency
for no real reason.

Signed-off-by: kingbri <[email protected]>
Take a log of the token probs since they're already normalized which
reflects the proper value. Also, don't error out if a token prob
doesn't exist in the dict and return None instead from zip.

Signed-off-by: kingbri <[email protected]>
@bdashore3 bdashore3 merged commit 43bba52 into main Feb 9, 2024
1 check passed
@bdashore3 bdashore3 deleted the logprobs branch February 10, 2024 20:00
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

Successfully merging this pull request may close these issues.

1 participant