From 21a2d900eceeded7be9edc445b56877b95eda4ca Mon Sep 17 00:00:00 2001 From: Katie Le <54815905+katiele47@users.noreply.github.com> Date: Fri, 10 Feb 2023 04:58:29 -0500 Subject: [PATCH] Added with torch.no_grad() to Camembert integration test (#21544) add with torch.no_grad() to Camembert integration test Co-authored-by: Bibi --- tests/models/camembert/test_modeling_camembert.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/models/camembert/test_modeling_camembert.py b/tests/models/camembert/test_modeling_camembert.py index 3a40f6a87..a15ab8caa 100644 --- a/tests/models/camembert/test_modeling_camembert.py +++ b/tests/models/camembert/test_modeling_camembert.py @@ -39,7 +39,8 @@ class CamembertModelIntegrationTest(unittest.TestCase): device=torch_device, dtype=torch.long, ) # J'aime le camembert ! - output = model(input_ids)["last_hidden_state"] + with torch.no_grad(): + output = model(input_ids)["last_hidden_state"] expected_shape = torch.Size((1, 10, 768)) self.assertEqual(output.shape, expected_shape) # compare the actual values for a slice.