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
c7c79b16
"vscode:/vscode.git/clone" did not exist on "9062b2847d0ab412ed12b9bd5590779dda28d6b2"
Unverified
Commit
c7c79b16
authored
Feb 21, 2025
by
Shi Shuai
Committed by
GitHub
Feb 21, 2025
Browse files
[Fix] OpenAI API adapter tokenizer encoding (#3432)
parent
d8d75d25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
python/sglang/srt/openai_api/adapter.py
python/sglang/srt/openai_api/adapter.py
+7
-1
No files found.
python/sglang/srt/openai_api/adapter.py
View file @
c7c79b16
...
@@ -941,7 +941,13 @@ def v1_chat_generate_request(
...
@@ -941,7 +941,13 @@ def v1_chat_generate_request(
)
)
if
assistant_prefix
:
if
assistant_prefix
:
prompt_ids
+=
tokenizer_manager
.
tokenizer
.
encode
(
assistant_prefix
)
encoded
=
tokenizer_manager
.
tokenizer
.
encode
(
assistant_prefix
)
if
(
encoded
and
encoded
[
0
]
==
tokenizer_manager
.
tokenizer
.
bos_token_id
):
encoded
=
encoded
[
1
:]
prompt_ids
+=
encoded
stop
=
request
.
stop
stop
=
request
.
stop
image_data
=
None
image_data
=
None
modalities
=
[]
modalities
=
[]
...
...
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