Add dinov2-mlx reference entry - #1450
Open
bahaehmimdi wants to merge 1 commit into
Open
Conversation
Links to a DINOv2 port verified against real PyTorch (correctness and speed both checked, not assumed). Flagged in the README: this runs the real transformers model through torch-mlx rather than a native mlx.nn reimplementation, a different shape of contribution than this repo's usual examples -- open to restructuring or closing based on maintainer feedback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HooZphcpzukceMrdArswsP
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.
Summary
Adds a
dinov2/entry linking to dinov2-mlx, a DINOv2 port for Apple Silicon verified against real, unmodified PyTorch (correctness and speed both checked with real numbers, not assumed).I want to flag upfront that this takes a different approach from this repo's other examples, and I'm genuinely open to your guidance on whether/how it fits. Every example here (e.g.
clip/,segment_anything/) is a nativemlx.nnmodel definition, withtorchused only for one-time offline weight conversion.dinov2-mlxinstead runs the real, unmodifiedtransformers.AutoModelthrough torch-mlx (a from-scratch PyTorch-API-compatible layer backed bymlx.core) at inference time — so the model code itself is realtransformers, not a hand-written MLX port. Given that, this PR is a short linking README rather than inline runnable code (every other entry here is self-contained code, so this is unusual on that front too).If this isn't a fit for the example gallery as-is, totally understand — happy to close this, or restructure it however you think makes more sense.
Results
pooler_outputverified against real PyTorch: ~0.32% relative error (consistent with expected float accumulation noise across 24 layers).BENCHMARK_RESULTS.md.Test plan
dinov2/README.md, no changes to existing files🤖 Generated with Claude Code
https://claude.ai/code/session_01HooZphcpzukceMrdArswsP