Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
929c7621
Unverified
Commit
929c7621
authored
Nov 19, 2024
by
Alexander Waitz
Committed by
GitHub
Nov 19, 2024
Browse files
Fix: incorrect top_logprobs in chat completion (#2088)
parent
b7a065ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
python/sglang/srt/openai_api/adapter.py
python/sglang/srt/openai_api/adapter.py
+6
-2
No files found.
python/sglang/srt/openai_api/adapter.py
View file @
929c7621
...
...
@@ -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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment