"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "ede09d671debdaecfd9eaa86d63d8a92d6182d81"
Unverified Commit eedaba68 authored by Lysandre Debut's avatar Lysandre Debut Committed by GitHub
Browse files

[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
parent d39f794e
...@@ -49,6 +49,11 @@ alt="drawing" width="600"/> ...@@ -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(): ...@@ -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: ...@@ -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): ...@@ -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(): ...@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment