From 58fb3c9f98877bf76efb03e376a5c92cf80f7952 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:01:32 +0200 Subject: [PATCH] Fix Tapas tests (#17510) Co-authored-by: ydshieh --- tests/models/tapas/test_modeling_tapas.py | 12 +++++++++++- tests/models/tapas/test_tokenization_tapas.py | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/models/tapas/test_modeling_tapas.py b/tests/models/tapas/test_modeling_tapas.py index 31c9b38c8f..b7b4af6e5a 100644 --- a/tests/models/tapas/test_modeling_tapas.py +++ b/tests/models/tapas/test_modeling_tapas.py @@ -32,7 +32,13 @@ from transformers import ( is_torch_available, ) from transformers.models.auto import get_values -from transformers.testing_utils import require_scatter, require_torch, slow, torch_device +from transformers.testing_utils import ( + require_scatter, + require_tensorflow_probability, + require_torch, + slow, + torch_device, +) from transformers.utils import cached_property from ...test_configuration_common import ConfigTester @@ -499,6 +505,10 @@ class TapasModelTest(ModelTesterMixin, unittest.TestCase): config_and_inputs = self.model_tester.prepare_config_and_inputs() self.model_tester.create_and_check_for_sequence_classification(*config_and_inputs) + @require_tensorflow_probability + def test_pt_tf_model_equivalence(self): + super().test_pt_tf_model_equivalence() + def prepare_tapas_single_inputs_for_inference(): # Here we prepare a single table-question pair to test TAPAS inference on: diff --git a/tests/models/tapas/test_tokenization_tapas.py b/tests/models/tapas/test_tokenization_tapas.py index 8aed45a5b6..f712f324f9 100644 --- a/tests/models/tapas/test_tokenization_tapas.py +++ b/tests/models/tapas/test_tokenization_tapas.py @@ -36,6 +36,7 @@ from transformers.testing_utils import ( is_pt_tf_cross_test, require_pandas, require_scatter, + require_tensorflow_probability, require_tokenizers, require_torch, slow, @@ -141,6 +142,10 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase): output_text = "unwanted, running" return input_text, output_text + @require_tensorflow_probability + def test_tf_encode_plus_sent_to_model(self): + super().test_tf_encode_plus_sent_to_model() + def test_rust_and_python_full_tokenizers(self): if not self.test_rust_tokenizer: return