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
0a5b0516
"test/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "b6c9202687d6f4358e76b881650d41c9e49d5cb5"
Unverified
Commit
0a5b0516
authored
Mar 06, 2024
by
Ofir Zafrir
Committed by
GitHub
Mar 06, 2024
Browse files
Avoid dummy token in PLD to optimize performance (#29445)
parent
700d48fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/generation/candidate_generator.py
src/transformers/generation/candidate_generator.py
+2
-2
No files found.
src/transformers/generation/candidate_generator.py
View file @
0a5b0516
...
...
@@ -302,8 +302,8 @@ class PromptLookupCandidateGenerator(CandidateGenerator):
break
if
chosen_ids
is
None
or
len
(
chosen_ids
)
==
0
:
#
Need to make a dummy tensor to avoid errors
chosen_ids
=
torch
.
zeros
((
1
),
dtype
=
torch
.
long
,
device
=
input_ids
.
device
)
#
In case we didn't find a match return the input sequence unchanged, reverts back to autoregressive decoding
return
input_ids
,
None
# Now need extend input_ids with chosen_ids
chosen_ids
=
chosen_ids
.
unsqueeze
(
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