DINOv3 ViT (fastforks)
DINOv3 ViT (Meta, 2025): self-supervised ViT backbones with 4 register tokens and RoPE; dense patch + cls features at any size (Hugging Face format checkpoints). Gated weights: accept the DINOv3 licence on each model's Hugging Face page, download model.safetensors yourself and put it under FASTFORKS_WEIGHTS_PATH (path and SHA-256 in the load error); fastforks does not send HF_TOKEN there.
This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/huggingface/transformers at v5.19.0.
Author weight repos: https://huggingface.co/facebook/dinov3-vitb16-pretrain-lvd1689m, https://huggingface.co/facebook/dinov3-vith16plus-pretrain-lvd1689m, https://huggingface.co/facebook/dinov3-vitl16-pretrain-lvd1689m, https://huggingface.co/facebook/dinov3-vits16-pretrain-lvd1689m.
Task: features. Tier: stable. Outputs: last_hidden_state, pooler_output, hidden_states. Backends: portable, kernels.
Input: one RGB image. Output: dense patch features and a pooled image feature.
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
dinov3-vitb16@1 |
dinov3-vitb16-pretrain-lvd1689m/model.safetensors | 9a21ac3df0c6 |
LicenseRef-DINOv3-License | yes |
dinov3-vith16plus@1 |
dinov3-vith16plus-pretrain-lvd1689m/model.safetensors | 3e1d4d18b9bf |
LicenseRef-DINOv3-License | yes |
dinov3-vitl16@1 |
dinov3-vitl16-pretrain-lvd1689m/model.safetensors | dcb2e45127cc |
LicenseRef-DINOv3-License | yes |
dinov3-vits16@1 |
dinov3-vits16-pretrain-lvd1689m/model.safetensors | 4610ad75edef |
LicenseRef-DINOv3-License | yes |
Licence
Original-code strings, recorded as they are (research-use package; check them before any other use). Code: LicenseRef-DINOv3-License. Files: LICENSE.md.
Training data: LVD-1689M: 1.689B images curated from 17B public Instagram images by retrieval / clustering, self-supervised (no labels), per the paper; not released.
- Licence note: Code and weights use the DINOv3 License (Meta: attribution and conditions apply); read it before commercial use.
Licence evidence: https://huggingface.co/facebook/dinov3-vits16-pretrain-lvd1689m/blob/114c1379950215c8b35dfcd4e90a5c251dde0d32/LICENSE.md (DINOv3 License, the same file in every model repo; gated: accept on Hugging Face to download)
Input size
any H x W >= 1, resized or padded inside the model
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): dinov3-vitb16 3000x4000 (1.6 GiB peak allocated, 2.0 reserved); dinov3-vith16plus 3000x4000 (4.2 GiB peak allocated, 4.9 reserved); dinov3-vitl16 3000x4000 (2.4 GiB peak allocated, 2.9 reserved); dinov3-vits16 3000x4000 (1.0 GiB peak allocated, 1.2 reserved)
Speed and memory
Features, synthetic, 224x224
| model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|
dinov3-vitb16 |
6.95 | 9.33 | 4.863 | 1.404 | 5.0x | 3.5x | 527 / 550 | 201 / 206 | 201 / 252 |
dinov3-vith16plus |
48.04 | 25.86 | 13.341 | 9.301 | 2.8x | 1.4x | 4849 / 4876 | 1645 / 1668 | 1644 / 1694 |
dinov3-vitl16 |
19.17 | 17.73 | 9.134 | 3.279 | 5.4x | 2.8x | 1772 / 1812 | 617 / 646 | 617 / 674 |
dinov3-vits16 |
6.47 | 9.16 | 4.671 | 0.903 | 7.2x | 5.2x | 158 / 166 | 77 / 80 | 77 / 106 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
dinov3-vitb16 |
0.68 | 0.38 | 0.16 | 0.01 | 0.20 | 0.29 |
dinov3-vith16plus |
5.95 | 2.02 | 1.40 | 0.05 | 0.10 | 0.20 |
dinov3-vitl16 |
2.37 | 0.54 | 0.52 | 0.02 | 0.18 | 0.25 |
dinov3-vits16 |
0.48 | 0.07 | 0.06 | 0.95 | 0.27 | 0.26 |
Fixed-size speed and peak memory, all models
| model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 |
|---|---|---|---|---|---|
dinov3-vitb16 |
portable | 8.8 ms / 224 / 242 | 31.6 ms / 281 / 304 | 102.4 ms / 389 / 464 | 2039.3 ms (n=3) / 1308 / 1502 |
dinov3-vitb16 |
kernels | 5.3 ms / 233 / 326 | 19.4 ms / 297 / 324 | 64.4 ms / 424 / 462 | 1322.5 ms / 1515 / 1702 |
dinov3-vith16plus |
portable | 60.7 ms / 1689 / 1724 | 218.8 ms / 1795 / 1846 | 636.2 ms / 1996 / 2106 | 10005.0 ms (n=3) / 3712 / 3944 |
dinov3-vith16plus |
kernels | 38.6 ms / 1690 / 1786 | 138.3 ms / 1789 / 1806 | 393.4 ms / 1984 / 2024 | 6021.9 ms (n=3) / 3643 / 3804 |
dinov3-vitl16 |
portable | 25.9 ms / 645 / 662 | 95.3 ms / 715 / 764 | 298.3 ms / 847 / 924 | 5549.3 ms (n=3) / 1975 / 2142 |
dinov3-vitl16 |
kernels | 15.6 ms / 656 / 726 | 54.9 ms / 738 / 764 | 174.5 ms / 899 / 922 | 3262.4 ms (n=3) / 2274 / 2402 |
dinov3-vits16 |
portable | 4.8 ms / 92 / 104 | 12.9 ms / 130 / 158 | 44.4 ms / 201 / 238 | 990.9 ms / 807 / 1036 |
dinov3-vits16 |
kernels | 2.3 ms / 97 / 168 | 8.6 ms / 145 / 242 | 29.7 ms / 213 / 236 | 644.8 ms / 876 / 1076 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.
Accuracy
Parity with the original code
Every variant is checked against golden outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1.5 % and p99 <= 6 % of the reference's median |value|.
Limitations
- kernels replays a CUDA graph per small input shape and layer set (up to 512 px, ViT-S 1024 px), captured on the shape's second call; at most 8 per model holding at most 256 MB of outputs (a full cache replaces only graphs unused for 64 calls, other new shapes run eagerly).
- The graphs' shared memory pool (intermediates) comes on top of that limit and stays reserved: up to about 470 MB more PyTorch cache than eager for ViT-H+ at 512 px with all layers, usually under 75 MB;
model.release_graphs()frees it on the device.
Usage
from fastforks import features
model = features.load("dinov3-vitb16") # portable PyTorch on the GPU if there is one, else the CPU
result = model("photo.jpg", size=518)
result.last_hidden_state # tokens [N, C], as Hugging Face's output
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: dinov3-vitb16, dinov3-vith16plus, dinov3-vitl16, dinov3-vits16.
Kernels backend
features.load("dinov3-vitb16", mode="kernels") runs our CUDA kernels (fastbb). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.