[EXPERIMENT][WIP][OpenVINO] Add support for DINOv3 ConvNeXt - #1865
Draft
mlukasze wants to merge 1 commit into
Draft
[EXPERIMENT][WIP][OpenVINO] Add support for DINOv3 ConvNeXt#1865mlukasze wants to merge 1 commit into
mlukasze wants to merge 1 commit into
Conversation
- Register dinov3_convnext model_type in optimum/exporters/openvino/model_configs.py as a one-line pass-through of ViTOpenVINOConfig (same pattern as existing convnext). - Add tiny model test entry to tests/openvino/utils_tests.py. - Extend OVModelForCustomTasksIntegrationTest in tests/openvino/test_modeling.py with a vision feature-extraction comparison test (pixel_values -> last_hidden_state), since OVModelForFeatureExtraction is hard-coded for text inputs. - Document DINOv3 (ConvNeXt variant) in docs/source/openvino/models.mdx. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds OpenVINO export and inference support for DINOv3 ConvNeXt (
dinov3_convnext, e.g.facebook/dinov3-convnext-small-pretrain-lvd1689m).DINOv3ConvNextModel(nativetransformerssupport since ~4.56) is architecturally a standard ConvNeXt CNN backbone (depthwise conv -> channels-last LayerNorm -> pointwise GELU MLP -> layer-scale -> droppath, 4 stages, global-average-pool + final LayerNorm) with apixel_values -> last_hidden_state/pooler_outputsignature -- fully compatible with the existingViTOpenVINOConfigcontract already used by plainconvnext. This PR follows the exact same one-line pass-through pattern asConvNextOpenVINOConfig, registered under thefeature-extractiontask only (this model has no image-classification/masked-im head/variant, unlike plain convnext).Validation (real full-size gated model, real COCO image, not synthetic data): PyTorch FP32 vs. OpenVINO IR (
OVModelForCustomTasks) cosine similarity = 0.99999994 (last_hidden_state, 50x768) / 1.0 (pooled token); max abs diff 3.53e-05 / 7.27e-06. No missing/unsupported OpenVINO operators (Convolution, GroupConvolution, MVN, MatMul, Add, Multiply, Transpose, Gelu, ReduceMean, Concat, Reshape -- all standard/long-supported).Test coverage: extended
OVModelForCustomTasksIntegrationTestwithtest_compare_output_vision_feature_extraction, parametrized ondinov3_convnext.OVModelForFeatureExtractionis hard-coded for text inputs (input_ids/attention_mask/token_type_ids) so this test uses the genericOVModelForCustomTaskswrapper instead, with the required explicittask="feature-extraction"kwarg (this class has no defaultexport_feature, unlike task-specificOVModelForXXXclasses -- omitting it crashes task inference withTypeError: unsupported operand type(s) for +: 'NoneType' and 'str', a real bug caught and fixed while validating this new test).Known limitation -- tiny CI fixture not yet uploaded:
tests/openvino/utils_tests.pyregistersoptimum-intel-internal-testing/tiny-random-dinov3_convnextper convention, but this repo does not exist on the Hub yet, and the automation account used to prepare this PR only has read-scoped Hub access (confirmed via a 403 on repo creation, including under its own personal namespace) -- it cannot self-publish this fixture. A helper script is included at the bottom of this description for a maintainer withoptimum-intel-internal-testingwrite access to run once (create_tiny_dinov3_convnext.py --push-to-hub); until then, CI will fail on this one parametrized case with a clear "not a valid model identifier" error (not a code defect). The test logic itself has been independently verified to genuinely pass end-to-end (1 passedin a real local pytest run) by temporarily pointing the fixture entry at the real gated model with an authorized token, then reverting -- see the attachedtest_run.log.Tiny fixture creation script (for a maintainer with org write access)
Installation instructions
Exporting cmd-line
Inference script
Before submitting