It appears the method assumes response.logprobs.token_logprobs is both a list of log probabilities (it sets the continuation_logprobs variable to the sum of its values) and a token since it sets values in the list to a variable named token.
Per the OpenAI type hints, it should be a list of floats and the corresponding token can be determined by extracting it from response.logprobs.tokens (a list of strings) at the same index as each item in response.logprobs.token_logprobs.
The get_results method in the lm_eval/models/openai_completions.py is not properly using the OpenAI Completion API.
Below is the API definition for LogProbs (from openai):
However, get_results in that module is defined this way:
It appears the method assumes response.logprobs.token_logprobs is both a list of log probabilities (it sets the continuation_logprobs variable to the sum of its values) and a token since it sets values in the list to a variable named token.
Per the OpenAI type hints, it should be a list of floats and the corresponding token can be determined by extracting it from response.logprobs.tokens (a list of strings) at the same index as each item in response.logprobs.token_logprobs.