From 06a82a49ae022ba8e88aeb0c4d57ec73e6258c43 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Tue, 18 Oct 2022 17:40:28 +0200 Subject: [PATCH] Specify TF framework in TF-related pipeline tests (#19719) Co-authored-by: ydshieh --- .../pipelines/test_pipelines_image_to_text.py | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/pipelines/test_pipelines_image_to_text.py b/tests/pipelines/test_pipelines_image_to_text.py index 6c0b37c8a1..16069971ce 100644 --- a/tests/pipelines/test_pipelines_image_to_text.py +++ b/tests/pipelines/test_pipelines_image_to_text.py @@ -56,7 +56,7 @@ class ImageToTextPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseMeta @require_tf def test_small_model_tf(self): - pipe = pipeline("image-to-text", model="hf-internal-testing/tiny-random-vit-gpt2") + pipe = pipeline("image-to-text", model="hf-internal-testing/tiny-random-vit-gpt2", framework="tf") image = "./tests/fixtures/tests_samples/COCO/000000039769.png" outputs = pipe(image) @@ -64,7 +64,12 @@ class ImageToTextPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseMeta outputs, [ { - "generated_text": "growthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthGOGO" + "generated_text": ( + " intermedi intermedi intermedi intermedi intermedi " + "explorer explorer explorer explorer explorer explorer " + "explorer medicine medicine medicine medicine medicine " + "medicine medicine" + ) }, ], ) @@ -75,13 +80,23 @@ class ImageToTextPipelineTests(unittest.TestCase, metaclass=PipelineTestCaseMeta [ [ { - "generated_text": "growthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthGOGO" - } + "generated_text": ( + " intermedi intermedi intermedi intermedi intermedi " + "explorer explorer explorer explorer explorer explorer " + "explorer medicine medicine medicine medicine medicine " + "medicine medicine" + ) + }, ], [ { - "generated_text": "growthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthgrowthGOGO" - } + "generated_text": ( + " intermedi intermedi intermedi intermedi intermedi " + "explorer explorer explorer explorer explorer explorer " + "explorer medicine medicine medicine medicine medicine " + "medicine medicine" + ) + }, ], ], )