From 546cbe7e9e741f68e87e3b356d99f1fa3368ca74 Mon Sep 17 00:00:00 2001 From: Lysandre Debut Date: Mon, 8 Mar 2021 21:44:07 -0500 Subject: [PATCH] Speedup tf tests (#10601) * Pipeline tests should be slow * Temporarily mark some tests as slow * Temporarily mark Barthez tests as slow --- tests/test_modeling_tf_common.py | 6 ++++++ tests/test_tokenization_barthez.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_modeling_tf_common.py b/tests/test_modeling_tf_common.py index 0405192a6a..6f66350a9c 100644 --- a/tests/test_modeling_tf_common.py +++ b/tests/test_modeling_tf_common.py @@ -129,6 +129,7 @@ class TFModelTesterMixin: self.assert_outputs_same(after_outputs, outputs) + @slow def test_graph_mode(self): config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() for model_class in self.all_model_classes: @@ -142,6 +143,7 @@ class TFModelTesterMixin: outputs = run_in_graph_mode() self.assertIsNotNone(outputs) + @slow def test_xla_mode(self): config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() for model_class in self.all_model_classes: @@ -182,6 +184,7 @@ class TFModelTesterMixin: expected_arg_names = ["input_ids"] self.assertListEqual(arg_names[:1], expected_arg_names) + @slow def test_saved_model_creation(self): config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() config.output_hidden_states = False @@ -311,6 +314,7 @@ class TFModelTesterMixin: onnxruntime.InferenceSession(onnx_model.SerializeToString()) + @slow def test_mixed_precision(self): tf.keras.mixed_precision.experimental.set_policy("mixed_float16") @@ -484,6 +488,7 @@ class TFModelTesterMixin: max_diff = np.amax(np.abs(tfo - pto)) self.assertLessEqual(max_diff, 4e-2) + @slow def test_train_pipeline_custom_model(self): config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() # head_mask and decoder_head_mask has different shapes than other input args @@ -904,6 +909,7 @@ class TFModelTesterMixin: model(inputs) + @slow def test_graph_mode_with_inputs_embeds(self): config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() diff --git a/tests/test_tokenization_barthez.py b/tests/test_tokenization_barthez.py index 8ff33ac2ad..1c3a3d18ef 100644 --- a/tests/test_tokenization_barthez.py +++ b/tests/test_tokenization_barthez.py @@ -17,13 +17,14 @@ import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding -from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch +from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from .test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece +@slow class BarthezTokenizationTest(TokenizerTesterMixin, unittest.TestCase): tokenizer_class = BarthezTokenizer