DINOv2 ViT-S/14 โ candle format
dinov2-vits14.safetensors โ DINOv2 ViT-S/14 weights packed into the layout
expected by the candle framework's
dinov2::vit_small model. Drop-in for on-device image feature extraction in
Rust.
These are the numerically-identical parameters of
facebook/dinov2-small plus
Meta's official ImageNet linear-probe head, re-packed for candle (the separate
query/key/value attention projections are fused into a single qkv tensor, and
tensor keys are renamed to candle's convention). No weights were retrained or
altered in value.
Why this exists
candle's vit_small expects a fused qkv and candle-style key names, which
the upstream HF checkpoint doesn't use. Existing candle-format re-hosts are
licensed CC-BY-NC or carry no license, which is unusable commercially. This repo
provides the same weights under Apache-2.0, derived entirely from
Apache-2.0 sources.
Contents
| Tensors | Source (Apache-2.0) |
|---|---|
Backbone (patch embed, 12 transformer blocks, final norm; fused qkv) |
facebook/dinov2-small |
head.weight (1000ร768), head.bias (1000) โ ImageNet linear probe |
dinov2_vits14_linear_head.pth |
mask_token (zeros, training-only) |
facebook/dinov2-small |
candle::dinov2::vit_small's forward pass returns the 1000-d linear-probe
output; used here as a dense image descriptor for visual-similarity ranking.
Usage (candle)
use candle_transformers::models::dinov2;
let vb = unsafe {
candle_nn::VarBuilder::from_mmaped_safetensors(
&["dinov2-vits14.safetensors"], candle_core::DType::F32, &device)?
};
let model = dinov2::vit_small(vb)?;
let descriptor = model.forward(&image_tensor)?; // (1, 1000)
License & attribution
Apache-2.0 (see LICENSE). Derived from DINOv2 ยฉ Meta Platforms, Inc.; see
NOTICE. Original work: facebookresearch/dinov2
(Oquab et al., 2023).
Model tree for SimCubeLtd/dinov2-vits14-candle
Base model
facebook/dinov2-small