Skip to content

Commit

Permalink
Revert "Fix Whisper CI" (#34605)
Browse files Browse the repository at this point in the history
Revert "Fix Whisper CI (#34541)"

This reverts commit eb81144.
  • Loading branch information
ydshieh authored Nov 5, 2024
1 parent 45b0c76 commit 74d3824
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/transformers/generation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,11 +1452,10 @@ def _prepare_generated_length(
):
generation_config.max_length -= inputs_tensor.shape[1]
elif has_default_max_length: # by default let's always generate 20 new tokens
if generation_config.max_length == GenerationConfig().max_length:
generation_config.max_length = generation_config.max_length + input_ids_length
max_position_embeddings = getattr(self.config, "max_position_embeddings", None)
if max_position_embeddings is not None:
generation_config.max_length = min(generation_config.max_length, max_position_embeddings)
generation_config.max_length = generation_config.max_length + input_ids_length
max_position_embeddings = getattr(self.config, "max_position_embeddings", None)
if max_position_embeddings is not None:
generation_config.max_length = min(generation_config.max_length, max_position_embeddings)

# same for min length
if generation_config.min_new_tokens is not None:
Expand Down

0 comments on commit 74d3824

Please sign in to comment.