Add missing atol to torch.testing.assert_close where rtol is specified (#36234)

This commit is contained in:
ivarflakstad 2025-02-17 14:57:50 +01:00 committed by GitHub
parent dad513e0c2
commit 7ec35bc3bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -546,4 +546,4 @@ class InformerModelIntegrationTests(unittest.TestCase):
expected_slice = torch.tensor([3400.8005, 4289.2637, 7101.9209], device=torch_device)
mean_prediction = outputs.sequences.mean(dim=1)
torch.testing.assert_close(mean_prediction[0, -3:], expected_slice, rtol=1e-1)
torch.testing.assert_close(mean_prediction[0, -3:], expected_slice, rtol=1e-1, atol=1e-1)

View File

@ -385,4 +385,4 @@ class PatchTSTModelIntegrationTests(unittest.TestCase):
device=torch_device,
)
mean_prediction = outputs.sequences.mean(dim=1)
torch.testing.assert_close(mean_prediction[-5:], expected_slice, rtol=TOLERANCE)
torch.testing.assert_close(mean_prediction[-5:], expected_slice, rtol=TOLERANCE, atol=TOLERANCE)

View File

@ -554,4 +554,4 @@ class TimeSeriesTransformerModelIntegrationTests(unittest.TestCase):
expected_slice = torch.tensor([2825.2749, 3584.9207, 6763.9951], device=torch_device)
mean_prediction = outputs.sequences.mean(dim=1)
torch.testing.assert_close(mean_prediction[0, -3:], expected_slice, rtol=1e-1)
torch.testing.assert_close(mean_prediction[0, -3:], expected_slice, rtol=1e-1, atol=1e-1)

View File

@ -549,7 +549,7 @@ class WavLMModelIntegrationTest(unittest.TestCase):
[[[0.2122, 0.0500], [0.2118, 0.0563]], [[0.1353, 0.1818], [0.2453, 0.0595]]]
)
torch.testing.assert_close(hidden_states_slice, EXPECTED_HIDDEN_STATES_SLICE, rtol=5e-2)
torch.testing.assert_close(hidden_states_slice, EXPECTED_HIDDEN_STATES_SLICE, rtol=5e-2, atol=5e-2)
def test_inference_diarization(self):
model = WavLMForAudioFrameClassification.from_pretrained("microsoft/wavlm-base-plus-sd").to(torch_device)