DaViT (fastforks)

DaViT (Ding et al. 2022): a hierarchical vision transformer that alternates window (spatial) attention and channel-group attention.

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/pytorch-image-models at 0df212b369a5.

Author weight repos: https://huggingface.co/timm/davit_base.msft_in1k, https://huggingface.co/timm/davit_small.msft_in1k, https://huggingface.co/timm/davit_tiny.msft_in1k.

Task: classification. Tier: experimental. Outputs: logits. Backends: portable.

Input: one RGB image. Output: ImageNet-1k class logits.

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
davit_base.msft_in1k@1 davit_base.msft_in1k.safetensors cd12f8bd194e Apache-2.0 yes
davit_small.msft_in1k@1 davit_small.msft_in1k.safetensors cef0f04c7349 Apache-2.0 yes
davit_tiny.msft_in1k@1 davit_tiny.msft_in1k.safetensors 085937207d2e Apache-2.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0.

Training data: ImageNet-1k (ILSVRC 2012 classification).

Licence evidence: https://huggingface.co/timm/davit_tiny.msft_in1k/blob/982f32c73d98f9966df4a7178b32b820bed3c1b1/README.md

Input size

fixed 224x224: the input is resized (short side 235) and centre-cropped to it Tested up to (portable, fp16, RTX 5060 Ti 16 GB): davit_base.msft_in1k 224x224 (0.2 GiB peak allocated, 0.2 reserved); davit_small.msft_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved); davit_tiny.msft_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved)

Speed and memory

Classification, synthetic

model input time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
davit_base.msft_in1k 224x224 13.4 20.0 11.7 – – – 537 / 548 212 / 224 –
davit_small.msft_in1k 224x224 13.0 18.8 12.8 – – – 319 / 324 136 / 150 –
davit_tiny.msft_in1k 224x224 6.93 9.88 6.33 – – – 196 / 204 96 / 116 –

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
davit_base.msft_in1k 0.99 1.84 – 0.56 0.27 –
davit_small.msft_in1k 0.53 1.60 – 0.02 0.23 –
davit_tiny.msft_in1k 0.39 1.47 – 0.85 0.25 –

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)
davit_base.msft_in1k 224x224 11.7 ms 5.48 ms 2.28 ms – 21.8 s 71.1 s 212 / 224 242 / 262 – 403 / 422
davit_small.msft_in1k 224x224 12.8 ms 5.54 ms 1.92 ms – 21.8 s 66.4 s 136 / 150 166 / 190 – 234 / 254
davit_tiny.msft_in1k 224x224 6.33 ms 3.10 ms 1.03 ms – 15.5 s 53.8 s 96 / 116 125 / 136 – 159 / 166

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

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 note
davit_tiny.msft_in1k ImageNet-1k val, 5000 random images, top-1 / top-5 % 83.94 / 96.50 83.92 / 96.50 83.94 / 96.56
davit_small.msft_in1k ImageNet-1k val, 5000 random images, top-1 / top-5 % 85.18 / 97.20 85.16 / 97.20 85.24 / 97.18
davit_base.msft_in1k ImageNet-1k val, 5000 random images, top-1 / top-5 % 85.58 / 97.10 85.58 / 97.10 85.66 / 97.12

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7ba7307f, 2026-11-11.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 3.3e-06 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0026 and p99 <= 0.011 (absolute error of the output logits).

Usage

from fastforks import classification

model = classification.load("davit_base.msft_in1k")  # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.top(5)  # top-5 classes
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: davit_base.msft_in1k, davit_small.msft_in1k, davit_tiny.msft_in1k.

Kernels backend

No kernels backend: not implemented: window attention and channel attention with depthwise position convolutions: needs its own runner.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Collection including fastforks/davit