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
norm
vllm
Commits
5a6c81b0
Unverified
Commit
5a6c81b0
authored
Feb 04, 2024
by
Rex
Committed by
GitHub
Feb 04, 2024
Browse files
Remove eos tokens from output by default (#2611)
parent
51cd22ce
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
vllm/engine/llm_engine.py
vllm/engine/llm_engine.py
+12
-4
No files found.
vllm/engine/llm_engine.py
View file @
5a6c81b0
...
@@ -908,13 +908,13 @@ class LLMEngine:
...
@@ -908,13 +908,13 @@ class LLMEngine:
"""Stop the finished sequences."""
"""Stop the finished sequences."""
for
stop_str
in
sampling_params
.
stop
:
for
stop_str
in
sampling_params
.
stop
:
if
seq
.
output_text
.
endswith
(
stop_str
):
if
seq
.
output_text
.
endswith
(
stop_str
):
if
not
sampling_params
.
include_stop_str_in_output
:
self
.
_finalize_sequence
(
seq
,
sampling_params
,
stop_str
)
# Truncate the output text so that the stop string is
# not included in the output.
seq
.
output_text
=
seq
.
output_text
[:
-
len
(
stop_str
)]
seq
.
status
=
SequenceStatus
.
FINISHED_STOPPED
seq
.
status
=
SequenceStatus
.
FINISHED_STOPPED
return
return
if
seq
.
get_last_token_id
()
in
sampling_params
.
stop_token_ids
:
if
seq
.
get_last_token_id
()
in
sampling_params
.
stop_token_ids
:
stop_str
=
self
.
get_tokenizer_for_seq
(
seq
).
convert_ids_to_tokens
(
seq
.
get_last_token_id
())
self
.
_finalize_sequence
(
seq
,
sampling_params
,
stop_str
)
seq
.
status
=
SequenceStatus
.
FINISHED_STOPPED
seq
.
status
=
SequenceStatus
.
FINISHED_STOPPED
return
return
...
@@ -934,6 +934,14 @@ class LLMEngine:
...
@@ -934,6 +934,14 @@ class LLMEngine:
seq
.
status
=
SequenceStatus
.
FINISHED_STOPPED
seq
.
status
=
SequenceStatus
.
FINISHED_STOPPED
return
return
def
_finalize_sequence
(
self
,
seq
:
Sequence
,
sampling_params
:
SamplingParams
,
stop_string
:
str
)
->
None
:
if
not
sampling_params
.
include_stop_str_in_output
and
stop_string
:
# Truncate the output text so that the stop string is
# not included in the output.
seq
.
output_text
=
seq
.
output_text
[:
-
len
(
stop_string
)]
def
add_lora
(
self
,
lora_request
:
LoRARequest
)
->
bool
:
def
add_lora
(
self
,
lora_request
:
LoRARequest
)
->
bool
:
assert
lora_request
.
lora_int_id
>
0
,
"lora_id must be greater than 0."
assert
lora_request
.
lora_int_id
>
0
,
"lora_id must be greater than 0."
return
self
.
_run_workers
(
return
self
.
_run_workers
(
...
...
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