Models · Classification

RepViT

RepViT (Wang et al. 2024): a mobile CNN classifier laid out like a ViT, re-parameterised to plain convolutions.

experimental Fork of huggingface/pytorch-image-models@0df212b · backends: portable, kernels

Checkpoint

Paper 2023 Added in 0.2.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 0.776 ms 224x224, fp16
vs the faster original 10.9× original fp32: 8.45 ms
Peak memory 45 MiB original: 59 MiB
Accuracy vs original fp32 −0.02 kernels top-1 %, ImageNet-1k val (79.44 original)

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("repvit_m0_9.dist_300e_in1k")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.logits
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench repvit_m0_9.dist_300e_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)

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32 8.45–59 MiB/78 MiB1.70.36
Original fp16torch.autocast(float16) around the callfp16 12.70.67×65 MiB/84 MiB0.22.43
Portable fp32fp32not measured ––––
Portablefp16 5.351.6×45 MiB/76 MiB1.60.28
Kernelsfp16 0.77611×45 MiB/76 MiB2.00.08
Portable + torch.compile 3.302.6×77 MiB/96 MiB9 (build)–
TensorRT fp16fp16 0.50917×32 MiBenginenot comparable34 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-10. 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

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp3224.5 478 MiB process–224x224
Portablefp1613.2 470 MiB processmatches224x224
Portablefp3211.6 453 MiB processmatches224x224
Kernelsfp16not implemented–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
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

repvit_m0_9.dist_300e_in1k.safetensors 22.2 MB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download repvit_m0_9.dist_300e_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 %

Rundtypetop-1 % ↑top-5 % ↑Δ top-1 % vs fp32 originalimagesms / image
Original fp32fp3279.4494.20 reference 5000 0.714
Original fp16fp1679.4894.16 +0.04 5000 0.659
Portable fp32fp3279.4294.08 −0.02 5000 1.32
Portablefp1679.4494.08 ±0.00 5000 0.484
Kernelsfp1679.4294.08 −0.02 5000 0.347

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-10; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6f0a70e1, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 8b2f2df5, 2026-11-10.

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| <= 2.5e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0094 and p99 <= 0.036 (absolute error of the output logits).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.000025 not recorded
GPU default dtypes, mean |diff|≤ 0.0094 0.00445
GPU default dtypes, p99 |diff|≤ 0.036 0.01533

Recorded for repvit_m0_9.dist_300e_in1k on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-10, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3

Details

RepViT (Wang et al. 2024): a mobile CNN with the block layout of a ViT (3x3 depthwise token mixer, 1x1 channel mixer), re-parameterised to plain convolutions at load.

Input / output
Input: one RGB image. Output: ImageNet-1k class logits.
Input size
fixed 224x224: the input is resized (short side 235) and centre-cropped to it; tested up to 224x224 (45 MiB allocated)
Outputs
logits
Checkpoint
arch="repvit_m0_9.dist_300e_in1k"
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
  • fvm_convfused convolutions for image classifiers
  • fvm_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

  • The older aliases `repvit_m1` / `repvit_m2` / `repvit_m3` (`.dist_in1k`) that timm also lists are not shipped.
Full reference, generated from the repository

RepViT (Wang et al. 2024): a mobile CNN classifier laid out like a ViT, re-parameterised to plain convolutions.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
repvit_m0_9.dist_300e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
8.45
12.7
5.35
0.776
3.30
0.509
59 / 78
65 / 84
45 / 76
45 / 76
77 / 96
75 / 108
repvit_m0_9.dist_450e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
8.55
12.6
5.41
0.767
3.34
0.489
59 / 78
65 / 84
45 / 76
45 / 76
77 / 96
77 / 110
repvit_m1_0.dist_300e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
8.79
12.6
5.29
0.786
3.33
0.503
66 / 82
75 / 92
48 / 78
48 / 78
80 / 118
78 / 110
repvit_m1_0.dist_450e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
8.80
12.6
5.44
0.785
3.21
0.477
66 / 82
75 / 92
48 / 78
48 / 78
80 / 118
80 / 112
repvit_m1_1.dist_300e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
8.14
11.7
5.03
0.765
6.12
0.470
73 / 86
84 / 98
51 / 62
51 / 64
83 / 102
83 / 96
repvit_m1_1.dist_450e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
8.07
11.7
4.99
0.758
6.07
0.478
73 / 86
84 / 98
51 / 62
51 / 64
83 / 102
83 / 96
repvit_m1_5.dist_300e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
13.9
20.4
8.55
1.19
4.89
0.766
95 / 100
118 / 124
62 / 94
62 / 94
94 / 114
96 / 130
repvit_m1_5.dist_450e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
13.9
20.5
8.71
1.19
4.93
0.760
95 / 100
118 / 124
62 / 94
62 / 94
94 / 114
94 / 128
repvit_m2_3.dist_300e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
17.9
26.1
11.1
1.66
6.51
1.03
132 / 156
170 / 184
80 / 128
79 / 130
112 / 148
149 / 200
repvit_m2_3.dist_450e_in1ksynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
18.2
26.1
10.9
1.70
6.49
1.03
132 / 156
170 / 184
80 / 128
79 / 130
112 / 148
149 / 200
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/repvit_m1_1.dist_450e_in1k/blob/ff441038a42982fff1c8c75be7c794f9ba76db72/README.md
  • Training data: ImageNet-1k (ILSVRC 2012 classification) (ImageNet-1k with distillation from a RegNetY-16GF teacher (RepViT paper), 300 or 450 epochs)
  • Kernel libraries: cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3
  • Variants: repvit_m0_9.dist_300e_in1k (default of repvit_m0_9), repvit_m0_9.dist_450e_in1k, repvit_m1_0.dist_300e_in1k (default of repvit_m1_0), repvit_m1_0.dist_450e_in1k, repvit_m1_1.dist_300e_in1k (default of repvit_m1_1), repvit_m1_1.dist_450e_in1k, repvit_m1_5.dist_300e_in1k (default of repvit_m1_5), repvit_m1_5.dist_450e_in1k, repvit_m2_3.dist_300e_in1k (default of repvit_m2_3), repvit_m2_3.dist_450e_in1k
  • Outputs: logits; label_set: imagenet-1k
  • 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): repvit_m0_9.dist_300e_in1k 224x224 (0.0 GiB peak allocated, 0.0 reserved); repvit_m0_9.dist_450e_in1k 224x224 (0.0 GiB peak allocated, 0.0 reserved); repvit_m1_0.dist_300e_in1k 224x224 (0.0 GiB peak allocated, 0.0 reserved); repvit_m1_0.dist_450e_in1k 224x224 (0.0 GiB peak allocated, 0.0 reserved); repvit_m1_1.dist_300e_in1k 224x224 (0.0 GiB peak allocated, 0.1 reserved); repvit_m1_1.dist_450e_in1k 224x224 (0.0 GiB peak allocated, 0.1 reserved); repvit_m1_5.dist_300e_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved); repvit_m1_5.dist_450e_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved); repvit_m2_3.dist_300e_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved); repvit_m2_3.dist_450e_in1k 224x224 (0.1 GiB peak allocated, 0.1 reserved)
  • repvit_m0_9.dist_300e_in1k 224x224, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 34 s (ONNX + engine).
  • repvit_m0_9.dist_450e_in1k 224x224, first call: portable + torch.compile 8 s (cold Inductor cache), TensorRT fp16 30 s (ONNX + engine).
  • repvit_m1_0.dist_300e_in1k 224x224, first call: portable + torch.compile 8 s (cold Inductor cache), TensorRT fp16 35 s (ONNX + engine).
  • repvit_m1_0.dist_450e_in1k 224x224, first call: portable + torch.compile 8 s (cold Inductor cache), TensorRT fp16 40 s (ONNX + engine).
  • repvit_m1_1.dist_300e_in1k 224x224, first call: portable + torch.compile 8 s (cold Inductor cache), TensorRT fp16 33 s (ONNX + engine).
  • repvit_m1_1.dist_450e_in1k 224x224, first call: portable + torch.compile 8 s (cold Inductor cache), TensorRT fp16 33 s (ONNX + engine).
  • repvit_m1_5.dist_300e_in1k 224x224, first call: portable + torch.compile 10 s (cold Inductor cache), TensorRT fp16 39 s (ONNX + engine).
  • repvit_m1_5.dist_450e_in1k 224x224, first call: portable + torch.compile 10 s (cold Inductor cache), TensorRT fp16 34 s (ONNX + engine).
  • repvit_m2_3.dist_300e_in1k 224x224, first call: portable + torch.compile 12 s (cold Inductor cache), TensorRT fp16 41 s (ONNX + engine).
  • repvit_m2_3.dist_450e_in1k 224x224, first call: portable + torch.compile 12 s (cold Inductor cache), TensorRT fp16 41 s (ONNX + engine).
  • repvit_m0_9.dist_300e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m0_9.dist_450e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m1_0.dist_300e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m1_0.dist_450e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m1_1.dist_300e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m1_1.dist_450e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m1_5.dist_300e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m1_5.dist_450e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m2_3.dist_300e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m2_3.dist_450e_in1k original 224x224: torch.autocast(float16) around the call
  • repvit_m0_9.dist_300e_in1k load / first call: original 0.2 s / 2.43 s, portable 1.65 s / 0.283 s, kernels 2.01 s / 0.081 s
  • repvit_m0_9.dist_450e_in1k load / first call: original 0.19 s / 0.014 s, portable 1.65 s / 0.265 s, kernels 1.96 s / 0.052 s
  • repvit_m1_0.dist_300e_in1k load / first call: original 0.2 s / 1.436 s, portable 1.64 s / 0.277 s, kernels 2.0 s / 0.052 s
  • repvit_m1_0.dist_450e_in1k load / first call: original 0.2 s / 0.014 s, portable 1.74 s / 0.271 s, kernels 1.96 s / 0.051 s
  • repvit_m1_1.dist_300e_in1k load / first call: original 0.2 s / 1.365 s, portable 1.86 s / 0.281 s, kernels 1.97 s / 0.057 s
  • repvit_m1_1.dist_450e_in1k load / first call: original 0.21 s / 0.013 s, portable 1.89 s / 0.266 s, kernels 2.35 s / 0.054 s
  • repvit_m1_5.dist_300e_in1k load / first call: original 0.26 s / 0.023 s, portable 1.84 s / 0.268 s, kernels 2.63 s / 0.053 s
  • repvit_m1_5.dist_450e_in1k load / first call: original 0.25 s / 0.023 s, portable 1.86 s / 0.275 s, kernels 2.21 s / 0.053 s
  • repvit_m2_3.dist_300e_in1k load / first call: original 0.33 s / 1.536 s, portable 2.0 s / 0.275 s, kernels 2.41 s / 0.053 s
  • repvit_m2_3.dist_450e_in1k load / first call: original 0.34 s / 0.033 s, portable 2.01 s / 0.274 s, kernels 2.64 s / 0.057 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.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
repvit_m0_9.dist_300e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %79.44 / 94.2079.48 / 94.1679.44 / 94.0879.42 / 94.0879.42 / 94.08
repvit_m0_9.dist_450e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %79.52 / 94.2279.56 / 94.2679.52 / 94.2479.48 / 94.2679.52 / 94.24
repvit_m1_0.dist_300e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %81.12 / 94.7881.12 / 94.7681.10 / 94.7481.12 / 94.7481.10 / 94.80
repvit_m1_0.dist_450e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %81.10 / 94.8681.10 / 94.8881.16 / 94.9081.12 / 94.9681.14 / 94.92
repvit_m1_1.dist_300e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %81.40 / 95.1081.40 / 95.1081.32 / 95.0281.34 / 95.0281.34 / 95.02
repvit_m1_1.dist_450e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %82.32 / 95.7082.28 / 95.7282.18 / 95.6682.14 / 95.6282.18 / 95.62
repvit_m1_5.dist_300e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %82.94 / 96.2282.98 / 96.2482.96 / 96.2482.98 / 96.2483.00 / 96.26
repvit_m1_5.dist_450e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %83.18 / 96.3883.20 / 96.3883.24 / 96.3683.28 / 96.3483.24 / 96.36
repvit_m2_3.dist_300e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %84.12 / 96.5484.14 / 96.5284.22 / 96.5484.22 / 96.5684.20 / 96.54
repvit_m2_3.dist_450e_in1kImageNet-1k val, 5000 random images, top-1 / top-5 %84.30 / 96.5884.30 / 96.6084.26 / 96.6284.26 / 96.6284.20 / 96.62

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 8b2f2df5, 2026-11-10; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6f0a70e1, 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 8b2f2df5, 2026-11-10.

Parity

CPU, float32: max |diff| <= 2.5e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0094 and p99 <= 0.036 (absolute error of the output logits).

variantkernels error vs original, mean / p99GPU, torchkernels used
repvit_m0_9.dist_300e_in1k0.00445 / 0.01533RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m0_9.dist_450e_in1k0.006 / 0.02362RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m1_0.dist_300e_in1k0.00624 / 0.02055RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m1_0.dist_450e_in1k0.00517 / 0.01958RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m1_1.dist_300e_in1k0.00582 / 0.02136RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m1_1.dist_450e_in1k0.00608 / 0.02142RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m1_5.dist_300e_in1k0.00536 / 0.01993RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m1_5.dist_450e_in1k0.00508 / 0.02024RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m2_3.dist_300e_in1k0.00459 / 0.01603RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120
repvit_m2_3.dist_450e_in1k0.00489 / 0.01714RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120

Limitations

  • The older aliases repvit_m1 / repvit_m2 / repvit_m3 (.dist_in1k) that timm also lists are not shipped.

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Input

Top 5

  1. Egyptian cat 78%
  2. tiger cat 12%
  3. tabby 8.6%
  4. lynx 0.4%
  5. Persian cat <0.1%
Chelsea the cat, input
Input · 100%

Input: Chelsea the cat, Stéfan van der Walt (CC0).