support echo=true and logprobs in openai api when logprobs=1 in lm-evaluation-harness (#1998)

This commit is contained in:
Xiaoyu Zhang
2024-11-12 15:21:20 +08:00
committed by GitHub
parent b808a38365
commit 027e65248f
2 changed files with 8 additions and 2 deletions

View File

@@ -85,7 +85,9 @@ class TestOpenAIServer(unittest.TestCase):
# assert ret_num_top_logprobs == logprobs, f"{ret_num_top_logprobs} vs {logprobs}"
assert ret_num_top_logprobs > 0
assert response.choices[0].logprobs.token_logprobs[0]
# when echo=True and request.logprobs>0, logprob_start_len is 0, so the first token's logprob would be None.
if not echo:
assert response.choices[0].logprobs.token_logprobs[0]
assert response.id
assert response.created