Unverified Commit 929c7621 authored by Alexander Waitz's avatar Alexander Waitz Committed by GitHub
Browse files

Fix: incorrect top_logprobs in chat completion (#2088)

parent b7a065ea
......@@ -989,11 +989,15 @@ def v1_chat_generate_response(request, ret, to_file=False, cache_report=False):
output_top_logprobs=ret_item["meta_info"]["output_top_logprobs"],
)
token_logprobs = []
for token, logprob in zip(logprobs.tokens, logprobs.token_logprobs):
for token_idx, (token, logprob) in enumerate(
zip(logprobs.tokens, logprobs.token_logprobs)
):
token_bytes = list(token.encode("utf-8"))
top_logprobs = []
if logprobs.top_logprobs:
for top_token, top_logprob in logprobs.top_logprobs[0].items():
for top_token, top_logprob in logprobs.top_logprobs[
token_idx
].items():
top_token_bytes = list(top_token.encode("utf-8"))
top_logprobs.append(
TopLogprob(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment