Skip test_conditional_generation_pt_pix2struct in Past CI (torch < 1.11) (#24417)
fix Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -18,11 +18,24 @@ import requests
|
|||||||
|
|
||||||
from transformers import MODEL_FOR_VISION_2_SEQ_MAPPING, TF_MODEL_FOR_VISION_2_SEQ_MAPPING, is_vision_available
|
from transformers import MODEL_FOR_VISION_2_SEQ_MAPPING, TF_MODEL_FOR_VISION_2_SEQ_MAPPING, is_vision_available
|
||||||
from transformers.pipelines import pipeline
|
from transformers.pipelines import pipeline
|
||||||
from transformers.testing_utils import is_pipeline_test, require_tf, require_torch, require_vision, slow
|
from transformers.testing_utils import (
|
||||||
|
is_pipeline_test,
|
||||||
|
is_torch_available,
|
||||||
|
require_tf,
|
||||||
|
require_torch,
|
||||||
|
require_vision,
|
||||||
|
slow,
|
||||||
|
)
|
||||||
|
|
||||||
from .test_pipelines_common import ANY
|
from .test_pipelines_common import ANY
|
||||||
|
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_11
|
||||||
|
else:
|
||||||
|
is_torch_greater_or_equal_than_1_11 = False
|
||||||
|
|
||||||
|
|
||||||
if is_vision_available():
|
if is_vision_available():
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
else:
|
else:
|
||||||
@@ -204,6 +217,9 @@ class ImageToTextPipelineTests(unittest.TestCase):
|
|||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
outputs = pipe([image, image], prompt=[prompt, prompt])
|
outputs = pipe([image, image], prompt=[prompt, prompt])
|
||||||
|
|
||||||
|
@unittest.skipIf(
|
||||||
|
not is_torch_greater_or_equal_than_1_11, reason="`Pix2StructImageProcessor` requires `torch>=1.11.0`."
|
||||||
|
)
|
||||||
@slow
|
@slow
|
||||||
@require_torch
|
@require_torch
|
||||||
def test_conditional_generation_pt_pix2struct(self):
|
def test_conditional_generation_pt_pix2struct(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user