Skip to content

Commit

Permalink
remove version restrictions on whisper
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Aug 2, 2024
1 parent b3948b9 commit 2f69a8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 0 additions & 3 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,9 +1460,6 @@ class WhisperOnnxConfig(AudioToTextOnnxConfig):
feature_size="num_mel_bins",
allow_new=True,
)
# a custom generation mixin was introduced in 4.37.0 with batched long form generation
# https://github.com/huggingface/transformers/pull/27658
MIN_TRANSFORMERS_VERSION = version.parse("4.37.0")
ATOL_FOR_VALIDATION = 1e-3

@property
Expand Down
9 changes: 8 additions & 1 deletion optimum/onnxruntime/modeling_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from transformers.file_utils import add_end_docstrings, add_start_docstrings_to_model_forward
from transformers.modeling_outputs import BaseModelOutput, Seq2SeqLMOutput
from transformers.models.auto.modeling_auto import MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES
from transformers.models.whisper.generation_whisper import WhisperGenerationMixin

import onnxruntime as ort

Expand Down Expand Up @@ -67,6 +66,14 @@
)


if check_if_transformers_greater("4.37.0"):
from transformers.models.whisper.generation_whisper import WhisperGenerationMixin
else:

class WhisperGenerationMixin:
generate = WhisperForConditionalGeneration.generate


if check_if_transformers_greater("4.25.0"):
from transformers.generation import GenerationMixin
else:
Expand Down

0 comments on commit 2f69a8a

Please sign in to comment.