Skip to content

Commit

Permalink
fix whisper test
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Oct 31, 2024
1 parent 30d69a5 commit 8303aa6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/onnxruntime/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4602,14 +4602,14 @@ def test_compare_with_and_without_past_key_values(self, model_arch: str):
)

self.assertTrue(torch.equal(outputs_model_with_pkv, outputs_model_without_pkv))
self.assertEqual(
outputs_model_with_pkv.shape[1],
self.GENERATION_LENGTH + 2 if model_arch == "whisper" else self.GENERATION_LENGTH + 1,
)
self.assertEqual(
outputs_model_without_pkv.shape[1],
self.GENERATION_LENGTH + 2 if model_arch == "whisper" else self.GENERATION_LENGTH + 1,
)

if model_arch == "whisper" and check_if_transformers_greater("4.43"):
gen_length = self.GENERATION_LENGTH + 2
else:
gen_length = self.GENERATION_LENGTH + 1

self.assertEqual(outputs_model_with_pkv.shape[1], gen_length)
self.assertEqual(outputs_model_without_pkv.shape[1], gen_length)

self.GENERATION_LENGTH = generation_length
if os.environ.get("TEST_LEVEL", 0) == "1":
Expand Down

0 comments on commit 8303aa6

Please sign in to comment.