EVA-02
EVA-02 (Fang et al. 2023): a vision transformer pre-trained with masked image modelling.
stable Fork of huggingface/pytorch-image-models@0df212b · backends: portable, kernels
- Paper EVA-02: A Visual Representation for Neon Genesis Image and Vision Computing 2024 (vol. 149, 105171) · first released 20 Mar 2023
- Authors’ code baaivision/EVA (PyTorch), not the code forked here: timm re-implements the model with the released weights in a uniform API.
Checkpoint eva02_large_patch14_448.mim_m38m_ft_in22k_in1k
Paper 2023 Added in 0.1.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install "fastforks-core[timm]"
from fastforks import classification
model = classification.load("eva02_large_patch14_448.mim_m38m_ft_in22k_in1k") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.logits
result.backend # what ran: mode, device, dtype, kernels fastforks bench eva02_large_patch14_448.mim_m38m_ft_in22k_in1k Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
Input: synthetic, 224x224 (the task’s standard size)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 83.7 | 0.38× | 1,260 MiB/1,284 MiB | 2.9 | 0.14 |
| Original fp16torch.autocast(fp16) around the forward | fp16 | 32.1 | – | 1,819 MiB/1,864 MiB | 7.0 | 0.39 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 18.2 | 1.8× | 648 MiB/664 MiB | 4.5 | 0.17 |
| Kernels | fp16 | 14.1 | 2.3× | 652 MiB/786 MiB | 5.9 | 0.17 |
| Portable + torch.compile | 14.9 | 2.1× | 674 MiB/684 MiB | 21 (build) | – | |
| TensorRT fp16 | fp16 | 12.4 | 2.6× | 642 MiBenginenot comparable | 44 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-03 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12 | Original | fp32 | 267 | 3,515 MiB process | matches | 224x224 |
| Portable | fp16 | 235 | 4,094 MiB process | matches | 224x224 | |
| Portable | fp32 | 267 | 4,096 MiB process | matches | 224x224 | |
| Kernels | fp16 | not implemented | – | 224x224 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 25.3 | 624 MiB/644 MiB | – | 224x224 |
| Kernels | fp16 | 19.6 | 1,204 MiB/1,346 MiB | – | 224x224 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 16.7 | 624 MiB/644 MiB | – | 224x224 |
| Kernels | fp16 | 6.82 | 1,204 MiB/1,346 MiB | – | 224x224 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 23.1 | 624 MiB/644 MiB | – | 224x224 |
| Kernels | fp16 | 16.9 | 1,204 MiB/1,346 MiB | – | 224x224 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 16.3 | 624 MiB/644 MiB | – | 224x224 |
| Kernels | fp16 | 10.3 | 1,204 MiB/1,346 MiB | – | 224x224 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 6.80 | 651 MiB/664 MiB | – | 224x224 |
| Kernels | fp16 | 5.46 | 1,233 MiB/1,406 MiB | – | 224x224 | |
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0
- Weights
- MIT source
- Training data
-
- Merged-38M (EVA-02 pre-training mix: ImageNet-22k, CC12M, CC3M, COCO, ADE20K, Objects365, OpenImages) not stated
- ImageNet-21k / ImageNet-22k (full ImageNet, fall 2011 release) noncommercial, non-commercial
- ImageNet-1k (ILSVRC 2012 classification) noncommercial, non-commercial
Our reading of the licences, not legal advice.
Weights
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k.safetensors 1.2 GB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download eva02_large_patch14_448.mim_m38m_ft_in22k_in1k).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
ImageNet-1k val
5000 random images, top-1 / top-5 %
| Run | dtype | top-1 % ↑ | top-5 % ↑ | Δ top-1 % vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 90.62 | 99.10 | reference | 5000 | 86.0 |
| Original fp16 | fp16 | 90.62 | 99.10 | ±0.00 | 5000 | 34.5 |
| Portable fp32 | fp32 | 90.46 | 99.08 | −0.16 | 5000 | 86.6 |
| Portable | fp16 | 90.46 | 99.08 | −0.16 | 5000 | 21.4 |
| Kernels | fp16 | 90.50 | 99.08 | −0.12 | 5000 | 13.5 |
fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c91993, 2026-10-31; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 | 0.00154 |
| GPU default dtypes, p99 |diff| | ≤ 0.08 | 0.00587 |
Recorded for eva02_large_patch14_448.mim_m38m_ft_in22k_in1k on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-04, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3
Details
EVA-02 (Fang et al. 2023): ViT with SwiGLU and rotary position embeddings, MIM pre-trained.
- Input / output
- Input: one RGB image. Output: ImageNet-1k class logits.
- Input size
- fixed 448x448: the input is resized (short side 448) and centre-cropped to it; tested up to 448x448 (666 MiB allocated)
- Outputs
logits- Checkpoint
arch="eva02_large_patch14_448.mim_m38m_ft_in22k_in1k"- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)fvm_convfused convolutions for image classifiersfvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)fvm_r3further fused classifier blocks
- Apple (MPS)
- fp32, fp16
Limitations
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~80 MiB above portable (peak allocated is not); `cuda_graphs=false` or `release_graphs()` frees it.
Full reference, generated from the repository
EVA-02 (Fang et al. 2023): a vision transformer pre-trained with masked image modelling.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 83.7 32.1 18.2 14.1 14.9 12.4 | 1260 / 1284 1819 / 1864 648 / 664 652 / 786 674 / 684 1259 / 1286 |
Details
- Original code: https://github.com/huggingface/pytorch-image-models at
0df212b369a5 - Code licence: Apache-2.0 (permissive); files:
- Weights licence: MIT
- Licence evidence: https://huggingface.co/timm/eva02_large_patch14_448.mim_m38m_ft_in22k_in1k/blob/fae13da496eea422cb162dfdb693dc125b68f04d/README.md
- Training data: Merged-38M (EVA-02 pre-training mix: ImageNet-22k, CC12M, CC3M, COCO, ADE20K, Objects365, OpenImages), ImageNet-21k / ImageNet-22k (full ImageNet, fall 2011 release), ImageNet-1k (ILSVRC 2012 classification)
- Kernel libraries:
cudnn_hacc,fvm_conv,fvm_extra,fvm_mb,fvm_r3 - Variants:
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k(default ofeva02_large_patch14_448) - Outputs: logits; label_set:
imagenet-1k - Input size: fixed 448x448: the input is resized (short side 448) and centre-cropped to it
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k448x448 (0.7 GiB peak allocated, 0.8 reserved) eva02_large_patch14_448.mim_m38m_ft_in22k_in1k224x224, first call: portable + torch.compile 21 s (cold Inductor cache), TensorRT fp16 44 s (ONNX + engine).eva02_large_patch14_448.mim_m38m_ft_in22k_in1koriginal 224x224: torch.autocast(fp16) around the forwardeva02_large_patch14_448.mim_m38m_ft_in22k_in1kload / first call: original 6.98 s / 0.389 s, portable 4.54 s / 0.173 s, kernels 5.89 s / 0.165 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
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 | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 90.62 / 99.10 | 90.62 / 99.10 | 90.46 / 99.08 | 90.46 / 99.08 | 90.50 / 99.08 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7c91993, 2026-10-31; kernels: 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 |
|---|---|---|---|
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k | 0.00154 / 0.00587 | 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 |
Limitations
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~80 MiB above portable (peak allocated is not);
cuda_graphs=falseorrelease_graphs()frees it.
Example output
One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).
Top 5
Input: Chelsea the cat, Stéfan van der Walt (CC0).