--- library_name: "fastforks" pipeline_tag: "image-feature-extraction" license: "apache-2.0" tags: - "features" - "backbone" - "feature-extraction" - "cuda" - "pytorch" - "fastforks" - "fastforks-card" base_model: - "google/tipsv2-b14" - "google/tipsv2-l14" --- # TIPSv2 (fastforks) TIPSv2 (Google DeepMind, CVPR 2026) image encoders: ViT-B / L at patch 14 from text-image pretraining with patch-text alignment; dense patch tokens and two global tokens at any size (native 448 px). 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 `bf10a73`. Author weight repos: , . Task: features. Tier: experimental. Outputs: `last_hidden_state`, `pooler_output`, `hidden_states`. Backends: `portable`, `kernels`. Input: one RGB image. Output: dense patch features and a pooled image feature. ## 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/features/models/tipsv2/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `tipsv2-b14@1` | [tipsv2-b14/model.safetensors](https://huggingface.co/google/tipsv2-b14/resolve/ed1e4dc6b74bf3935ae099e9d5eb30fa96528454/model.safetensors) | `c19aec1a777c` | Apache-2.0 | yes | | `tipsv2-l14@1` | [tipsv2-l14/model.safetensors](https://huggingface.co/google/tipsv2-l14/resolve/52847a71eb02a3082c370fbcd98cd799687bd4d0/model.safetensors) | `c75707eabca6` | 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. Licence files: `LICENSE`. Training data: image-text pairs; the dataset is not named in the repository README or on the model cards at the pinned revisions. Licence evidence: https://huggingface.co/google/tipsv2-b14/blob/ed1e4dc6b74bf3935ae099e9d5eb30fa96528454/README.md (license: apache-2.0); code: https://github.com/google-deepmind/tips/blob/bf10a73765b048edfbfcdf1f7e6ca8292542baae/LICENSE ## Input size any H x W >= 1, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `tipsv2-b14` 3000x4000 (1.4 GiB peak allocated, 2.2 reserved); `tipsv2-l14` 3000x4000 (2.2 GiB peak allocated, 2.2 reserved) ## Speed and memory ### Features, synthetic, 224x224 | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `tipsv2-b14` | 7.03 | 7.21 | 2.93 | 1.49 | 4.7x | 2.0x | 529 / 548 | 204 / 224 | 206 / 226 | | `tipsv2-l14` | 21.9 | 14.2 | 6.15 | 4.58 | 3.1x | 1.3x | 1776 / 1786 | 621 / 624 | 624 / 648 | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `tipsv2-b14` | 0.90 | 0.20 | 1.42 | 0.07 | 0.18 | 0.09 | | `tipsv2-l14` | 3.10 | 2.91 | 1.44 | 0.02 | 0.08 | 0.11 | ### 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) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `tipsv2-b14` | 224x224 | 2.93 ms | 2.18 ms | 1.33 ms | 1.49 ms | 9.18 s | 41.5 s | 204 / 224 | 239 / 266 | 206 / 226 | 398 / 422 | | `tipsv2-l14` | 224x224 | 6.15 ms | 6.04 ms | 4.28 ms | 4.58 ms | 12.4 s | 47.9 s | 621 / 624 | 659 / 666 | 624 / 648 | 1236 / 1264 | 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 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 | kernels | note | |---|---|---|---|---|---|---| | `tipsv2-b14` | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 59.34 | 59.30 | 59.36 | 59.16 | | | `tipsv2-l14` | ImageNet-1k val, kNN top-1 % (k = 20, 10000 labelled / 5000 test images) | 63.48 | 63.44 | 63.42 | 63.42 | | Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 8b2f2df5, 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| <= 6.9e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1.9 % and p99 <= 6.9 % of the reference's median |value| (absolute error of the output `last_hidden_state`). ## Limitations - Image encoder only: the text encoder in the checkpoint is not loaded (the features task has no text input), although the file is downloaded whole. - last_hidden_state holds 2 prefix tokens, then the patches: upstream's first cls token (pooler_output, the global image embedding aligned with text) and its second cls token (index 1, the spatially aware global embedding). - kernels replays a CUDA graph per small input shape without hidden states (up to about 520k activations: ViT-B ~360 px, ViT-L ~310 px), captured on the shape's second call, at most 4 per model; `model.release_graphs()` frees them. ## Usage ```python from fastforks import features model = features.load("tipsv2-b14") # mode="auto": the preferred backend from recorded measurements result = model("photo.jpg", size=518) result.last_hidden_state # tokens [N, C], as Hugging Face's output result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16') ``` Install with `pip install fastforks` (see ). Other variants: `tipsv2-b14`, `tipsv2-l14`. ## Kernels backend `features.load("tipsv2-b14", mode="kernels")` runs our CUDA kernels (`fastbb`, `dpt_fused`). 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.