[bark] fix loading of generation config (#36587)

This commit is contained in:
Joao Gante 2025-03-06 16:55:19 +00:00 committed by GitHub
parent 0440dbc0e1
commit c1b24c0b73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1573,6 +1573,14 @@ class BarkModel(BarkPreTrainedModel):
self.config = config
@classmethod
def can_generate(cls) -> bool:
# Bark has a unique model structure, where the external class (`BarkModel`) doesn't need to inherit from
# `GenerationMixin` (it has a non-standard generation method), but one of the internal models do
# (`BarkSemanticModel`). This means that the base `can_generate()` will return `False`, but we need to
# override it so as to do `GenerationConfig` handling in multiple parts of the codebase.
return True
@property
def device(self) -> torch.device:
"""