"vscode:/vscode.git/clone" did not exist on "df04959e5542d41b269f96305d82c62287350cee"
Unverified Commit 2406dbdc authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

Less flaky `test_assisted_decoding_matches_greedy_search` (#23451)



* fix

* fix

---------
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent 21f7e81b
......@@ -1477,6 +1477,9 @@ class GenerationTesterMixin:
):
return
# This for loop is a naive and temporary effort to make the test less flaky.
failed = 0
for i in range(10):
# enable cache
config, input_ids, attention_mask, max_length = self._get_input_ids_and_config(batch_size=1)
......@@ -1513,6 +1516,14 @@ class GenerationTesterMixin:
return_dict_in_generate=True,
)
try:
self.assertListEqual(output_greedy.sequences.tolist(), output_assisted.sequences.tolist())
for output in (output_greedy, output_assisted):
self._check_outputs(output, input_ids, model.config, use_cache=True)
except AssertionError:
failed += 1
if failed > 1:
self.assertListEqual(output_greedy.sequences.tolist(), output_assisted.sequences.tolist())
for output in (output_greedy, output_assisted):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment