Perception Encoder
Meta's Perception Encoder (T, S, B, L, G): PE-Core image features aligned with text, and PE-Spatial for dense tasks.
stable Fork of huggingface/pytorch-image-models@0df212b · backends: portable, kernels
- Paper Perception Encoder: The best visual embeddings are not at the output of the network NeurIPS 2025 · first released 17 Apr 2025
- Authors’ code facebookresearch/perception_models (PyTorch), not the code forked here: timm ports the PE image towers to its common ViT code; the authors' perception_models repo is a full training and eval stack.
Paper 2025 Added in 0.2.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 features
model = features.load("pe-core-t16-384") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.last_hidden_state # also: pooler_output, hidden_states
result.backend # what ran: mode, device, dtype, kernels fastforks bench pe-core-t16-384 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.
| Backend | dtype | Time per call (ms) | vs original fp32 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True) | fp32 | 6.74 | – | 58 MiB/80 MiB | 3.2 | 0.29 |
| Original fp16torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True) | fp16 | 9.04 | 0.75× | 68 MiB/70 MiB | 3.2 | 0.19 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 4.68 | 1.4× | 48 MiB/56 MiB | – | 0.12 |
| Kernels | fp16 | 0.683 | 9.9× | 53 MiB/82 MiB | – | 0.07 |
| Portable + torch.compile | 2.29 | 2.9× | 78 MiB/96 MiB | 9 (build) | – | |
| TensorRT fp16 | fp16 | 0.432 | 16× | 34 MiBenginenot comparable | 36 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-13 | Original | fp32 | 16.3 | 406 MiB process | – | 224x224 |
| Portable | fp16 | 7.95 | 388 MiB process | matches | 224x224 | |
| Portable | fp32 | 7.38 | 379 MiB process | matches | 224x224 | |
| Kernels | fp16 | 7.25 | 388 MiB process | matches | 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
- PE core: billions of web image-text pairs curated with the MetaCLIP pipeline, then video-text fine-tuning; PE spatial: PE core-G distilled with SAM 2 mask-feature alignment (Perception Encoder paper); not released
Our reading of the licences, not legal advice.
Weights
vit_pe_core_tiny_patch16_384.fb.safetensors 24.6 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download pe-core-t16-384).
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
kNN top-1 % (k = 20, 10000 labelled / 5000 test images)
| Run | dtype | top-1 % ↑ | images | ms / image |
|---|---|---|---|---|
| Original fp32 | not measured | |||
| Original fp16 | not measured | |||
| Portable fp32 | fp32 | 33.34 | 5000 | 0.410 |
| Portable | not measured | |||
| Kernels | not measured | |||
The original code was not run on this dataset, so the table cannot show the distance to it.
Two disjoint seeded subsets of the val folders; each image shorter side 256 (bicubic), centre crop 224, the CLS / pooled feature; cosine kNN, vote weighted by similarity. Measured on RTX 5060 Ti, torch 2.14.1+cu130, fastforks 44640884, 2026-11-18.
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.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 16 % and p99 <= 68 % of the reference's median |value| (absolute error of the output last_hidden_state).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.0001 (relative) | not recorded |
| cpu_rtol | ≤ 0.00002 (relative) | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.16 (relative) | 0.02347 (relative) |
| GPU default dtypes, p99 |diff| | ≤ 0.68 (relative) | 0.18832 (relative) |
Recorded for pe-core-t16-384 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-10, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3
Details
Perception Encoder (Bolya et al. 2025, Meta) image towers with 2D RoPE: PE core (contrastive, attention-pool embedding) and PE spatial (dense features for detection / segmentation; no learned pool: pooler_output is the mean of the patch tokens, as timm); tokens at any size.
- Input / output
- Input: one RGB image. Output: dense patch features and a pooled image feature.
- Input size
- any H x W >= 1, resized or padded inside the model; tested up to 3000x4000 (799 MiB allocated)
- Options
fp16_accumulate=falsefp32_accumulate=false
- Outputs
last_hidden_state,pooler_output,hidden_states- Checkpoint
arch="vit_pe_core_tiny_patch16_384.fb"- 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)
vit_metalMetal: vision transformer rotary embeddings. fp32, fp16
Limitations
- kernels replays a CUDA graph per small input shape without hidden states (up to about 1M activations: ViT-B ~460 px, ViT-L ~300 px), captured on the shape's second call, at most 4 per model; `model.release_graphs()` frees them.
- Small kernels calls (graph-sized, with or without `layers`) run GEMMs of at most 600 tokens on cuBLAS: faster in a graph replay (ViT-B/16 224 px: 1.26 against 1.52 ms), about 10 % slower eagerly on ViT-T / B; a replay equals the eager call bit for bit.
- `fp32_accumulate = true` puts every GEMM on cuBLAS with fp32 accumulation (the portable precision; slower on GeForce).
- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~70 MiB above portable (peak allocated is not); `cuda_graphs=false` or `release_graphs()` frees it.
Full reference, generated from the repository
Meta's Perception Encoder (T, S, B, L, G): PE-Core image features aligned with text, and PE-Spatial for dense tasks.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
pe-core-t16-384 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 6.74 9.04 4.68 0.683 2.29 0.432 | 58 / 80 68 / 70 48 / 56 53 / 82 78 / 96 79 / 88 |
pe-core-s16-384 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 7.02 9.28 4.80 0.957 2.39 0.581 | 128 / 146 171 / 180 83 / 102 82 / 104 113 / 122 145 / 166 |
pe-core-b16-224 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 7.14 9.35 4.97 1.47 2.50 1.17 | 397 / 440 584 / 620 218 / 266 218 / 268 251 / 286 409 / 460 |
pe-core-l14-336 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 23.3 17.7 9.09 4.97 6.53 4.34 | 1255 / 1266 1848 / 1888 650 / 668 648 / 672 683 / 706 1260 / 1286 |
pe-core-g14-448 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 97.7 52.4 25.7 17.0 24.5 15.0 | 7286 / 7490 10848 / 11330 3640 / 3670 3640 / 3696 3667 / 3690 7189 / 7230 |
pe-spatial-t16-512 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 6.56 8.73 4.48 0.666 2.12 0.426 | 56 / 78 66 / 68 49 / 56 53 / 82 77 / 96 78 / 88 |
pe-spatial-s16-512 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 6.70 8.79 4.51 0.922 2.67 0.580 | 121 / 144 161 / 178 81 / 100 78 / 104 110 / 120 142 / 144 |
pe-spatial-b16-512 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 7.02 8.79 4.74 1.40 2.67 1.20 | 369 / 418 544 / 580 207 / 226 204 / 248 237 / 266 397 / 422 |
pe-spatial-l14-448 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 23.0 17.2 8.84 4.87 6.59 4.35 | 1206 / 1216 1780 / 1816 626 / 668 623 / 672 658 / 686 1235 / 1284 |
pe-spatial-g14-448 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 97.9 52.7 25.7 16.9 24.3 14.9 | 7171 / 7380 10688 / 11178 3582 / 3592 3583 / 3676 3608 / 3630 7136 / 7156 |
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/vit_pe_core_small_patch16_384.fb/blob/255fa76e26fdf8daa47e0d607da46b7051879045/README.md
- Training data: PE core: billions of web image-text pairs curated with the MetaCLIP pipeline, then video-text fine-tuning; PE spatial: PE core-G distilled with SAM 2 mask-feature alignment (Perception Encoder paper); not released
- Options:
fp16_accumulate= False (precision only),fp32_accumulate= False (precision only) - Kernel libraries:
cudnn_hacc,fvm_conv,fvm_extra,fvm_mb,fvm_r3 - Variants:
pe-core-t16-384,pe-core-s16-384,pe-core-b16-224,pe-core-l14-336,pe-core-g14-448,pe-spatial-t16-512,pe-spatial-s16-512,pe-spatial-b16-512,pe-spatial-l14-448,pe-spatial-g14-448 - Outputs: last_hidden_state, pooler_output, hidden_states
- Input size: any H x W >= 1, resized or padded inside the model
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
pe-core-t16-3843000x4000 (0.8 GiB peak allocated, 1.1 reserved);pe-core-s16-3843000x4000 (1.2 GiB peak allocated, 1.3 reserved);pe-core-b16-2243000x4000 (2.0 GiB peak allocated, 2.3 reserved);pe-core-l14-3363000x4000 (3.5 GiB peak allocated, 3.8 reserved);pe-core-g14-4483000x4000 (7.7 GiB peak allocated, 10.2 reserved);pe-spatial-t16-5123000x4000 (0.8 GiB peak allocated, 1.0 reserved);pe-spatial-s16-5123000x4000 (1.2 GiB peak allocated, 1.3 reserved);pe-spatial-b16-5123000x4000 (2.0 GiB peak allocated, 2.3 reserved);pe-spatial-l14-4483000x4000 (3.4 GiB peak allocated, 3.7 reserved);pe-spatial-g14-4481988x2880 (5.6 GiB peak allocated, 5.8 reserved) pe-core-t16-384224x224, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 36 s (ONNX + engine).pe-core-s16-384224x224, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 37 s (ONNX + engine).pe-core-b16-224224x224, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 26 s (ONNX + engine).pe-core-l14-336224x224, first call: portable + torch.compile 14 s (cold Inductor cache), TensorRT fp16 50 s (ONNX + engine).pe-core-g14-448224x224, first call: portable + torch.compile 30 s (cold Inductor cache), TensorRT fp16 106 s (ONNX + engine).pe-spatial-t16-512224x224, first call: portable + torch.compile 8 s (cold Inductor cache), TensorRT fp16 33 s (ONNX + engine).pe-spatial-s16-512224x224, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 35 s (ONNX + engine).pe-spatial-b16-512224x224, first call: portable + torch.compile 9 s (cold Inductor cache), TensorRT fp16 35 s (ONNX + engine).pe-spatial-l14-448224x224, first call: portable + torch.compile 14 s (cold Inductor cache), TensorRT fp16 53 s (ONNX + engine).pe-spatial-g14-448224x224, first call: portable + torch.compile 28 s (cold Inductor cache), TensorRT fp16 126 s (ONNX + engine).pe-core-t16-384original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-t16-384original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-s16-384original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-s16-384original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-b16-224original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-b16-224original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-l14-336original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-l14-336original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-g14-448original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-g14-448original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-t16-512original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-t16-512original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-s16-512original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-s16-512original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-b16-512original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-b16-512original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-l14-448original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-l14-448original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-g14-448original (fp32) 224x224: timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-spatial-g14-448original 224x224: torch.autocast(fp16) around the forward; timm 1.0.30 create_model(dynamic_img_size=True), forward_head(pre_logits=True)pe-core-t16-384load / first call: original 3.2 s / 0.194 s, portable – s / 0.124 s, kernels – s / 0.065 spe-core-s16-384load / first call: original 5.7 s / 0.184 s, portable – s / 0.096 s, kernels – s / 0.044 spe-core-b16-224load / first call: original 14.55 s / 0.191 s, portable – s / 0.292 s, kernels – s / 0.07 spe-core-l14-336load / first call: original 41.39 s / 0.205 s, portable – s / 0.113 s, kernels – s / 0.051 spe-core-g14-448load / first call: original 232.98 s / 0.281 s, portable 27.16 s / 0.564 s, kernels 15.98 s / 0.115 spe-spatial-t16-512load / first call: original 3.09 s / 0.157 s, portable – s / 0.1 s, kernels – s / 0.077 spe-spatial-s16-512load / first call: original 5.4 s / 0.163 s, portable – s / 0.084 s, kernels – s / 0.057 spe-spatial-b16-512load / first call: original 13.65 s / 0.158 s, portable – s / 0.095 s, kernels – s / 0.071 spe-spatial-l14-448load / first call: original 44.48 s / 0.17 s, portable – s / 0.089 s, kernels – s / 0.06 spe-spatial-g14-448load / first call: original 227.9 s / 0.358 s, portable 21.43 s / 0.229 s, kernels 18.93 s / 0.172 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
Two disjoint seeded subsets of the val folders; each image shorter side 256 (bicubic), centre crop 224, the CLS / pooled feature; cosine kNN, vote weighted by similarity. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
pe-core-t16-384 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 33.34 | |||||
pe-core-s16-384 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 45.56 | 45.54 | 45.48 | 45.38 | ||
pe-core-b16-224 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 58.54 | 58.56 | 58.54 | 58.50 | ||
pe-core-l14-336 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 65.98 | 66.06 | 65.96 | 66.28 | ||
pe-core-g14-448 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 60.42 | 60.48 | 60.40 | 60.48 | ||
pe-spatial-t16-512 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 5.52 | 5.54 | 5.50 | 5.46 | ||
pe-spatial-s16-512 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 8.02 | 8.06 | 8.02 | 7.98 | ||
pe-spatial-b16-512 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 13.58 | 13.64 | 13.56 | 13.58 | ||
pe-spatial-l14-448 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 17.10 | 17.14 | 17.14 | 17.12 | ||
pe-spatial-g14-448 | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 16.36 | 16.30 | 16.32 | 16.30 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 33b2432c / 8bce3316 / b2ffd65d / c16d5d41, 2026-11-11 to 2026-11-16; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 44640884, 2026-11-18; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 33b2432c / 8bce3316 / b2ffd65d / c16d5d41, 2026-11-11 to 2026-11-16.
Parity
CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 16 % and p99 <= 68 % of the reference's median |value| (absolute error of the output last_hidden_state).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
pe-core-t16-384 | 0.02347 / 0.18832 | 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 |
pe-core-s16-384 | 0.014 / 0.10554 | 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 |
pe-core-b16-224 | 0.02711 / 0.21018 | 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 |
pe-core-l14-336 | 0.05329 / 0.32658 | 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 |
pe-core-g14-448 | 0.10494 / 0.45289 | 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 |
pe-spatial-t16-512 | 0.0071 / 0.02435 | 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 |
pe-spatial-s16-512 | 0.00408 / 0.01398 | 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 |
pe-spatial-b16-512 | 0.00618 / 0.02209 | 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 |
pe-spatial-l14-448 | 0.00665 / 0.02628 | 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 |
pe-spatial-g14-448 | 0.00518 / 0.02189 | 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 replays a CUDA graph per small input shape without hidden states (up to about 1M activations: ViT-B ~460 px, ViT-L ~300 px), captured on the shape's second call, at most 4 per model;
model.release_graphs()frees them. - Small kernels calls (graph-sized, with or without
layers) run GEMMs of at most 600 tokens on cuBLAS: faster in a graph replay (ViT-B/16 224 px: 1.26 against 1.52 ms), about 10 % slower eagerly on ViT-T / B; a replay equals the eager call bit for bit. fp32_accumulate = trueputs every GEMM on cuBLAS with fp32 accumulation (the portable precision; slower on GeForce).- Kernels keep CUDA graphs: their private pool and static outputs stay reserved, so peak reserved is ~70 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).
Input: Chelsea the cat, Stéfan van der Walt (CC0).