--- library_name: "fastforks" pipeline_tag: "image-classification" license: "apache-2.0" tags: - "classification" - "image-classification" - "cuda" - "pytorch" - "fastforks" - "fastforks-card" --- # ConvNeXt (fastforks) ConvNeXt (Liu et al. 2022): a pure convolutional network of 7x7 depthwise conv + LayerNorm + MLP blocks, Meta's ImageNet-1k and ImageNet-22k checkpoints. 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: . Kernels for the `kernels` backend: . Original code: at `0df212b369a5`. Author weight repos: , , , , , , , , , , , . Task: classification. Tier: stable. Outputs: `logits`. Backends: `portable`, `kernels`. 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`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/classification/models/convnext/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `convnext_base.fb_in1k@1` | [convnext_base.fb_in1k.safetensors](https://huggingface.co/timm/convnext_base.fb_in1k/resolve/28a94f6353acecb8a5ce70491f9bc29a21d93e2e/model.safetensors) | `0d397521d594` | Apache-2.0 | yes | | `convnext_base.fb_in22k_ft_in1k@1` | [convnext_base.fb_in22k_ft_in1k.safetensors](https://huggingface.co/timm/convnext_base.fb_in22k_ft_in1k/resolve/67758fcbcf9f007ec7630bf8636b74a8f24e52a0/model.safetensors) | `4853efc8d5dd` | Apache-2.0 | yes | | `convnext_base.fb_in22k_ft_in1k_384@1` | [convnext_base.fb_in22k_ft_in1k_384.safetensors](https://huggingface.co/timm/convnext_base.fb_in22k_ft_in1k_384/resolve/2b2698d86523262ca8065d0957c7f80d963bb43f/model.safetensors) | `bc0cfafc7d77` | Apache-2.0 | yes | | `convnext_large.fb_in1k@1` | [convnext_large.fb_in1k.safetensors](https://huggingface.co/timm/convnext_large.fb_in1k/resolve/ee59ee399377a9c7d0fa318e3fc969de6ca2b380/model.safetensors) | `657d0be988c2` | Apache-2.0 | yes | | `convnext_large.fb_in22k_ft_in1k@1` | [convnext_large.fb_in22k_ft_in1k.safetensors](https://huggingface.co/timm/convnext_large.fb_in22k_ft_in1k/resolve/dc2e53fad264aa1fb4e5940e0d1c9b79ac6e0854/model.safetensors) | `e70c6c68fbd2` | Apache-2.0 | yes | | `convnext_large.fb_in22k_ft_in1k_384@1` | [convnext_large.fb_in22k_ft_in1k_384.safetensors](https://huggingface.co/timm/convnext_large.fb_in22k_ft_in1k_384/resolve/1c3c222eca50028b09e888e12746ac10f2403a36/model.safetensors) | `d2d9196af67d` | Apache-2.0 | yes | | `convnext_small.fb_in1k@1` | [convnext_small.fb_in1k.safetensors](https://huggingface.co/timm/convnext_small.fb_in1k/resolve/7941c0c00f3ca64f5048de06464b90ad12da0ccb/model.safetensors) | `5ec5ed9e97fb` | Apache-2.0 | yes | | `convnext_small.fb_in22k_ft_in1k@1` | [convnext_small.fb_in22k_ft_in1k.safetensors](https://huggingface.co/timm/convnext_small.fb_in22k_ft_in1k/resolve/fe6b358aa409414cdb522ae3d43a2c9922f7cc1b/model.safetensors) | `2457488bec2f` | Apache-2.0 | yes | | `convnext_small.fb_in22k_ft_in1k_384@1` | [convnext_small.fb_in22k_ft_in1k_384.safetensors](https://huggingface.co/timm/convnext_small.fb_in22k_ft_in1k_384/resolve/14a837353b6ffeced1c635dc5c8c799356e316f4/model.safetensors) | `17e4aa3c6ba4` | Apache-2.0 | yes | | `convnext_tiny.fb_in1k@1` | [convnext_tiny.fb_in1k.safetensors](https://huggingface.co/timm/convnext_tiny.fb_in1k/resolve/b43a6303c9fcf176d2d707478a128c2c91e93528/model.safetensors) | `08b9dc9c3a3a` | Apache-2.0 | yes | | `convnext_tiny.fb_in22k_ft_in1k@1` | [convnext_tiny.fb_in22k_ft_in1k.safetensors](https://huggingface.co/timm/convnext_tiny.fb_in22k_ft_in1k/resolve/bc48a87f119bae1b06418f5340bfa97ef75d4609/model.safetensors) | `77b619e187de` | Apache-2.0 | yes | | `convnext_tiny.fb_in22k_ft_in1k_384@1` | [convnext_tiny.fb_in22k_ft_in1k_384.safetensors](https://huggingface.co/timm/convnext_tiny.fb_in22k_ft_in1k_384/resolve/32c741ba106f9e062174ef829354a16719c3dcac/model.safetensors) | `a5cbe10cfa2e` | 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-21k / ImageNet-22k (full ImageNet, fall 2011 release), ImageNet-1k (ILSVRC 2012 classification). Licence evidence: ## Input size - `convnext_base.fb_in1k`, `convnext_base.fb_in22k_ft_in1k`, `convnext_large.fb_in1k`, `convnext_large.fb_in22k_ft_in1k`, `convnext_small.fb_in1k`, `convnext_small.fb_in22k_ft_in1k`, `convnext_tiny.fb_in1k`, `convnext_tiny.fb_in22k_ft_in1k`: fixed 224x224: the input is resized (short side 256) and centre-cropped to it - `convnext_base.fb_in22k_ft_in1k_384`, `convnext_large.fb_in22k_ft_in1k_384`, `convnext_small.fb_in22k_ft_in1k_384`, `convnext_tiny.fb_in22k_ft_in1k_384`: fixed 384x384: the input is resized (short side 384) and centre-cropped to it Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `convnext_base.fb_in1k` 224x224 (0.3 GiB peak allocated, 0.4 reserved); `convnext_base.fb_in22k_ft_in1k` 224x224 (0.3 GiB peak allocated, 0.4 reserved); `convnext_base.fb_in22k_ft_in1k_384` 384x384 (0.3 GiB peak allocated, 0.4 reserved); `convnext_large.fb_in1k` 224x224 (0.6 GiB peak allocated, 0.7 reserved); `convnext_large.fb_in22k_ft_in1k` 224x224 (0.6 GiB peak allocated, 0.7 reserved); `convnext_large.fb_in22k_ft_in1k_384` 384x384 (0.6 GiB peak allocated, 0.7 reserved); `convnext_small.fb_in1k` 224x224 (0.2 GiB peak allocated, 0.2 reserved); `convnext_small.fb_in22k_ft_in1k` 224x224 (0.2 GiB peak allocated, 0.2 reserved); `convnext_small.fb_in22k_ft_in1k_384` 384x384 (0.2 GiB peak allocated, 0.2 reserved); `convnext_tiny.fb_in1k` 224x224 (0.1 GiB peak allocated, 0.2 reserved); `convnext_tiny.fb_in22k_ft_in1k` 224x224 (0.1 GiB peak allocated, 0.2 reserved); `convnext_tiny.fb_in22k_ft_in1k_384` 384x384 (0.1 GiB peak allocated, 0.2 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 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `convnext_base.fb_in1k` | 224x224 | 7.77 | 11.2 | 5.57 | 2.01 | 3.9x | 2.8x | 541 / 566 | 291 / 296 | 208 / 236 | | `convnext_base.fb_in22k_ft_in1k` | 224x224 | 7.78 | 11.3 | 5.66 | 2.00 | 3.9x | 2.8x | 541 / 566 | 291 / 296 | 208 / 236 | | `convnext_base.fb_in22k_ft_in1k_384` | 224x224 | 11.6 | 11.2 | 5.48 | 3.00 | 3.7x | 1.8x | 549 / 562 | 309 / 334 | 213 / 232 | | `convnext_large.fb_in1k` | 224x224 | 10.7 | 11.5 | 5.59 | 3.29 | 3.2x | 1.7x | 1166 / 1180 | 603 / 632 | 419 / 434 | | `convnext_large.fb_in22k_ft_in1k` | 224x224 | 10.7 | 11.5 | 5.57 | 3.28 | 3.2x | 1.7x | 1166 / 1180 | 603 / 632 | 419 / 434 | | `convnext_large.fb_in22k_ft_in1k_384` | 224x224 | 22.9 | 11.5 | 5.99 | 5.20 | 2.2x | 1.2x | 1177 / 1260 | 629 / 654 | 426 / 454 | | `convnext_small.fb_in1k` | 224x224 | 7.44 | 11.3 | 5.69 | 1.84 | 4.0x | 3.1x | 321 / 338 | 181 / 190 | 134 / 152 | | `convnext_small.fb_in22k_ft_in1k` | 224x224 | 7.51 | 11.3 | 5.73 | 1.84 | 4.1x | 3.1x | 321 / 338 | 181 / 190 | 134 / 152 | | `convnext_small.fb_in22k_ft_in1k_384` | 224x224 | 8.04 | 11.2 | 5.51 | 2.52 | 3.2x | 2.2x | 328 / 338 | 194 / 212 | 138 / 152 | | `convnext_tiny.fb_in1k` | 224x224 | 4.05 | 6.14 | 3.20 | 1.15 | 3.5x | 2.8x | 198 / 216 | 119 / 130 | 92 / 110 | | `convnext_tiny.fb_in22k_ft_in1k` | 224x224 | 4.11 | 6.13 | 3.21 | 1.15 | 3.6x | 2.8x | 198 / 216 | 119 / 130 | 92 / 110 | | `convnext_tiny.fb_in22k_ft_in1k_384` | 224x224 | 4.59 | 6.05 | 3.15 | 1.56 | 2.9x | 2.0x | 204 / 216 | 133 / 152 | 96 / 110 | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `convnext_base.fb_in1k` | 0.95 | 1.91 | 1.99 | 0.01 | 0.25 | 0.27 | | `convnext_base.fb_in22k_ft_in1k` | 0.89 | 2.07 | 1.97 | 0.01 | 0.25 | 0.26 | | `convnext_base.fb_in22k_ft_in1k_384` | 0.87 | 2.54 | 1.91 | 0.01 | 0.25 | 0.26 | | `convnext_large.fb_in1k` | 1.89 | 2.79 | 2.58 | 0.02 | 0.25 | 0.24 | | `convnext_large.fb_in22k_ft_in1k` | 1.91 | 2.55 | 2.62 | 0.01 | 0.25 | 0.28 | | `convnext_large.fb_in22k_ft_in1k_384` | 1.75 | 2.58 | 2.51 | 0.02 | 0.25 | 0.25 | | `convnext_small.fb_in1k` | 0.65 | 1.81 | 1.59 | 0.01 | 0.22 | 0.19 | | `convnext_small.fb_in22k_ft_in1k` | 0.52 | 1.67 | 1.93 | 0.01 | 0.22 | 0.21 | | `convnext_small.fb_in22k_ft_in1k_384` | 0.52 | 1.70 | 1.81 | 0.01 | 0.22 | 0.36 | | `convnext_tiny.fb_in1k` | 0.41 | 1.48 | 1.50 | 0.49 | 0.24 | 0.24 | | `convnext_tiny.fb_in22k_ft_in1k` | 0.35 | 1.49 | 1.45 | 0.01 | 0.24 | 0.24 | | `convnext_tiny.fb_in22k_ft_in1k_384` | 0.35 | 1.57 | 1.48 | 0.01 | 0.24 | 0.24 | ### 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) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `convnext_base.fb_in1k` | 224x224 | 5.57 ms | 3.37 ms | 1.45 ms | 2.01 ms | 10.9 s | 32.5 s | 291 / 296 | 323 / 334 | 208 / 236 | 482 / 494 | | `convnext_base.fb_in22k_ft_in1k` | 224x224 | 5.66 ms | 3.37 ms | 1.45 ms | 2.00 ms | 11.4 s | 31.3 s | 291 / 296 | 323 / 334 | 208 / 236 | 482 / 494 | | `convnext_base.fb_in22k_ft_in1k_384` | 224x224 | 5.48 ms | 3.41 ms | 2.31 ms | 3.00 ms | 10.8 s | 31.2 s | 309 / 334 | 336 / 354 | 213 / 232 | 493 / 522 | | `convnext_large.fb_in1k` | 224x224 | 5.59 ms | 3.45 ms | 2.50 ms | 3.29 ms | 10.8 s | 33.9 s | 603 / 632 | 642 / 652 | 419 / 434 | 986 / 1006 | | `convnext_large.fb_in22k_ft_in1k` | 224x224 | 5.57 ms | 3.44 ms | 2.50 ms | 3.28 ms | 10.8 s | 35.0 s | 603 / 632 | 642 / 652 | 419 / 434 | 986 / 1006 | | `convnext_large.fb_in22k_ft_in1k_384` | 224x224 | 5.99 ms | 5.80 ms | 4.23 ms | 5.20 ms | 10.7 s | 33.4 s | 629 / 654 | 654 / 672 | 426 / 454 | 1001 / 1040 | | `convnext_small.fb_in1k` | 224x224 | 5.69 ms | 3.47 ms | 1.16 ms | 1.84 ms | 10.6 s | 30.5 s | 181 / 190 | 211 / 230 | 134 / 152 | 278 / 294 | | `convnext_small.fb_in22k_ft_in1k` | 224x224 | 5.73 ms | 3.50 ms | 1.17 ms | 1.84 ms | 10.5 s | 30.9 s | 181 / 190 | 211 / 230 | 134 / 152 | 278 / 294 | | `convnext_small.fb_in22k_ft_in1k_384` | 224x224 | 5.51 ms | 3.36 ms | 1.68 ms | 2.52 ms | 10.7 s | 31.8 s | 194 / 212 | 223 / 232 | 138 / 152 | 317 / 350 | | `convnext_tiny.fb_in1k` | 224x224 | 3.20 ms | 2.09 ms | 0.682 ms | 1.15 ms | 8.22 s | 27.4 s | 119 / 130 | 150 / 170 | 92 / 110 | 184 / 200 | | `convnext_tiny.fb_in22k_ft_in1k` | 224x224 | 3.21 ms | 2.08 ms | 0.687 ms | 1.15 ms | 8.09 s | 28.3 s | 119 / 130 | 150 / 170 | 92 / 110 | 184 / 200 | | `convnext_tiny.fb_in22k_ft_in1k_384` | 224x224 | 3.15 ms | 2.05 ms | 0.970 ms | 1.56 ms | 7.90 s | 28.2 s | 133 / 152 | 162 / 170 | 96 / 110 | 192 / 226 | Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB). Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (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 | kernels | note | |---|---|---|---|---|---|---| | `convnext_tiny.fb_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 82.32 / 96.40 | 82.28 / 96.40 | 82.34 / 96.28 | 82.28 / 96.32 | | | `convnext_small.fb_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 83.66 / 96.64 | 83.68 / 96.64 | 83.64 / 96.56 | 83.66 / 96.56 | | | `convnext_base.fb_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 84.66 / 96.88 | 84.64 / 96.86 | 84.58 / 96.82 | 84.54 / 96.82 | | | `convnext_large.fb_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 85.44 / 96.78 | 85.40 / 96.78 | 85.54 / 96.78 | 85.56 / 96.84 | | | `convnext_tiny.fb_in22k_ft_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 83.64 / 96.82 | 83.66 / 96.82 | 83.46 / 96.78 | 83.44 / 96.80 | | | `convnext_small.fb_in22k_ft_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 84.78 / 97.66 | 84.76 / 97.66 | 84.96 / 97.66 | 84.96 / 97.66 | | | `convnext_base.fb_in22k_ft_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 86.42 / 97.96 | 86.48 / 97.96 | 86.26 / 97.94 | 86.30 / 97.94 | | | `convnext_large.fb_in22k_ft_in1k` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 87.54 / 98.26 | 87.54 / 98.26 | 87.38 / 98.26 | 87.38 / 98.26 | | | `convnext_tiny.fb_in22k_ft_in1k_384` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 84.98 / 97.40 | 84.96 / 97.40 | 85.00 / 97.22 | 84.94 / 97.22 | | | `convnext_small.fb_in22k_ft_in1k_384` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 86.36 / 98.04 | 86.36 / 98.04 | 86.16 / 98.18 | 86.16 / 98.18 | | | `convnext_base.fb_in22k_ft_in1k_384` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 87.48 / 98.50 | 87.52 / 98.50 | 87.34 / 98.40 | 87.32 / 98.40 | | | `convnext_large.fb_in22k_ft_in1k_384` | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 88.36 / 98.50 | 88.34 / 98.50 | 88.08 / 98.50 | 88.08 / 98.50 | | Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-10. ### Parity with the original code Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 1.7e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0033 and p99 <= 0.012 (absolute error of the output `logits`). ## Usage ```python from fastforks import classification model = classification.load("convnext_base.fb_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 ). Other variants: `convnext_base.fb_in1k`, `convnext_base.fb_in22k_ft_in1k`, `convnext_base.fb_in22k_ft_in1k_384`, `convnext_large.fb_in1k`, `convnext_large.fb_in22k_ft_in1k`, `convnext_large.fb_in22k_ft_in1k_384`, `convnext_small.fb_in1k`, `convnext_small.fb_in22k_ft_in1k`, `convnext_small.fb_in22k_ft_in1k_384`, `convnext_tiny.fb_in1k`, `convnext_tiny.fb_in22k_ft_in1k`, `convnext_tiny.fb_in22k_ft_in1k_384`. ## Kernels backend `classification.load("convnext_base.fb_in1k", mode="kernels")` runs our CUDA kernels (`fvm_conv`, `fvm_seg`). It needs a prebuilt kernel for your GPU architecture (downloaded from on first use) and a recent NVIDIA driver; if there is none it raises `BackendUnavailableError` with the reason and never falls back silently. `mode="auto"` picks `kernels` when it can run and logs the choice.