Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Whisper tests on GPU #23753

Merged
merged 3 commits into from
May 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/models/whisper/test_modeling_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ def test_generate_with_prompt_ids(self):
model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny")
model.to(torch_device)
input_speech = self._load_datasamples(4)[-1:]
input_features = processor(input_speech, return_tensors="pt").input_features
input_features = processor(input_speech, return_tensors="pt").input_features.to(torch_device)

output_without_prompt = model.generate(input_features)
prompt_ids = processor.get_prompt_ids("Leighton")
Expand All @@ -1494,7 +1494,7 @@ def test_generate_with_prompt_ids_and_forced_decoder_ids(self):
model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny")
model.to(torch_device)
input_speech = self._load_datasamples(1)
input_features = processor(input_speech, return_tensors="pt").input_features
input_features = processor(input_speech, return_tensors="pt").input_features.to(torch_device)
task = "translate"
language = "de"
expected_tokens = [f"<|{task}|>", f"<|{language}|>"]
Expand All @@ -1513,7 +1513,7 @@ def test_generate_with_prompt_ids_and_no_non_prompt_forced_decoder_ids(self):
model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny.en")
model.to(torch_device)
input_speech = self._load_datasamples(1)
input_features = processor(input_speech, return_tensors="pt").input_features
input_features = processor(input_speech, return_tensors="pt").input_features.to(torch_device)
prompt = "test prompt"
prompt_ids = processor.get_prompt_ids(prompt)

Expand Down