Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[TESTS] Fix failing nightly PyTorch model hub tests (#36750)

Maxim Vafin06d29ee10567
diff --git a/.github/workflows/job_pytorch_models_tests.yml b/.github/workflows/job_pytorch_models_tests.yml
index 973405fc5ac..db922c074d2 100644
--- a/.github/workflows/job_pytorch_models_tests.yml
+++ b/.github/workflows/job_pytorch_models_tests.yml
@@ -126,7 +126,8 @@ jobs:
-r ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/envs/hf_transformers.txt \
-r ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/envs/easyocr.txt \
-r ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/envs/gfpgan.txt \
- -r ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/envs/tpsmm.txt
+ -r ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/envs/tpsmm.txt \
+ -r ${MODEL_HUB_TESTS_INSTALL_DIR}/pytorch/envs/lightglue.txt
- name: PyTorch Models Tests Not Timm or Torchvision
if: ${{ inputs.model_scope == 'precommit' || inputs.model_scope == 'nightly_scope2' }}
diff --git a/tests/model_hub_tests/pytorch/envs/lightglue.txt b/tests/model_hub_tests/pytorch/envs/lightglue.txt
new file mode 100644
index 00000000000..54d7e60b8a2
--- /dev/null
+++ b/tests/model_hub_tests/pytorch/envs/lightglue.txt
@@ -0,0 +1,3 @@
+# Extra dependencies for test_lightglue.py
+# kornia is required by lightglue_onnx/disk.py which is imported via __init__.py
+kornia
diff --git a/tests/model_hub_tests/pytorch/test_hf_transformers.py b/tests/model_hub_tests/pytorch/test_hf_transformers.py
index 06f584ee4bc..b76875d24aa 100644
--- a/tests/model_hub_tests/pytorch/test_hf_transformers.py
+++ b/tests/model_hub_tests/pytorch/test_hf_transformers.py
@@ -437,6 +437,10 @@ class TestTransformersModel(TestTorchConvertModel):
example = dict(input_ids=encoded_input["input_ids"],
token_type_ids=encoded_input["token_type_ids"],
attention_mask=encoded_input["attention_mask"])
+ elif 'image-classification' in mi.tags:
+ image_processor = AutoImageProcessor.from_pretrained(model_cached)
+ encoded_input = image_processor(images=self.image, return_tensors="pt")
+ example = dict(encoded_input)
else:
text = "Replace me by any text you'd like."
if auto_processor is not None and "Tokenizer" not in auto_processor: