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
OpenDAS
text-generation-inference
Commits
9b78a6ee
Commit
9b78a6ee
authored
Dec 14, 2023
by
OlivierDehaene
Browse files
fix: only keep stop sequence buffer if we have some
parent
80a69204
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
server/text_generation_server/utils/tokens.py
server/text_generation_server/utils/tokens.py
+10
-9
No files found.
server/text_generation_server/utils/tokens.py
View file @
9b78a6ee
...
...
@@ -112,7 +112,7 @@ class StoppingCriteria:
self
.
stop_sequence_criterias
=
stop_sequence_criterias
self
.
max_new_tokens
=
max_new_tokens
self
.
current_tokens
=
0
self
.
current_output
=
"
test
"
self
.
current_output
=
""
self
.
ignore_eos_token
=
ignore_eos_token
def
__call__
(
self
,
last_token
:
int
,
last_output
:
str
)
->
Tuple
[
bool
,
Optional
[
str
]]:
...
...
@@ -123,6 +123,7 @@ class StoppingCriteria:
if
not
self
.
ignore_eos_token
and
last_token
==
self
.
eos_token_id
:
return
True
,
FinishReason
.
FINISH_REASON_EOS_TOKEN
if
self
.
stop_sequence_criterias
:
self
.
current_output
+=
last_output
# There is no need to keep an output that is too long
if
len
(
self
.
current_output
)
>
300
:
...
...
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