[tests] remove pt_tf equivalence tests (#36253)
This commit is contained in:
@@ -32,7 +32,7 @@ from transformers import (
|
||||
is_torch_available,
|
||||
)
|
||||
from transformers.models.auto import get_values
|
||||
from transformers.testing_utils import require_tensorflow_probability, require_torch, slow, torch_device
|
||||
from transformers.testing_utils import require_torch, slow, torch_device
|
||||
from transformers.utils import cached_property
|
||||
|
||||
from ...test_configuration_common import ConfigTester
|
||||
@@ -522,11 +522,6 @@ class TapasModelTest(ModelTesterMixin, PipelineTesterMixin, 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
|
||||
@unittest.skip(reason="tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
def test_pt_tf_model_equivalence(self):
|
||||
pass
|
||||
|
||||
@unittest.skip(reason="tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
def test_tf_from_pt_safetensors(self):
|
||||
pass
|
||||
|
||||
@@ -535,10 +535,6 @@ class TFTapasModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.TestCas
|
||||
def test_loss_computation(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
def test_pt_tf_model_equivalence(self):
|
||||
pass
|
||||
|
||||
|
||||
def prepare_tapas_single_inputs_for_inference():
|
||||
# Here we prepare a single table-question pair to test TAPAS inference on:
|
||||
|
||||
@@ -34,7 +34,6 @@ from transformers.models.tapas.tokenization_tapas import (
|
||||
_is_whitespace,
|
||||
)
|
||||
from transformers.testing_utils import (
|
||||
is_pt_tf_cross_test,
|
||||
require_pandas,
|
||||
require_tensorflow_probability,
|
||||
require_tokenizers,
|
||||
@@ -1158,54 +1157,6 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
|
||||
self.assertListEqual(encoding.input_ids[:2], expected_results)
|
||||
|
||||
@is_pt_tf_cross_test
|
||||
def test_batch_encode_plus_tensors(self):
|
||||
tokenizers = self.get_tokenizers(do_lower_case=False)
|
||||
for tokenizer in tokenizers:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__}"):
|
||||
sequences = [
|
||||
"Testing batch encode plus",
|
||||
"Testing batch encode plus with different sequence lengths",
|
||||
"Testing batch encode plus with different sequence lengths correctly pads",
|
||||
]
|
||||
|
||||
table = self.get_table(tokenizer, length=0)
|
||||
|
||||
# A Tensor cannot be build by sequences which are not the same size
|
||||
self.assertRaises(ValueError, tokenizer.batch_encode_plus, table, sequences, return_tensors="pt")
|
||||
self.assertRaises(ValueError, tokenizer.batch_encode_plus, table, sequences, return_tensors="tf")
|
||||
|
||||
if tokenizer.pad_token_id is None:
|
||||
self.assertRaises(
|
||||
ValueError,
|
||||
tokenizer.batch_encode_plus,
|
||||
table,
|
||||
sequences,
|
||||
padding=True,
|
||||
return_tensors="pt",
|
||||
)
|
||||
self.assertRaises(
|
||||
ValueError,
|
||||
tokenizer.batch_encode_plus,
|
||||
table,
|
||||
sequences,
|
||||
padding="longest",
|
||||
return_tensors="tf",
|
||||
)
|
||||
else:
|
||||
pytorch_tensor = tokenizer.batch_encode_plus(table, sequences, padding=True, return_tensors="pt")
|
||||
tensorflow_tensor = tokenizer.batch_encode_plus(
|
||||
table, sequences, padding="longest", return_tensors="tf"
|
||||
)
|
||||
encoded_sequences = tokenizer.batch_encode_plus(table, sequences, padding=True)
|
||||
|
||||
for key in encoded_sequences.keys():
|
||||
pytorch_value = pytorch_tensor[key].tolist()
|
||||
tensorflow_value = tensorflow_tensor[key].numpy().tolist()
|
||||
encoded_value = encoded_sequences[key]
|
||||
|
||||
self.assertEqual(pytorch_value, tensorflow_value, encoded_value)
|
||||
|
||||
@slow
|
||||
def test_tapas_integration_test(self):
|
||||
data = {
|
||||
|
||||
Reference in New Issue
Block a user