Don't use LayoutLMv2 and LayoutLMv3 in some pipeline tests (#22774)

* fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2023-04-17 17:45:20 +02:00
committed by GitHub
parent ea7b0a539a
commit 5269718cb7
6 changed files with 39 additions and 26 deletions

View File

@@ -25,11 +25,20 @@ from transformers.testing_utils import is_pipeline_test, nested_simplify, requir
from .test_pipelines_common import ANY
# These 2 model types require different inputs than those of the usual text models.
_TO_SKIP = {"LayoutLMv2Config", "LayoutLMv3Config"}
@is_pipeline_test
class TextClassificationPipelineTests(unittest.TestCase):
model_mapping = MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
tf_model_mapping = TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
if model_mapping is not None:
model_mapping = {config: model for config, model in model_mapping.items() if config.__name__ in _TO_SKIP}
if tf_model_mapping is not None:
tf_model_mapping = {config: model for config, model in tf_model_mapping.items() if config.__name__ in _TO_SKIP}
@require_torch
def test_small_model_pt(self):
text_classifier = pipeline(