Skip to content

Commit

Permalink
Remove fixtures DocVQA in favor of dataset on the hub
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsRogge committed Aug 30, 2021
1 parent a72f080 commit 2391ca5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Binary file removed tests/fixtures/tests_samples/DocVQA/document.png
Binary file not shown.
Binary file removed tests/fixtures/tests_samples/DocVQA/document_2.png
Binary file not shown.
6 changes: 5 additions & 1 deletion tests/test_feature_extraction_layoutlmv2.py
Expand Up @@ -185,7 +185,11 @@ def test_layoutlmv2_integration_test(self):
# with apply_OCR = True
feature_extractor = LayoutLMv2FeatureExtractor()

image = Image.open("tests/fixtures/tests_samples/DocVQA/document.png").convert("RGB")
from datasets import load_dataset

ds = load_dataset("hf-internal-testing/fixtures_docvqa", split="test")

image = Image.open(ds[0]["file"]).convert("RGB")

encoding = feature_extractor(image, return_tensors="pt")

Expand Down
8 changes: 6 additions & 2 deletions tests/test_processor_layoutlmv2.py
Expand Up @@ -141,8 +141,12 @@ class LayoutLMv2ProcessorIntegrationTests(unittest.TestCase):
@cached_property
def get_images(self):
# we verify our implementation on 2 document images from the DocVQA dataset
image_1 = Image.open("tests/fixtures/tests_samples/DocVQA/document.png").convert("RGB")
image_2 = Image.open("tests/fixtures/tests_samples/DocVQA/document_2.png").convert("RGB")
from datasets import load_dataset

ds = load_dataset("hf-internal-testing/fixtures_docvqa", split="test")

image_1 = Image.open(ds[0]["file"]).convert("RGB")
image_2 = Image.open(ds[1]["file"]).convert("RGB")

return image_1, image_2

Expand Down

0 comments on commit 2391ca5

Please sign in to comment.