[generate] clarify docstrings: when to inherit GenerationMixin (#36605)

This commit is contained in:
Joao Gante
2025-03-20 10:58:54 +00:00
committed by GitHub
parent 8e97b44087
commit b47d9b2f8a
2 changed files with 19 additions and 1 deletions

View File

@@ -2178,6 +2178,9 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
"""
Returns whether this model can generate sequences with `.generate()` from the `GenerationMixin`.
Under the hood, on classes where this function returns True, some generation-specific changes are triggered:
for instance, the model instance will have a populated `generation_config` attribute.
Returns:
`bool`: Whether this model can generate sequences with `.generate()`.
"""