From 7768d90de8975d519b992b281c666df862a3b741 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Tue, 8 Mar 2022 15:22:28 +0100 Subject: [PATCH 1/4] Use tiny model for TFRembertEncoderDecoderModelTest.get_pretrained_model() --- tests/encoder_decoder/test_modeling_tf_encoder_decoder.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py index adc923260da3..a48100846443 100644 --- a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py +++ b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py @@ -509,7 +509,6 @@ def test_pt_tf_equivalence(self): model = TFEncoderDecoderModel(encoder_decoder_config) model(**inputs_dict) - @slow def test_real_model_save_load_from_pretrained(self): model_2 = self.get_pretrained_model() input_ids = ids_tensor([13, 5], model_2.config.encoder.vocab_size) @@ -782,7 +781,10 @@ def prepare_config_and_inputs(self): @require_tf class TFRembertEncoderDecoderModelTest(TFEncoderDecoderMixin, unittest.TestCase): def get_pretrained_model(self): - return TFEncoderDecoderModel.from_encoder_decoder_pretrained("google/rembert", "google/rembert") + return TFEncoderDecoderModel.from_encoder_decoder_pretrained( + "hf-internal-testing/tiny-random-rembert", + "hf-internal-testing/tiny-random-rembert", + ) def get_encoder_decoder_model(self, config, decoder_config): encoder_model = TFRemBertModel(config, name="encoder") From 07c0a6814cbecf72a47a3a2b5e5a854830f9c105 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Tue, 8 Mar 2022 15:50:53 +0100 Subject: [PATCH 2/4] Use more tiny models --- .../test_modeling_tf_encoder_decoder.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py index a48100846443..19d9dd9a1f07 100644 --- a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py +++ b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py @@ -541,7 +541,10 @@ def test_real_model_save_load_from_pretrained(self): @require_tf class TFBertEncoderDecoderModelTest(TFEncoderDecoderMixin, unittest.TestCase): def get_pretrained_model(self): - return TFEncoderDecoderModel.from_encoder_decoder_pretrained("bert-base-uncased", "bert-base-uncased") + return TFEncoderDecoderModel.from_encoder_decoder_pretrained( + "hf-internal-testing/tiny-random-bert", + "hf-internal-testing/tiny-random-bert", + ) def get_encoder_decoder_model(self, config, decoder_config): encoder_model = TFBertModel(config, name="encoder") @@ -636,7 +639,10 @@ def test_bert2bert_summarization(self): @require_tf class TFGPT2EncoderDecoderModelTest(TFEncoderDecoderMixin, unittest.TestCase): def get_pretrained_model(self): - return TFEncoderDecoderModel.from_encoder_decoder_pretrained("bert-base-cased", "../gpt2") + return TFEncoderDecoderModel.from_encoder_decoder_pretrained( + "hf-internal-testing/tiny-random-bert", + "hf-internal-testing/tiny-random-gpt2", + ) def get_encoder_decoder_model(self, config, decoder_config): encoder_model = TFBertModel(config, name="encoder") @@ -725,7 +731,10 @@ def test_bert2gpt2_summarization(self): @require_tf class TFRoBertaEncoderDecoderModelTest(TFEncoderDecoderMixin, unittest.TestCase): def get_pretrained_model(self): - return TFEncoderDecoderModel.from_encoder_decoder_pretrained("roberta-base", "roberta-base") + return TFEncoderDecoderModel.from_encoder_decoder_pretrained( + "tiny-random-roberta", + "tiny-random-roberta", + ) def get_encoder_decoder_model(self, config, decoder_config): encoder_model = TFRobertaModel(config, name="encoder") From 42d4e6d20ff764ab6dc4d0c0a7c749dbcd88149d Mon Sep 17 00:00:00 2001 From: ydshieh Date: Tue, 8 Mar 2022 15:54:23 +0100 Subject: [PATCH 3/4] fix names --- tests/encoder_decoder/test_modeling_tf_encoder_decoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py index 19d9dd9a1f07..de15142b89ec 100644 --- a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py +++ b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py @@ -732,8 +732,8 @@ def test_bert2gpt2_summarization(self): class TFRoBertaEncoderDecoderModelTest(TFEncoderDecoderMixin, unittest.TestCase): def get_pretrained_model(self): return TFEncoderDecoderModel.from_encoder_decoder_pretrained( - "tiny-random-roberta", - "tiny-random-roberta", + "hf-internal-testing/tiny-random-roberta", + "hf-internal-testing/tiny-random-roberta", ) def get_encoder_decoder_model(self, config, decoder_config): From 9168a3b1254f899e17640b8a43a29ec2b63d4cfd Mon Sep 17 00:00:00 2001 From: ydshieh Date: Tue, 8 Mar 2022 16:04:33 +0100 Subject: [PATCH 4/4] rename --- tests/encoder_decoder/test_modeling_tf_encoder_decoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py index de15142b89ec..edcc881f564a 100644 --- a/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py +++ b/tests/encoder_decoder/test_modeling_tf_encoder_decoder.py @@ -509,7 +509,7 @@ def test_pt_tf_equivalence(self): model = TFEncoderDecoderModel(encoder_decoder_config) model(**inputs_dict) - def test_real_model_save_load_from_pretrained(self): + def test_model_save_load_from_pretrained(self): model_2 = self.get_pretrained_model() input_ids = ids_tensor([13, 5], model_2.config.encoder.vocab_size) decoder_input_ids = ids_tensor([13, 1], model_2.config.decoder.vocab_size)