DINOv2 linear
DINOv2 ViT-L/14 (Oquab et al. 2023) with its official linear ImageNet head.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
dinov2_vitl14_lc | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 22.4 10.8 5.43 4.93 5.09 4.22 | 1210 / 1224 1782 / 1806 623 / 1228 890 / 950 660 / 688 618 (engine) |
Details
- Original code: https://github.com/huggingface/pytorch-image-models at
0df212b369a5 - Code licence: Apache-2.0 (permissive); files:
- Weights licence: Apache-2.0
- Licence evidence: https://huggingface.co/timm/vit_large_patch14_dinov2.lvd142m/blob/4741e1cafbf45415e77074bb0cb42dba76c8684a/README.md
- Training data: LVD-142M (DINOv2's curated web-image set, not released), ImageNet-1k (ILSVRC 2012 classification)
- Kernel libraries:
cudnn_hacc,fvm_conv,fvm_extra,fvm_mb,fvm_r3 - Variants:
dinov2_vitl14_lc - Outputs: logits; label_set:
imagenet-1k - Input size: fixed 224x224: the input is resized (short side 256) and centre-cropped to it
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
dinov2_vitl14_lc224x224 (0.6 GiB peak allocated, 0.7 reserved) dinov2_vitl14_lc224x224, first call: portable + torch.compile 12 s (cold Inductor cache), TensorRT fp16 38 s (ONNX + engine).dinov2_vitl14_lcoriginal 224x224: torch.autocast(fp16) around the forwarddinov2_vitl14_lcload / first call: original 5.8 s / 0.323 s, portable 3.34 s / 0.017 s, kernels 3.94 s / 0.095 s- Protocol, median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls
Measured
fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | kernels | note |
|---|---|---|---|---|---|---|
dinov2_vitl14_lc | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 86.68 / 97.78 | 86.62 / 97.78 | 86.68 / 97.80 | 86.74 / 97.78 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
Parity
CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.08 (absolute error of the output logits).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
dinov2_vitl14_lc | 0.007 / 0.02242 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120 |