fix: [whisper] don't overwrite GenerationConfig's return_timestamps when return_timestamps is not passed to generate function (#31296)

[whisper] don't overwrite return_timestamps when not passed to generate
This commit is contained in:
Ruilin Huang 2024-08-22 03:21:27 +08:00 committed by GitHub
parent 87134662f7
commit c6d484e38c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1170,6 +1170,9 @@ class WhisperGenerationMixin:
return return_dict_in_generate
def _set_return_timestamps(self, return_timestamps, is_shortform, generation_config):
if return_timestamps is None and hasattr(generation_config, "return_timestamps"):
return_timestamps = generation_config.return_timestamps
if not is_shortform:
if return_timestamps is False:
raise ValueError(