Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
dc76e9fa
Unverified
Commit
dc76e9fa
authored
Jun 27, 2024
by
Raushan Turganbay
Committed by
GitHub
Jun 27, 2024
Browse files
Generation: past kv can be None (#31051)
* fix * better
parent
1de7dc74
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/generation/utils.py
src/transformers/generation/utils.py
+1
-1
No files found.
src/transformers/generation/utils.py
View file @
dc76e9fa
...
@@ -1394,7 +1394,7 @@ class GenerationMixin:
...
@@ -1394,7 +1394,7 @@ class GenerationMixin:
return
model_kwargs
return
model_kwargs
past_length
=
0
past_length
=
0
if
"past_key_values"
i
n
model_kwargs
:
if
model_kwargs
.
get
(
"past_key_values"
)
i
s
not
None
:
if
isinstance
(
model_kwargs
[
"past_key_values"
],
Cache
):
if
isinstance
(
model_kwargs
[
"past_key_values"
],
Cache
):
past_length
=
model_kwargs
[
"past_key_values"
].
get_seq_length
()
past_length
=
model_kwargs
[
"past_key_values"
].
get_seq_length
()
else
:
else
:
...
...
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