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
chenpangpang
transformers
Commits
17109ecf
Unverified
Commit
17109ecf
authored
Feb 09, 2023
by
Motoki Wu
Committed by
GitHub
Feb 09, 2023
Browse files
Fix missing unfinished_sequences (#21529)
fix missing unfinished_sequences
parent
2edf9a85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/transformers/generation/utils.py
src/transformers/generation/utils.py
+3
-3
No files found.
src/transformers/generation/utils.py
View file @
17109ecf
...
...
@@ -1982,7 +1982,7 @@ class GenerationMixin:
# if eos_token was found in one sentence, set sentence to finished
if
eos_token_id_tensor
is
not
None
:
unfinished_sequences
=
(
unfinished_sequences
=
unfinished_sequences
.
mul
(
next_tokens
.
tile
(
eos_token_id_tensor
.
shape
[
0
],
1
).
ne
(
eos_token_id_tensor
.
unsqueeze
(
1
)).
prod
(
dim
=
0
)
)
...
...
@@ -2228,7 +2228,7 @@ class GenerationMixin:
# if eos_token was found in one sentence, set sentence to finished
if
eos_token_id_tensor
is
not
None
:
unfinished_sequences
=
(
unfinished_sequences
=
unfinished_sequences
.
mul
(
next_tokens
.
tile
(
eos_token_id_tensor
.
shape
[
0
],
1
).
ne
(
eos_token_id_tensor
.
unsqueeze
(
1
)).
prod
(
dim
=
0
)
)
...
...
@@ -2497,7 +2497,7 @@ class GenerationMixin:
# if eos_token was found in one sentence, set sentence to finished
if
eos_token_id_tensor
is
not
None
:
unfinished_sequences
=
(
unfinished_sequences
=
unfinished_sequences
.
mul
(
next_tokens
.
tile
(
eos_token_id_tensor
.
shape
[
0
],
1
).
ne
(
eos_token_id_tensor
.
unsqueeze
(
1
)).
prod
(
dim
=
0
)
)
...
...
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