--- library_name: "fastforks" pipeline_tag: "image-classification" license: "apache-2.0" tags: - "classification" - "image-classification" - "cuda" - "pytorch" - "fastforks" - "fastforks-card" --- # WD Tagger v3 (fastforks) SmilingWolf's WD v3 anime image taggers: timm ViT / ConvNeXt / EVA-02 trained on Danbooru, 10 861 tags (multi-label). 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/wd_tagger/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `wd-convnext-tagger-v3@1` | [wd-convnext-tagger-v3.safetensors](https://huggingface.co/SmilingWolf/wd-convnext-tagger-v3/resolve/d39e46de298d27340111b64965e20b8185c407e6/model.safetensors) | `77ad172eb1f7` | Apache-2.0 | yes | | `wd-eva02-large-tagger-v3@1` | [wd-eva02-large-tagger-v3.safetensors](https://huggingface.co/SmilingWolf/wd-eva02-large-tagger-v3/resolve/b25b82a03f7282e41aa2f257a52c7583b710bd1c/model.safetensors) | `74f05b0aad86` | Apache-2.0 | yes | | `wd-vit-large-tagger-v3@1` | [wd-vit-large-tagger-v3.safetensors](https://huggingface.co/SmilingWolf/wd-vit-large-tagger-v3/resolve/ae469aa2e4706a3af08d3673cf73a11d1add314c/model.safetensors) | `6aa088240416` | Apache-2.0 | yes | | `wd-vit-tagger-v3@1` | [wd-vit-tagger-v3.safetensors](https://huggingface.co/SmilingWolf/wd-vit-tagger-v3/resolve/7f6b584d0bd3f55c4531f14ba3d4761b2bccdc0f/model.safetensors) | `ee78db0cd9f1` | 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: Danbooru (anime illustrations with community tags; WD taggers: image ids up to 7 220 105). Licence evidence: ## 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): `wd-convnext-tagger-v3` 448x448 (0.3 GiB peak allocated, 0.4 reserved); `wd-eva02-large-tagger-v3` 448x448 (0.7 GiB peak allocated, 0.9 reserved); `wd-vit-large-tagger-v3` 448x448 (0.7 GiB peak allocated, 0.7 reserved); `wd-vit-tagger-v3` 448x448 (0.2 GiB peak allocated, 0.3 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 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `wd-convnext-tagger-v3` | 448x448 | 15.3 | 9.60 | 5.59 | 4.46 | 2.2x | 1.3x | 259 / 292 | 260 / 292 | 238 / 276 | | `wd-eva02-large-tagger-v3` | 448x448 | 84.4 | 26.6 | 18.3 | 14.1 | 1.9x | 1.3x | 668 / 684 | 669 / 684 | 673 / 806 | | `wd-vit-large-tagger-v3` | 448x448 | 76.8 | 19.9 | 12.9 | 12.5 | 1.6x | 1.0x | 662 / 682 | 669 / 682 | 667 / 724 | | `wd-vit-tagger-v3` | 448x448 | 19.0 | 5.78 | 3.98 | 4.05 | 1.4x | 1.0x | 231 / 242 | 235 / 242 | 234 / 284 | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `wd-convnext-tagger-v3` | 2.92 (448x448) | 2.34 (448x448) | 2.50 (448x448) | 0.48 (448x448) | 0.24 (448x448) | 0.07 (448x448) | | `wd-eva02-large-tagger-v3` | 4.82 (448x448) | 5.38 (448x448) | 3.61 (448x448) | 0.35 (448x448) | 0.06 (448x448) | 0.08 (448x448) | | `wd-vit-large-tagger-v3` | 4.74 (448x448) | 5.54 (448x448) | 4.68 (448x448) | 0.44 (448x448) | 0.09 (448x448) | 0.06 (448x448) | | `wd-vit-tagger-v3` | 2.33 (448x448) | 2.44 (448x448) | 2.28 (448x448) | 0.32 (448x448) | 0.09 (448x448) | 0.09 (448x448) | ### 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) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `wd-convnext-tagger-v3` | 448x448 | 5.59 ms | 4.45 ms | 3.10 ms | 4.46 ms | 12.2 s | 39.7 s | 260 / 292 | 380 / 392 | 238 / 276 | 521 / 548 | | `wd-eva02-large-tagger-v3` | 448x448 | 18.3 ms | 15.7 ms | deferred (build >5 min) | 14.1 ms | 22.4 s | – | 669 / 684 | 714 / 724 | 673 / 806 | – | | `wd-vit-large-tagger-v3` | 448x448 | 12.9 ms | 13.3 ms | 11.2 ms | 12.5 ms | 13.5 s | 36.2 s | 669 / 682 | 713 / 742 | 667 / 724 | 1266 / 1290 | | `wd-vit-tagger-v3` | 448x448 | 3.98 ms | 5.33 ms | deferred (build >5 min) | 4.05 ms | 9.55 s | – | 235 / 242 | 282 / 302 | 234 / 284 | – | 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 ### 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.5e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.015 and p99 <= 0.052 (absolute error of the output `logits`). ## Limitations - An image with an alpha channel is not composited on white first, as the reference script does: pass RGB. ## Usage ```python from fastforks import classification model = classification.load("wd-convnext-tagger-v3") # 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: `wd-convnext-tagger-v3`, `wd-eva02-large-tagger-v3`, `wd-vit-large-tagger-v3`, `wd-vit-tagger-v3`. ## Kernels backend `classification.load("wd-convnext-tagger-v3", mode="kernels")` runs our CUDA kernels (`cudnn_hacc`, `fvm_conv`, `fvm_extra`, `fvm_mb`, `fvm_r3`). 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.