cleanup torch unittests (#6196)

* improve unit tests

this is a sample of one test according to the request in https://github.com/huggingface/transformers/issues/5973
before I apply it to the rest

* batch 1

* batch 2

* batch 3

* batch 4

* batch 5

* style

* non-tf template

* last deletion of check_loss_output
This commit is contained in:
Stas Bekman
2020-08-03 23:42:56 -07:00
committed by GitHub
parent b390a5672a
commit 5deed37f9f
18 changed files with 157 additions and 339 deletions

View File

@@ -253,9 +253,6 @@ class EncoderDecoderModelTest(unittest.TestCase):
max_diff = np.amax(np.abs(out_1 - out_2))
self.assertLessEqual(max_diff, 1e-5)
def check_loss_output(self, loss):
self.assertEqual(loss.size(), ())
def create_and_check_bert_encoder_decoder_model_labels(
self,
config,
@@ -281,7 +278,6 @@ class EncoderDecoderModelTest(unittest.TestCase):
)
mlm_loss = outputs_encoder_decoder[0]
self.check_loss_output(mlm_loss)
# check that backprop works
mlm_loss.backward()