[Past CI] Vilt only supports PT >= v1.10 (#19851)
* Support for Vilt in v1.9 * Skip if not higher or equal than 1.10 * Move test :) * I am bad at python
This commit is contained in:
@@ -49,6 +49,11 @@ alt="drawing" width="600"/>
|
|||||||
|
|
||||||
This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be found [here](https://github.com/dandelin/ViLT).
|
This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be found [here](https://github.com/dandelin/ViLT).
|
||||||
|
|
||||||
|
|
||||||
|
Tips:
|
||||||
|
|
||||||
|
- The PyTorch version of this model is only available in torch 1.10 and higher.
|
||||||
|
|
||||||
## ViltConfig
|
## ViltConfig
|
||||||
|
|
||||||
[[autodoc]] ViltConfig
|
[[autodoc]] ViltConfig
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ if is_torch_available():
|
|||||||
ViltModel,
|
ViltModel,
|
||||||
)
|
)
|
||||||
from transformers.models.vilt.modeling_vilt import VILT_PRETRAINED_MODEL_ARCHIVE_LIST
|
from transformers.models.vilt.modeling_vilt import VILT_PRETRAINED_MODEL_ARCHIVE_LIST
|
||||||
|
from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_10
|
||||||
|
else:
|
||||||
|
is_torch_greater_or_equal_than_1_10 = False
|
||||||
|
|
||||||
if is_vision_available():
|
if is_vision_available():
|
||||||
import PIL
|
import PIL
|
||||||
@@ -214,6 +217,7 @@ class ViltModelTester:
|
|||||||
|
|
||||||
|
|
||||||
@require_torch
|
@require_torch
|
||||||
|
@unittest.skipIf(not is_torch_greater_or_equal_than_1_10, "Vilt is only available in torch v1.10+")
|
||||||
class ViltModelTest(ModelTesterMixin, unittest.TestCase):
|
class ViltModelTest(ModelTesterMixin, unittest.TestCase):
|
||||||
all_model_classes = (
|
all_model_classes = (
|
||||||
(
|
(
|
||||||
@@ -510,6 +514,7 @@ class ViltModelTest(ModelTesterMixin, unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
@require_torch
|
@require_torch
|
||||||
|
@unittest.skipIf(not is_torch_greater_or_equal_than_1_10, "Vilt is only available in torch v1.10+")
|
||||||
class ViltForImagesAndTextClassificationModelTest(ViltModelTest, unittest.TestCase):
|
class ViltForImagesAndTextClassificationModelTest(ViltModelTest, unittest.TestCase):
|
||||||
all_model_classes = (ViltForImagesAndTextClassification,) if is_torch_available() else ()
|
all_model_classes = (ViltForImagesAndTextClassification,) if is_torch_available() else ()
|
||||||
|
|
||||||
@@ -534,6 +539,7 @@ def prepare_img():
|
|||||||
|
|
||||||
@require_torch
|
@require_torch
|
||||||
@require_vision
|
@require_vision
|
||||||
|
@unittest.skipIf(not is_torch_greater_or_equal_than_1_10, "Vilt is only available in torch v1.10+")
|
||||||
class ViltModelIntegrationTest(unittest.TestCase):
|
class ViltModelIntegrationTest(unittest.TestCase):
|
||||||
@cached_property
|
@cached_property
|
||||||
def default_processor(self):
|
def default_processor(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user