Unverified Commit f74b4020 authored by xinhe's avatar xinhe Committed by GitHub
Browse files

use __func__ to check can_generate (#22643)

parent 14fc1a24
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment