[EncoderDecoder Tests] Improve tests (#4046)

* Hoist bert model tester for patric

* indent

* make tests work

* Update tests/test_modeling_bert.py

Co-authored-by: Julien Chaumond <chaumond@gmail.com>

Co-authored-by: sshleifer <sshleifer@gmail.com>
Co-authored-by: Julien Chaumond <chaumond@gmail.com>
This commit is contained in:
Patrick von Platen
2020-05-04 02:18:36 +02:00
committed by GitHub
parent 6af3306a1d
commit 8e67573a64
2 changed files with 365 additions and 371 deletions

View File

@@ -21,7 +21,7 @@ from transformers import is_torch_available
# TODO(PVP): this line reruns all the tests in BertModelTest; not sure whether this can be prevented
# for now only run module with pytest tests/test_modeling_encoder_decoder.py::EncoderDecoderModelTest
from .test_modeling_bert import BertModelTest
from .test_modeling_bert import BertModelTester
from .utils import require_torch, slow, torch_device
@@ -34,7 +34,7 @@ if is_torch_available():
@require_torch
class EncoderDecoderModelTest(unittest.TestCase):
def prepare_config_and_inputs_bert(self):
bert_model_tester = BertModelTest.BertModelTester(self)
bert_model_tester = BertModelTester(self)
encoder_config_and_inputs = bert_model_tester.prepare_config_and_inputs()
decoder_config_and_inputs = bert_model_tester.prepare_config_and_inputs_for_decoder()
(