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
zhaoyu6
sglang
Commits
4cb9aaed
"git@developer.sourcefind.cn:hehl2/torchaudio.git" did not exist on "420e84ee0d689b788b25e6e95168da50c70ec90a"
Unverified
Commit
4cb9aaed
authored
Feb 22, 2024
by
Cody Yu
Committed by
GitHub
Feb 22, 2024
Browse files
Fix logprobs with logprob_start_len (#193)
parent
9de9a468
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
python/sglang/srt/managers/router/model_rpc.py
python/sglang/srt/managers/router/model_rpc.py
+7
-2
No files found.
python/sglang/srt/managers/router/model_rpc.py
View file @
4cb9aaed
...
@@ -432,9 +432,14 @@ class ModelRpcServer(rpyc.Service):
...
@@ -432,9 +432,14 @@ class ModelRpcServer(rpyc.Service):
req
.
logprob
=
logprobs
[
pt
:
pt
+
req
.
extend_input_len
-
1
]
req
.
logprob
=
logprobs
[
pt
:
pt
+
req
.
extend_input_len
-
1
]
req
.
normalized_logprob
=
normalized_logprobs
[
i
]
req
.
normalized_logprob
=
normalized_logprobs
[
i
]
token_ids
=
req
.
input_ids
+
[
next_token_ids
[
i
]]
# If logprob_start_len > 0, then first logprob_start_len prompt tokens
token_logprobs
=
[
None
]
+
req
.
logprob
+
[
last_logprobs
[
i
]]
# will be ignored.
prompt_token_len
=
len
(
req
.
logprob
)
token_ids
=
req
.
input_ids
[
-
prompt_token_len
:]
+
[
next_token_ids
[
i
]]
token_logprobs
=
req
.
logprob
+
[
last_logprobs
[
i
]]
req
.
token_logprob
=
list
(
zip
(
token_ids
,
token_logprobs
))
req
.
token_logprob
=
list
(
zip
(
token_ids
,
token_logprobs
))
if
req
.
logprob_start_len
==
0
:
req
.
token_logprob
=
[(
req
.
input_ids
[
0
],
None
)]
+
req
.
token_logprob
pt
+=
req
.
extend_input_len
pt
+=
req
.
extend_input_len
self
.
handle_finished_requests
(
batch
)
self
.
handle_finished_requests
(
batch
)
...
...
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