Aurevoir PyTorch 1 (#35358)
* fix * fix * fix --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -60,9 +60,6 @@ if is_torch_available():
|
||||
reduce_mean,
|
||||
reduce_sum,
|
||||
)
|
||||
from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_12
|
||||
else:
|
||||
is_torch_greater_or_equal_than_1_12 = False
|
||||
|
||||
|
||||
class TapasModelTester:
|
||||
@@ -411,7 +408,6 @@ class TapasModelTester:
|
||||
return config, inputs_dict
|
||||
|
||||
|
||||
@unittest.skipIf(not is_torch_greater_or_equal_than_1_12, reason="Tapas is only available in torch v1.12+")
|
||||
@require_torch
|
||||
class TapasModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
all_model_classes = (
|
||||
@@ -578,7 +574,6 @@ def prepare_tapas_batch_inputs_for_training():
|
||||
return table, queries, answer_coordinates, answer_text, float_answer
|
||||
|
||||
|
||||
@unittest.skipIf(not is_torch_greater_or_equal_than_1_12, reason="Tapas is only available in torch v1.12+")
|
||||
@require_torch
|
||||
class TapasModelIntegrationTest(unittest.TestCase):
|
||||
@cached_property
|
||||
@@ -930,10 +925,6 @@ class TapasModelIntegrationTest(unittest.TestCase):
|
||||
self.assertTrue(torch.allclose(outputs.logits, expected_tensor, atol=0.05))
|
||||
|
||||
|
||||
# Below: tests for Tapas utilities which are defined in modeling_tapas.py.
|
||||
# These are based on segmented_tensor_test.py of the original implementation.
|
||||
# URL: https://github.com/google-research/tapas/blob/master/tapas/models/segmented_tensor_test.py
|
||||
@unittest.skipIf(not is_torch_greater_or_equal_than_1_12, reason="Tapas is only available in torch v1.12+")
|
||||
@require_torch
|
||||
class TapasUtilitiesTest(unittest.TestCase):
|
||||
def _prepare_tables(self):
|
||||
|
||||
@@ -23,7 +23,7 @@ import numpy as np
|
||||
import pandas as pd
|
||||
from parameterized import parameterized
|
||||
|
||||
from transformers import AddedToken, is_torch_available
|
||||
from transformers import AddedToken
|
||||
from transformers.models.tapas.tokenization_tapas import (
|
||||
VOCAB_FILES_NAMES,
|
||||
BasicTokenizer,
|
||||
@@ -45,12 +45,6 @@ from transformers.testing_utils import (
|
||||
from ...test_tokenization_common import TokenizerTesterMixin, filter_non_english, merge_model_tokenizer_mappings
|
||||
|
||||
|
||||
if is_torch_available():
|
||||
from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_12
|
||||
else:
|
||||
is_torch_greater_or_equal_than_1_12 = False
|
||||
|
||||
|
||||
@require_tokenizers
|
||||
@require_pandas
|
||||
class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
@@ -1048,7 +1042,6 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
# Do the same test as modeling common.
|
||||
self.assertIn(0, output["token_type_ids"][0])
|
||||
|
||||
@unittest.skipIf(not is_torch_greater_or_equal_than_1_12, reason="Tapas is only available in torch v1.12+")
|
||||
@require_torch
|
||||
@slow
|
||||
def test_torch_encode_plus_sent_to_model(self):
|
||||
|
||||
Reference in New Issue
Block a user