mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-03 12:50:06 +06:00
Add AMD expectation to test_gpt2_sample (#38079)
This commit is contained in:
parent
4220039b29
commit
7eaa90b87b
@ -20,6 +20,7 @@ import pytest
|
||||
|
||||
from transformers import GPT2Config, is_torch_available
|
||||
from transformers.testing_utils import (
|
||||
Expectations,
|
||||
cleanup,
|
||||
require_flash_attn,
|
||||
require_torch,
|
||||
@ -817,10 +818,14 @@ class GPT2ModelLanguageGenerationTest(unittest.TestCase):
|
||||
output_seq_strs = tokenizer.batch_decode(output_seq, skip_special_tokens=True)
|
||||
output_seq_tt_strs = tokenizer.batch_decode(output_seq_tt, skip_special_tokens=True)
|
||||
|
||||
EXPECTED_OUTPUT_STR = (
|
||||
"Today is a nice day and if you don't know anything about the state of play during your holiday"
|
||||
)
|
||||
self.assertEqual(output_str, EXPECTED_OUTPUT_STR)
|
||||
expected_outputs = Expectations(
|
||||
{
|
||||
("rocm", None): 'Today is a nice day and we can do this again."\n\nDana said that she will',
|
||||
("cuda", None): "Today is a nice day and if you don't know anything about the state of play during your holiday",
|
||||
}
|
||||
) # fmt: skip
|
||||
EXPECTED_OUTPUT = expected_outputs.get_expectation()
|
||||
self.assertEqual(output_str, EXPECTED_OUTPUT)
|
||||
self.assertTrue(
|
||||
all(output_seq_strs[idx] != output_seq_tt_strs[idx] for idx in range(len(output_seq_tt_strs)))
|
||||
) # token_type_ids should change output
|
||||
|
Loading…
Reference in New Issue
Block a user