Image pipelines spec compliance (#33899)
* Update many similar visual pipelines * Add input tests * Add ImageToText as well * Add output tests * Add output tests * Add output tests * OutputElement -> Output * Correctly test elements * make fixup * fix typo in the task list * Fix VQA testing * Add copyright to image_classification.py * Revert changes to VQA pipeline because outputs have differences - will move to another PR * make fixup * Remove deprecation warnings
This commit is contained in:
@@ -20,6 +20,7 @@ import datasets
|
||||
import numpy as np
|
||||
import requests
|
||||
from datasets import load_dataset
|
||||
from huggingface_hub import ImageSegmentationOutputElement
|
||||
from huggingface_hub.utils import insecure_hashlib
|
||||
|
||||
from transformers import (
|
||||
@@ -36,6 +37,7 @@ from transformers import (
|
||||
pipeline,
|
||||
)
|
||||
from transformers.testing_utils import (
|
||||
compare_pipeline_output_to_hub_spec,
|
||||
is_pipeline_test,
|
||||
nested_simplify,
|
||||
require_tf,
|
||||
@@ -168,6 +170,10 @@ class ImageSegmentationPipelineTests(unittest.TestCase):
|
||||
f"Expected [{n}, {n}, {n}, {n}, {n}], got {[len(item) for item in outputs]}",
|
||||
)
|
||||
|
||||
for single_output in outputs:
|
||||
for output_element in single_output:
|
||||
compare_pipeline_output_to_hub_spec(output_element, ImageSegmentationOutputElement)
|
||||
|
||||
@require_tf
|
||||
@unittest.skip(reason="Image segmentation not implemented in TF")
|
||||
def test_small_model_tf(self):
|
||||
|
||||
Reference in New Issue
Block a user