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. Licence 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 | 3.68 | 1.26 | 5.5x | 2.9x | 527 / 550 | 200 / 206 | 168 / 210 |
dinov3-vith16plus |
48.0 | 25.9 | 12.5 | 8.45 | 3.1x | 1.5x | 4849 / 4876 | 1646 / 1668 | 1645 / 1672 |
dinov3-vitl16 |
19.2 | 17.7 | 6.69 | 3.03 | 5.8x | 2.2x | 1772 / 1812 | 616 / 626 | 616 / 652 |
dinov3-vits16 |
6.47 | 9.16 | 3.54 | 0.792 | 8.2x | 4.5x | 158 / 166 | 76 / 78 | 44 / 62 |
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 |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
dinov3-vitb16 |
224x224 | 3.68 ms | 2.35 ms | 1.14 ms | 1.26 ms | 10.4 s | 25.0 s | 200 / 206 | 236 / 306 | 168 / 210 | 393 / 480 |
dinov3-vith16plus |
224x224 | 12.5 ms | 11.6 ms | 7.86 ms | 8.45 ms | 21.0 s | 99.2 s | 1646 / 1668 | 1699 / 2008 | 1645 / 1672 | 3280 / 3628 |
dinov3-vitl16 |
224x224 | 6.69 ms | 4.91 ms | 2.98 ms | 3.03 ms | 17.0 s | 34.4 s | 616 / 626 | 655 / 846 | 616 / 652 | 1226 / 1418 |
dinov3-vits16 |
224x224 | 3.54 ms | 2.18 ms | 0.564 ms | 0.792 ms | 8.81 s | 25.0 s | 76 / 78 | 109 / 138 | 44 / 62 | 107 / 120 |
Fixed-size speed and peak memory, all models
| model | mode | 480x640 | 720x1280 | 1080x1920 | 12 MP 3000x4000 |
|---|---|---|---|---|---|
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 original code named above 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
On public datasets
Two disjoint seeded subsets of the val folders; each image shorter side 256 (bicubic), centre crop 224, the CLS / pooled feature; cosine kNN, vote weighted by similarity. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
dinov3-vits16 |
ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 55.38 | 55.42 | 55.42 | 55.36 | |
dinov3-vitb16 |
ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 66.54 | 66.54 | 66.52 | 66.54 | |
dinov3-vitl16 |
ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 75.94 | 75.92 | 75.80 | 75.88 | |
dinov3-vith16plus |
ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 79.50 | 79.50 | 79.52 | 79.52 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
Parity with the original code
Every variant is checked against reference 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| (absolute error of the output last_hidden_state).
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") # mode="auto": the preferred backend from recorded measurements
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, dpt_fused). 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.
Model tree for fastforks/dinov3
Base model
facebook/dinov3-vit7b16-pretrain-lvd1689m