Download README.md from fastforks/efficientformerv2: direct link, hf CLI and curl.
- Browser
- Download file 8.23 kB
-
https://huggingface.co/fastforks/efficientformerv2/resolve/main/README.md
- Command line
-
hf download hf://fastforks/efficientformerv2/README.md
-
curl -L -o README.md https://huggingface.co/fastforks/efficientformerv2/resolve/main/README.md
library_name: fastforks
pipeline_tag: image-classification
license: apache-2.0
tags:
- classification
- image-classification
- cuda
- pytorch
- fastforks
- fastforks-card
EfficientFormerV2 (fastforks)
EfficientFormerV2 (Li et al. 2022, Snap Research): a mobile hybrid classifier, convolutional stages with attention in the last two.
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/efficientformerv2_l.snap_dist_in1k, https://huggingface.co/timm/efficientformerv2_s0.snap_dist_in1k, https://huggingface.co/timm/efficientformerv2_s1.snap_dist_in1k, https://huggingface.co/timm/efficientformerv2_s2.snap_dist_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 |
|---|---|---|---|---|
efficientformerv2_l.snap_dist_in1k@1 |
efficientformerv2_l.snap_dist_in1k.safetensors | a92de90055b1 |
Apache-2.0 | yes |
efficientformerv2_s0.snap_dist_in1k@1 |
efficientformerv2_s0.snap_dist_in1k.safetensors | ad4ce93472a2 |
Apache-2.0 | yes |
efficientformerv2_s1.snap_dist_in1k@1 |
efficientformerv2_s1.snap_dist_in1k.safetensors | 3ef67aa25321 |
Apache-2.0 | yes |
efficientformerv2_s2.snap_dist_in1k@1 |
efficientformerv2_s2.snap_dist_in1k.safetensors | c46c28768173 |
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/efficientformerv2_s0.snap_dist_in1k/blob/aa226e91a076e760bc7957e5990f19f6ae322c5f/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): efficientformerv2_l.snap_dist_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved); efficientformerv2_s0.snap_dist_in1k 224x224 (0.0 GiB peak allocated, 0.1 reserved); efficientformerv2_s1.snap_dist_in1k 224x224 (0.0 GiB peak allocated, 0.1 reserved); efficientformerv2_s2.snap_dist_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 |
|---|---|---|---|---|---|---|---|---|---|---|
efficientformerv2_l.snap_dist_in1k |
224x224 | 19.9 | 29.0 | 17.1 | β | β | β | 186 / 198 | 93 / 144 | β |
efficientformerv2_s0.snap_dist_in1k |
224x224 | 8.16 | 11.8 | 7.62 | β | β | β | 55 / 64 | 44 / 64 | β |
efficientformerv2_s1.snap_dist_in1k |
224x224 | 10.1 | 14.9 | 8.91 | β | β | β | 70 / 80 | 50 / 88 | β |
efficientformerv2_s2.snap_dist_in1k |
224x224 | 15.2 | 21.8 | 13.9 | β | β | β | 108 / 116 | 64 / 104 | β |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
efficientformerv2_l.snap_dist_in1k |
0.32 | 2.74 | β | 0.73 | 0.43 | β |
efficientformerv2_s0.snap_dist_in1k |
0.17 | 1.88 | β | 1.76 | 0.50 | β |
efficientformerv2_s1.snap_dist_in1k |
0.19 | 1.96 | β | 0.59 | 0.43 | β |
efficientformerv2_s2.snap_dist_in1k |
0.24 | 2.68 | β | 0.86 | 0.44 | β |
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) |
|---|---|---|---|---|---|---|---|---|---|---|---|
efficientformerv2_l.snap_dist_in1k |
224x224 | 17.1 ms | 7.32 ms | 1.20 ms | β | 20.7 s | 45.1 s | 93 / 144 | 125 / 184 | β | 161 / 214 |
efficientformerv2_s0.snap_dist_in1k |
224x224 | 7.62 ms | 3.34 ms | 0.550 ms | β | 11.3 s | 36.3 s | 44 / 64 | 76 / 104 | β | 78 / 100 |
efficientformerv2_s1.snap_dist_in1k |
224x224 | 8.91 ms | 3.91 ms | 0.632 ms | β | 12.7 s | 41.2 s | 50 / 88 | 82 / 108 | β | 86 / 126 |
efficientformerv2_s2.snap_dist_in1k |
224x224 | 13.9 ms | 5.55 ms | 0.919 ms | β | 16.4 s | 38.9 s | 64 / 104 | 96 / 124 | β | 100 / 142 |
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 |
|---|---|---|---|---|---|
efficientformerv2_s0.snap_dist_in1k |
ImageNet-1k val, 5000 random images, top-1 / top-5 % | 77.04 / 92.94 | 77.00 / 92.76 | 77.34 / 92.82 | |
efficientformerv2_s1.snap_dist_in1k |
ImageNet-1k val, 5000 random images, top-1 / top-5 % | 80.80 / 95.00 | 81.02 / 94.88 | 80.88 / 95.00 | |
efficientformerv2_s2.snap_dist_in1k |
ImageNet-1k val, 5000 random images, top-1 / top-5 % | 83.22 / 96.28 | 83.10 / 96.34 | 83.18 / 96.30 | |
efficientformerv2_l.snap_dist_in1k |
ImageNet-1k val, 5000 random images, top-1 / top-5 % | 83.88 / 96.58 | 83.96 / 96.58 | 84.02 / 96.50 |
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| <= 4.7e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.12 and p99 <= 0.42 (absolute error of the output logits).
Usage
from fastforks import classification
model = classification.load("efficientformerv2_l.snap_dist_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: efficientformerv2_l.snap_dist_in1k, efficientformerv2_s0.snap_dist_in1k, efficientformerv2_s1.snap_dist_in1k, efficientformerv2_s2.snap_dist_in1k.
Kernels backend
No kernels backend: not built yet: Conv-BN blocks with depthwise 3x3, feature-map attention with learned bias tables and strided depthwise convolutions need a dedicated kernels runner.