From 85b4aece6ced1037661b77cd5a553c5f9829d6b8 Mon Sep 17 00:00:00 2001 From: Franz Louis Cesista Date: Thu, 15 Aug 2024 23:04:19 +0800 Subject: [PATCH] fix imports of processors in layoutlm tests --- tests/models/layoutlmv2/test_processor_layoutlmv2.py | 4 ++-- tests/models/layoutlmv3/test_processor_layoutlmv3.py | 4 ++-- tests/models/layoutxlm/test_processor_layoutxlm.py | 4 ++-- tests/test_processing_common.py | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/models/layoutlmv2/test_processor_layoutlmv2.py b/tests/models/layoutlmv2/test_processor_layoutlmv2.py index c8f6e1a55a24de..488d9df6708e3a 100644 --- a/tests/models/layoutlmv2/test_processor_layoutlmv2.py +++ b/tests/models/layoutlmv2/test_processor_layoutlmv2.py @@ -23,7 +23,7 @@ from transformers import PreTrainedTokenizer, PreTrainedTokenizerBase, PreTrainedTokenizerFast from transformers.models.layoutlmv2 import LayoutLMv2Tokenizer, LayoutLMv2TokenizerFast -from transformers.models.layoutlmv2.processing_layoutlmv2 import LayoutLMv2ProcessorKwargs +from transformers.models.layoutlmv2.processing_layoutlmv2 import LayoutLMv2Processor, LayoutLMv2ProcessorKwargs from transformers.models.layoutlmv2.tokenization_layoutlmv2 import VOCAB_FILES_NAMES from transformers.testing_utils import require_pytesseract, require_tokenizers, require_torch, slow from transformers.utils import FEATURE_EXTRACTOR_NAME, cached_property, is_pytesseract_available @@ -34,7 +34,7 @@ if is_pytesseract_available(): from PIL import Image - from transformers import LayoutLMv2ImageProcessor, LayoutLMv2Processor + from transformers import LayoutLMv2ImageProcessor @require_pytesseract diff --git a/tests/models/layoutlmv3/test_processor_layoutlmv3.py b/tests/models/layoutlmv3/test_processor_layoutlmv3.py index 3c6cef7ca6f021..eba165d895d296 100644 --- a/tests/models/layoutlmv3/test_processor_layoutlmv3.py +++ b/tests/models/layoutlmv3/test_processor_layoutlmv3.py @@ -23,7 +23,7 @@ from transformers import PreTrainedTokenizer, PreTrainedTokenizerBase, PreTrainedTokenizerFast from transformers.models.layoutlmv3 import LayoutLMv3Tokenizer, LayoutLMv3TokenizerFast -from transformers.models.layoutlmv3.processing_layoutlmv3 import LayoutLMv3ProcessorKwargs +from transformers.models.layoutlmv3.processing_layoutlmv3 import LayoutLMv3Processor, LayoutLMv3ProcessorKwargs from transformers.models.layoutlmv3.tokenization_layoutlmv3 import VOCAB_FILES_NAMES from transformers.testing_utils import require_pytesseract, require_tokenizers, require_torch, slow from transformers.utils import FEATURE_EXTRACTOR_NAME, cached_property, is_pytesseract_available @@ -34,7 +34,7 @@ if is_pytesseract_available(): from PIL import Image - from transformers import LayoutLMv3ImageProcessor, LayoutLMv3Processor + from transformers import LayoutLMv3ImageProcessor @require_pytesseract diff --git a/tests/models/layoutxlm/test_processor_layoutxlm.py b/tests/models/layoutxlm/test_processor_layoutxlm.py index 94dfe085fad0eb..08eea26d3614b7 100644 --- a/tests/models/layoutxlm/test_processor_layoutxlm.py +++ b/tests/models/layoutxlm/test_processor_layoutxlm.py @@ -23,7 +23,7 @@ from transformers import PreTrainedTokenizer, PreTrainedTokenizerBase, PreTrainedTokenizerFast from transformers.models.layoutxlm import LayoutXLMTokenizer, LayoutXLMTokenizerFast -from transformers.models.layoutxlm.processing_layoutxlm import LayoutXLMProcessorKwargs +from transformers.models.layoutxlm.processing_layoutxlm import LayoutXLMProcessor, LayoutXLMProcessorKwargs from transformers.testing_utils import ( require_pytesseract, require_sentencepiece, @@ -39,7 +39,7 @@ if is_pytesseract_available(): from PIL import Image - from transformers import LayoutLMv2ImageProcessor, LayoutXLMProcessor + from transformers import LayoutLMv2ImageProcessor @require_pytesseract diff --git a/tests/test_processing_common.py b/tests/test_processing_common.py index a30c6363b9d7ff..cace97967785b0 100644 --- a/tests/test_processing_common.py +++ b/tests/test_processing_common.py @@ -46,7 +46,6 @@ @require_torch @require_vision -@require_torch class ProcessorTesterMixin: processor_class = None