Expectation fixes and added AMD expectations (#38729)
This commit is contained in:
@@ -445,7 +445,11 @@ class MptIntegrationTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
input_text = "Hello"
|
||||
expected_output = "Hello, I'm a new user of the forum. I have a question about the \"Solaris"
|
||||
expected_outputs = Expectations({
|
||||
("cuda", None): "Hello, I'm a new user of the forum. I have a question about the \"Solaris",
|
||||
("rocm", (9, 5)): "Hello, I'm a newbie to the forum. I have a question about the \"B\" in",
|
||||
}) # fmt: off
|
||||
expected_output = expected_outputs.get_expectation()
|
||||
|
||||
inputs = tokenizer(input_text, return_tensors="pt").to(torch_device)
|
||||
outputs = model.generate(**inputs, max_new_tokens=20)
|
||||
@@ -463,19 +467,12 @@ class MptIntegrationTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
input_text = "Hello"
|
||||
expected_outputs = Expectations(
|
||||
{
|
||||
(
|
||||
"xpu",
|
||||
3,
|
||||
): "Hello and welcome to the first ever episode of the new and improved, and hopefully improved, podcast.\n",
|
||||
("cuda", 7): "Hello and welcome to the first episode of the new podcast, The Frugal Feminist.\n",
|
||||
(
|
||||
"cuda",
|
||||
8,
|
||||
): "Hello and welcome to the first day of the new release countdown for the month of May!\nToday",
|
||||
}
|
||||
)
|
||||
expected_outputs = Expectations({
|
||||
("rocm", (9, 5)): "Hello and welcome to the first day of the new release at The Stamp Man!\nToday we are",
|
||||
("xpu", 3): "Hello and welcome to the first ever episode of the new and improved, and hopefully improved, podcast.\n",
|
||||
("cuda", 7): "Hello and welcome to the first episode of the new podcast, The Frugal Feminist.\n",
|
||||
("cuda", 8): "Hello and welcome to the first day of the new release countdown for the month of May!\nToday",
|
||||
}) # fmt: off
|
||||
expected_output = expected_outputs.get_expectation()
|
||||
|
||||
inputs = tokenizer(input_text, return_tensors="pt").to(torch_device)
|
||||
@@ -510,6 +507,10 @@ class MptIntegrationTests(unittest.TestCase):
|
||||
"Hello my name is Tiffany and I am a mother of two beautiful children. I have been a nanny for the",
|
||||
"Today I am going at the gym and then I am going to go to the grocery store. I am going to buy some food and some",
|
||||
],
|
||||
("rocm", (9, 5)): [
|
||||
"Hello my name is Jasmine and I am a very sweet and loving dog. I am a very playful dog and I",
|
||||
"Today I am going at the gym and then I am going to go to the mall. I am going to buy a new pair of jeans",
|
||||
],
|
||||
}
|
||||
)
|
||||
expected_output = expected_outputs.get_expectation()
|
||||
@@ -535,9 +536,10 @@ class MptIntegrationTests(unittest.TestCase):
|
||||
{
|
||||
("xpu", 3): torch.Tensor([-0.2090, -0.2061, -0.1465]),
|
||||
("cuda", 7): torch.Tensor([-0.2520, -0.2178, -0.1953]),
|
||||
# TODO: This is quite a bit off, check BnB
|
||||
("rocm", (9, 5)): torch.Tensor([-0.3008, -0.1309, -0.1562]),
|
||||
}
|
||||
)
|
||||
expected_slice = expected_slices.get_expectation().to(torch_device, torch.bfloat16)
|
||||
predicted_slice = outputs.hidden_states[-1][0, 0, :3]
|
||||
|
||||
torch.testing.assert_close(expected_slice, predicted_slice, rtol=1e-3, atol=1e-3)
|
||||
|
||||
Reference in New Issue
Block a user