Added with torch.no_grad() to XLM-Roberta integration test (#21547)
* added with torch.no_grad() to the integration tests and applied make style * added with torch.no_grad() to xlm roberta forward pass --------- Co-authored-by: Bibi <Bibi@katies-mac.local>
This commit is contained in:
@@ -43,7 +43,7 @@ class XLMRobertaModelIntegrationTest(unittest.TestCase):
|
||||
# xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.base')
|
||||
# xlmr.eval()
|
||||
# expected_output_values_last_dim = xlmr.extract_features(input_ids[0])[:, :, -1]
|
||||
|
||||
with torch.no_grad():
|
||||
output = model(input_ids)["last_hidden_state"].detach()
|
||||
self.assertEqual(output.shape, expected_output_shape)
|
||||
# compare the actual values for a slice of last dim
|
||||
@@ -62,7 +62,7 @@ class XLMRobertaModelIntegrationTest(unittest.TestCase):
|
||||
# xlmr = torch.hub.load('pytorch/fairseq', 'xlmr.large')
|
||||
# xlmr.eval()
|
||||
# expected_output_values_last_dim = xlmr.extract_features(input_ids[0])[:, :, -1]
|
||||
|
||||
with torch.no_grad():
|
||||
output = model(input_ids)["last_hidden_state"].detach()
|
||||
self.assertEqual(output.shape, expected_output_shape)
|
||||
# compare the actual values for a slice of last dim
|
||||
|
||||
Reference in New Issue
Block a user