From 0b0dd97737a25eb16231ccf8984bdc2e58248ed3 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Tue, 28 Jun 2022 08:53:53 +0200 Subject: [PATCH] Update expected values in constrained beam search tests (#17887) * fix Co-authored-by: ydshieh --- tests/generation/test_generation_utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/generation/test_generation_utils.py b/tests/generation/test_generation_utils.py index 3b1aa7643f..ce12d631bf 100644 --- a/tests/generation/test_generation_utils.py +++ b/tests/generation/test_generation_utils.py @@ -2510,8 +2510,8 @@ class GenerationIntegrationTests(unittest.TestCase): self.assertListEqual( generated_text, [ - "The soldiers were not prepared and didn't know how big the big weapons would be, so they scared them" - " off. They had no idea what to do", + "The soldiers were not prepared and didn't know what to do. They had no idea how they would react if" + " the enemy attacked them, big weapons scared" ], ) @@ -2549,8 +2549,9 @@ class GenerationIntegrationTests(unittest.TestCase): self.assertListEqual( generated_text, [ - "The soldiers, who were all scared and screaming at each other as they tried to get out of the", - "The child was taken to a local hospital where she screamed and scared for her life, police said.", + "The soldiers, who had been stationed at the base for more than a year before being evacuated" + " screaming scared", + "The child was taken to a local hospital where he died.\n 'I don't think screaming scared", ], ) @@ -2585,8 +2586,9 @@ class GenerationIntegrationTests(unittest.TestCase): self.assertListEqual( generated_text, [ - "The soldiers, who were all scared and screaming at each other as they tried to get out of the", - "The child was taken to a local hospital where she screamed and scared for her life, police said.", + "The soldiers, who had been stationed at the base for more than a year before being evacuated" + " screaming scared", + "The child was taken to a local hospital where he died.\n 'I don't think screaming scared", ], ) @@ -2612,7 +2614,7 @@ class GenerationIntegrationTests(unittest.TestCase): outputs = tokenizer.batch_decode(outputs, skip_special_tokens=True) - self.assertListEqual(outputs, ["Wie alter sind Sie?"]) + self.assertListEqual(outputs, ["Wie alt sind Sie?"]) @slow def test_constrained_beam_search_example_integration(self): @@ -2656,7 +2658,7 @@ class GenerationIntegrationTests(unittest.TestCase): ) outputs = tokenizer.batch_decode(outputs, skip_special_tokens=True) - self.assertListEqual(outputs, ["Wie alter sind Sie?"]) + self.assertListEqual(outputs, ["Wie alt sind Sie?"]) def test_constrained_beam_search_mixin_type_checks(self): tokenizer = AutoTokenizer.from_pretrained("patrickvonplaten/t5-tiny-random")