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
5c18a037
"tests/vscode:/vscode.git/clone" did not exist on "f36a451420254de7dd49193dde7455b83859c9e5"
Unverified
Commit
5c18a037
authored
Dec 01, 2024
by
Lianmin Zheng
Committed by
GitHub
Dec 01, 2024
Browse files
Fix logprob for completions (#2301)
parent
5c91a315
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
.github/workflows/pr-test.yml
.github/workflows/pr-test.yml
+1
-1
python/sglang/srt/openai_api/adapter.py
python/sglang/srt/openai_api/adapter.py
+5
-5
No files found.
.github/workflows/pr-test.yml
View file @
5c18a037
...
...
@@ -51,7 +51,7 @@ jobs:
runs-on
:
1-gpu-runner
strategy
:
matrix
:
range
:
[
0-6
,
6-1
6
,
1
6
-2
4
,
2
4
-30
,
30-100
]
range
:
[
0-6
,
6-1
5
,
1
5
-2
3
,
2
3
-30
,
30-100
]
steps
:
-
name
:
Checkout code
uses
:
actions/checkout@v3
...
...
python/sglang/srt/openai_api/adapter.py
View file @
5c18a037
...
...
@@ -521,7 +521,7 @@ def v1_generate_request(
"skip_special_tokens"
:
request
.
skip_special_tokens
,
}
)
return_logprobs
.
append
(
request
.
logprobs
is
not
None
and
request
.
logprobs
>
0
)
return_logprobs
.
append
(
request
.
logprobs
is
not
None
)
logprob_start_lens
.
append
(
current_logprob_start_len
)
top_logprobs_nums
.
append
(
request
.
logprobs
if
request
.
logprobs
is
not
None
else
0
...
...
@@ -595,9 +595,9 @@ def v1_generate_response(request, ret, tokenizer_manager, to_file=False):
text
=
prompts
[
prompt_index
]
+
text
logprobs
=
False
if
isinstance
(
request
,
list
)
and
request
[
idx
].
logprobs
:
if
isinstance
(
request
,
list
)
and
request
[
idx
].
logprobs
is
not
None
:
logprobs
=
True
elif
(
not
isinstance
(
request
,
list
))
and
request
.
logprobs
:
elif
(
not
isinstance
(
request
,
list
))
and
request
.
logprobs
is
not
None
:
logprobs
=
True
if
logprobs
:
if
echo
:
...
...
@@ -739,7 +739,7 @@ async def v1_completions(tokenizer_manager, raw_request: Request):
# Prepend prompt in response text.
text
=
prompts
+
text
if
request
.
logprobs
:
if
request
.
logprobs
is
not
None
:
# The first chunk and echo is enabled.
if
not
stream_buffer
and
request
.
echo
:
input_token_logprobs
=
content
[
"meta_info"
][
...
...
@@ -1279,7 +1279,7 @@ def v1_embedding_request(all_requests, tokenizer_manager):
for
request
in
all_requests
:
prompt
=
request
.
input
assert
(
type
(
prompt
)
==
first_prompt_type
type
(
prompt
)
is
first_prompt_type
),
"All prompts must be of the same type in file input settings"
prompts
.
append
(
prompt
)
...
...
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