/
githubmirror
/
transformers
Обзор
Документация
Войти
/
githubmirror
/
transformers
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/models/trocr/test_processing_trocr.py
37 строк
1 KB
Yih-Dar
processor tests: use tiny Hub repos to reduce CI memory (#47115)
07 июл 2026, 12:28
Не верифицирован
07 июл 2026, 12:28
001c526
Код
Авторство
О чём код?
import unittest import pytest from transformers.testing_utils import ( require_tokenizers, require_vision, ) from transformers.utils import is_vision_available from ...test_processing_common import ProcessorTesterMixin if is_vision_available(): from transformers import TrOCRProcessor @require_tokenizers @require_vision class TrOCRProcessorTest(ProcessorTesterMixin, unittest.TestCase): text_input_name = "labels" processor_class = TrOCRProcessor # Tiny processor created with make_tiny_processor.py from "microsoft/trocr-base-handwritten" tiny_model_id = "hf-internal-testing/tiny-processor-trocr" def test_processor_text(self): processor = self.get_processor() input_str = "lower newer" image_input = self.prepare_image_inputs() inputs = processor(text=input_str, images=image_input) self.assertListEqual(list(inputs.keys()), ["pixel_values", "labels"]) # test if it raises when no input is passed with pytest.raises(ValueError): processor()