[tests] remove tests from libraries with deprecated support (flax, tensorflow_text, ...) (#39051)
* rm tf/flax tests * more flax deletions * revert fixture change * reverted test that should not be deleted; rm tf/flax test * revert * fix a few add-model-like tests * fix add-model-like checkpoint source * a few more * test_get_model_files_only_pt fix * fix test_retrieve_info_for_model_with_xxx * fix test_retrieve_model_classes * relative paths are the devil * add todo
This commit is contained in:
@@ -33,7 +33,6 @@ from transformers.models.tapas.tokenization_tapas import (
|
||||
)
|
||||
from transformers.testing_utils import (
|
||||
require_pandas,
|
||||
require_tensorflow_probability,
|
||||
require_tokenizers,
|
||||
require_torch,
|
||||
slow,
|
||||
@@ -140,41 +139,6 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
output_text = "unwanted, running"
|
||||
return input_text, output_text
|
||||
|
||||
@require_tensorflow_probability
|
||||
@slow
|
||||
def test_tf_encode_plus_sent_to_model(self):
|
||||
from transformers import TF_MODEL_MAPPING, TOKENIZER_MAPPING
|
||||
|
||||
MODEL_TOKENIZER_MAPPING = merge_model_tokenizer_mappings(TF_MODEL_MAPPING, TOKENIZER_MAPPING)
|
||||
|
||||
tokenizers = self.get_tokenizers(do_lower_case=False)
|
||||
for tokenizer in tokenizers:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__}"):
|
||||
if tokenizer.__class__ not in MODEL_TOKENIZER_MAPPING:
|
||||
self.skipTest(f"{tokenizer.__class__} is not in the MODEL_TOKENIZER_MAPPING")
|
||||
|
||||
config_class, model_class = MODEL_TOKENIZER_MAPPING[tokenizer.__class__]
|
||||
config = config_class()
|
||||
|
||||
if config.is_encoder_decoder or config.pad_token_id is None:
|
||||
self.skipTest(reason="Model is an encoder-decoder or does not have a pad token id set")
|
||||
|
||||
model = model_class(config)
|
||||
|
||||
# Make sure the model contains at least the full vocabulary size in its embedding matrix
|
||||
self.assertGreaterEqual(model.config.vocab_size, len(tokenizer))
|
||||
|
||||
# Build sequence
|
||||
first_ten_tokens = list(tokenizer.get_vocab().keys())[:10]
|
||||
sequence = " ".join(first_ten_tokens)
|
||||
table = self.get_table(tokenizer, length=0)
|
||||
encoded_sequence = tokenizer.encode_plus(table, sequence, return_tensors="tf")
|
||||
batch_encoded_sequence = tokenizer.batch_encode_plus(table, [sequence, sequence], return_tensors="tf")
|
||||
|
||||
# This should not fail
|
||||
model(encoded_sequence)
|
||||
model(batch_encoded_sequence)
|
||||
|
||||
def test_rust_and_python_full_tokenizers(self):
|
||||
if not self.test_rust_tokenizer:
|
||||
self.skipTest(reason="test_rust_tokenizer is set to False")
|
||||
|
||||
@@ -161,10 +161,6 @@ class VisionTextDualEncoderMixin:
|
||||
(text_config.num_attention_heads, input_ids.shape[-1], input_ids.shape[-1]),
|
||||
)
|
||||
|
||||
def assert_almost_equals(self, a: np.ndarray, b: np.ndarray, tol: float):
|
||||
diff = np.abs(a - b).max()
|
||||
self.assertLessEqual(diff, tol, f"Difference between torch and flax is {diff} (>= {tol}).")
|
||||
|
||||
def test_vision_text_dual_encoder_model(self):
|
||||
inputs_dict = self.prepare_config_and_inputs()
|
||||
self.check_vision_text_dual_encoder_model(**inputs_dict)
|
||||
|
||||
@@ -813,12 +813,6 @@ class Wav2Vec2ModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase
|
||||
# (Even with this call, there are still memory leak by ~0.04MB)
|
||||
self.clear_torch_jit_class_registry()
|
||||
|
||||
@unittest.skip(
|
||||
"Need to investigate why config.do_stable_layer_norm is set to False here when it doesn't seem to be supported"
|
||||
)
|
||||
def test_flax_from_pt_safetensors(self):
|
||||
return
|
||||
|
||||
|
||||
@require_torch
|
||||
class Wav2Vec2RobustModelTest(ModelTesterMixin, unittest.TestCase):
|
||||
|
||||
@@ -18,7 +18,7 @@ import numpy as np
|
||||
|
||||
from transformers.models.whisper import WhisperTokenizer, WhisperTokenizerFast
|
||||
from transformers.models.whisper.tokenization_whisper import _combine_tokens_into_words, _find_longest_common_sequence
|
||||
from transformers.testing_utils import require_flax, require_torch, slow
|
||||
from transformers.testing_utils import require_torch, slow
|
||||
|
||||
from ...test_tokenization_common import TokenizerTesterMixin
|
||||
|
||||
@@ -588,15 +588,6 @@ class SpeechToTextTokenizerMultilinguialTest(unittest.TestCase):
|
||||
self.assertListEqual(WhisperTokenizer._convert_to_list(np_array), test_list)
|
||||
self.assertListEqual(WhisperTokenizerFast._convert_to_list(np_array), test_list)
|
||||
|
||||
@require_flax
|
||||
def test_convert_to_list_jax(self):
|
||||
import jax.numpy as jnp
|
||||
|
||||
test_list = [[1, 2, 3], [4, 5, 6]]
|
||||
jax_array = jnp.array(test_list)
|
||||
self.assertListEqual(WhisperTokenizer._convert_to_list(jax_array), test_list)
|
||||
self.assertListEqual(WhisperTokenizerFast._convert_to_list(jax_array), test_list)
|
||||
|
||||
@require_torch
|
||||
def test_convert_to_list_pt(self):
|
||||
import torch
|
||||
|
||||
Reference in New Issue
Block a user