mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
fix the last ones
This commit is contained in:
parent
52f2dbe9ef
commit
d48c569504
@ -171,7 +171,7 @@ class LayoutLMv3ProcessorIntegrationTests(unittest.TestCase):
|
|||||||
from datasets import load_dataset
|
from datasets import load_dataset
|
||||||
|
|
||||||
ds = load_dataset("hf-internal-testing/fixtures_docvqa", split="test")
|
ds = load_dataset("hf-internal-testing/fixtures_docvqa", split="test")
|
||||||
return ds[0]["image"], ds[1]["image"]
|
return ds[0]["image"].convert("RGB"), ds[1]["image"].convert("RGB")
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def get_tokenizers(self):
|
def get_tokenizers(self):
|
||||||
|
@ -188,7 +188,7 @@ class UdopProcessorTest(ProcessorTesterMixin, unittest.TestCase):
|
|||||||
processor = UdopProcessor.from_pretrained("microsoft/udop-large", apply_ocr=False)
|
processor = UdopProcessor.from_pretrained("microsoft/udop-large", apply_ocr=False)
|
||||||
|
|
||||||
def preprocess_data(examples):
|
def preprocess_data(examples):
|
||||||
images = [Image.open(path).convert("RGB") for path in examples["image_path"]]
|
images = [image.convert("RGB") for image in examples["image"]]
|
||||||
words = examples["words"]
|
words = examples["words"]
|
||||||
boxes = examples["bboxes"]
|
boxes = examples["bboxes"]
|
||||||
word_labels = examples["ner_tags"]
|
word_labels = examples["ner_tags"]
|
||||||
|
@ -1149,7 +1149,7 @@ class TrOCRModelIntegrationTest(unittest.TestCase):
|
|||||||
def test_inference_handwritten(self):
|
def test_inference_handwritten(self):
|
||||||
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-handwritten").to(torch_device)
|
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-handwritten").to(torch_device)
|
||||||
|
|
||||||
dataset = load_dataset("hf-internal-testing/fixtures_ocr", split="test")
|
dataset = load_dataset("hf-internal-testing/fixtures_ocr", split="train")
|
||||||
image = dataset[0]["image"].convert("RGB")
|
image = dataset[0]["image"].convert("RGB")
|
||||||
|
|
||||||
processor = self.default_processor
|
processor = self.default_processor
|
||||||
@ -1174,7 +1174,7 @@ class TrOCRModelIntegrationTest(unittest.TestCase):
|
|||||||
def test_inference_printed(self):
|
def test_inference_printed(self):
|
||||||
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-printed").to(torch_device)
|
model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-printed").to(torch_device)
|
||||||
|
|
||||||
dataset = load_dataset("hf-internal-testing/fixtures_ocr", split="test")
|
dataset = load_dataset("hf-internal-testing/fixtures_ocr", split="train")
|
||||||
image = dataset[0]["image"].convert("RGB")
|
image = dataset[0]["image"].convert("RGB")
|
||||||
|
|
||||||
processor = self.default_processor
|
processor = self.default_processor
|
||||||
|
Loading…
Reference in New Issue
Block a user