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

Update expected values in constrained beam search tests #17887

Merged
merged 3 commits into from
Jun 28, 2022
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
18 changes: 10 additions & 8 deletions tests/generation/test_generation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2510,8 +2510,8 @@ def test_constrained_beam_search(self):
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"
],
)

Expand Down Expand Up @@ -2549,8 +2549,9 @@ def test_constrained_beam_search_mixed(self):
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",
],
)

Expand Down Expand Up @@ -2585,8 +2586,9 @@ def test_constrained_beam_search_mixed_mixin(self):
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",
],
)

Expand All @@ -2612,7 +2614,7 @@ def test_constrained_beam_search_example_translation_mixin(self):

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):
Expand Down Expand Up @@ -2656,7 +2658,7 @@ def test_constrained_beam_search_example_integration(self):
)
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")
Expand Down