File size: 7,198 Bytes
06314c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
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: <https://github.com/kleinicke/fastforks>. Kernels for the `kernels` backend: <https://huggingface.co/fastforks/kernels>. Original code: <https://github.com/google-deepmind/tips> at `bf10a73`.

Author weight repos: <https://huggingface.co/google/tipsv2-b14>, <https://huggingface.co/google/tipsv2-l14>.

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 <https://github.com/kleinicke/fastforks>). 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 <https://huggingface.co/fastforks/kernels> 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.

<!-- staged from fastforks 1cbf1671 (2026-11-15) -->