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
f74b4020
Unverified
Commit
f74b4020
authored
Apr 10, 2023
by
xinhe
Committed by
GitHub
Apr 10, 2023
Browse files
use __func__ to check can_generate (#22643)
parent
14fc1a24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+1
-1
No files found.
src/transformers/modeling_utils.py
View file @
f74b4020
...
...
@@ -1185,7 +1185,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
`bool`: Whether this model can generate sequences with `.generate()`.
"""
# Detects whether `prepare_inputs_for_generation` has been overwritten, which is a requirement for generation
if
"GenerationMixin"
in
str
(
self
.
prepare_inputs_for_generation
):
if
"GenerationMixin"
in
str
(
self
.
prepare_inputs_for_generation
.
__func__
):
return
False
return
True
...
...
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