mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
fix Whisper tests on GPU (#23753)
* move input features to GPU * skip these tests because undefined behavior * unskip tests
This commit is contained in:
parent
ac224dee90
commit
2faa09530b
@ -1477,7 +1477,7 @@ class WhisperModelIntegrationTests(unittest.TestCase):
|
||||
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")
|
||||
@ -1494,7 +1494,7 @@ class WhisperModelIntegrationTests(unittest.TestCase):
|
||||
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}|>"]
|
||||
@ -1513,7 +1513,7 @@ class WhisperModelIntegrationTests(unittest.TestCase):
|
||||
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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user