Skip to content

Pre-initialize DINOv2 with linear head - #661

Open
warrkan wants to merge 4 commits into
masterfrom
romanove/dinov2_head
Open

warrkan wants to merge 4 commits into
masterfrom
romanove/dinov2_head

Conversation

@warrkan

@warrkan warrkan commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Export DINOv2 classifiers with the official facebookresearch/dinov2 ImageNet linear head (reg4 variants).
Resolves #655

@warrkan
warrkan requested a review from a team as a code owner October 28, 2026 13:15
@github-actions github-actions Bot added tests Related to tests python python related changes build Related to build scripts labels Oct 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The test checks only feature shape, leaving incorrect patch averaging or reversed feature concatenation undetected; it should assert the exact returned values.

1 open issue
What changed in this PR

This PR addresses #655 by initializing the converter’s DINOv2 classifier with the official ImageNet linear head, enabling meaningful predictions from exported models.

Changes:

  • Loads the pretrained reg4 head and adapts backbone features to its expected input.
  • Replaces placeholder label metadata with resolved class names and adds unit tests.
  • Adds Ruff as a pinned lint dependency.
File Description
model_converter/​uv.lock Locks Ruff and the lint dependency group.
model_converter/​tests/​unit/​test_getitune.py Tests head initialization, validation, routing, and label metadata.
model_converter/​src/​model_converter/​converters/​getitune.py Integrates the official DINOv2 head and updates exported label metadata.
model_converter/​pyproject.toml Adds the Ruff lint dependency group.

Review effort: Balanced

Comment thread model_converter/tests/unit/test_getitune.py
@ivanzati
ivanzati requested a review from a team as a code owner October 29, 2026 14:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Related to build scripts python python related changes tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-upload DINOv2 to HF with pre-initialized head weights

3 participants