Skip to content
Open
19 changes: 19 additions & 0 deletions optimum/exporters/openvino/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4665,6 +4665,25 @@ def patch_model_for_export(
return OVDecoderModelPatcher(self, model, model_kwargs=model_kwargs)


@register_in_tasks_manager("dinov3_vit", *["feature-extraction"], library_name="transformers")
@register_in_tasks_manager("dinov3_convnext", *["feature-extraction"], library_name="transformers")
Comment on lines +4270 to +4271
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding a tests for dinov3_vit! Would you mind adding a test for dinov3_convnext as well ? (to make sure support is not broken in the future)

class DinoV3OpenVINOConfig(VisionOnnxConfig):
MIN_TRANSFORMERS_VERSION = "4.55.0"


NORMALIZED_CONFIG_CLASS = NormalizedVisionConfig
@property
def inputs(self) -> Dict[str, Dict[int, str]]:
return {
"pixel_values": {0: "image_batch_size", 1: "num_channels", 2: "height", 3: "width"},
}

@property
def outputs(self) -> Dict[str, Dict[int, str]]:
return {
"last_hidden_state": {0: "image_batch_size"},
"pooler_output": {0: "image_batch_size"},
}
@register_in_tasks_manager(
"vision-encoder-decoder",
*[
Expand Down
7 changes: 7 additions & 0 deletions tests/openvino/test_exporters_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ class OVCLIExportTestCase(unittest.TestCase):
("text-to-video", "ltx-video"),
]
)

if is_transformers_version(">=", "4.56"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's wait for us to support transformers v4.56 before merging so that we are sure all tests are triggered and pass

SUPPORTED_ARCHITECTURES.extend(
[
("feature-extraction", "vit-with-pooler"),
]
)

EXPECTED_NUMBER_OF_TOKENIZER_MODELS = {
"gpt2": 2 if is_tokenizers_version("<", "0.20") or is_openvino_version(">=", "2024.5") else 0,
Expand Down
1 change: 1 addition & 0 deletions tests/openvino/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,7 @@ def test_compare_with_and_without_past_key_values(self):
class OVModelForCustomTasksIntegrationTest(unittest.TestCase):
SUPPORTED_ARCHITECTURES_WITH_ATTENTION = ["vit-with-attentions"]
SUPPORTED_ARCHITECTURES_WITH_HIDDEN_STATES = ["vit-with-hidden-states"]
SUPPORTED_ARCHITECTURES_WITH_HIDDEN_STATES = ["dinov3_vit"]

def _get_sample_image(self):
url = TEST_IMAGE_URL
Expand Down
1 change: 1 addition & 0 deletions tests/openvino/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"sana": "katuni4ka/tiny-random-sana",
"sana-sprint": "katuni4ka/tiny-random-sana-sprint",
"ltx-video": "katuni4ka/tiny-random-ltx-video",
"dinov3_vit": "snake7gun/tiny-random-dinov3",
}


Expand Down
Loading