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

Commits on Feb 8, 2024

  1. API: Clean up tokenizing endpoint

    Split the get tokens function into separate wrapper encode and decode
    functions for overall code cleanliness.
    
    Signed-off-by: kingbri <[email protected]>
    bdashore3 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    ea382b9 View commit details
    Browse the repository at this point in the history
  2. OAI: Update logprobs type

    Some logprobs cannot exist, so make the type optional
    
    Signed-off-by: kingbri <[email protected]>
    bdashore3 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    f86df66 View commit details
    Browse the repository at this point in the history
  3. Model: Add logprobs support

    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]>
    bdashore3 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    adc8fa9 View commit details
    Browse the repository at this point in the history
  4. API: Fix response creation

    Change chat completion and text completion responses to be more
    flexible.
    
    Signed-off-by: kingbri <[email protected]>
    bdashore3 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    13db892 View commit details
    Browse the repository at this point in the history
  5. API: Add logprobs for chat completions

    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]>
    bdashore3 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    dcc7372 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2024

  1. Model: Fix logprobs unwrapping

    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 committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    b01f6cb View commit details
    Browse the repository at this point in the history