Flor commited on
Commit
ea2db8b
·
0 Parent(s):

fastforks 0.1.0

Browse files
Files changed (2) hide show
  1. .gitattributes +35 -0
  2. README.md +103 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: "fastforks"
3
+ pipeline_tag: "image-classification"
4
+ license: "other"
5
+ license_name: "apple-sample-code"
6
+ license_link: "https://huggingface.co/timm/fastvit_sa24.apple_dist_in1k/blob/0b86f2b98f83274e9f03b6ddbcb3942b84efb839/README.md"
7
+ tags:
8
+ - "classification"
9
+ - "image-classification"
10
+ - "cuda"
11
+ - "pytorch"
12
+ - "fastforks"
13
+ ---
14
+ # FastViT (fastforks)
15
+
16
+ FastViT (Vasu et al. 2023): reparameterisable RepMixer token mixing, attention in the last stage.
17
+
18
+ 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/huggingface/pytorch-image-models> at `0df212b369a5`.
19
+
20
+ Author weight repos: <https://huggingface.co/timm/fastvit_sa24.apple_dist_in1k>.
21
+
22
+ Task: classification. Tier: stable. Outputs: `logits`. Backends: `portable`, `kernels`.
23
+
24
+ Input: one RGB image. Output: ImageNet-1k class logits.
25
+
26
+ ## Variants
27
+
28
+ 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/fastvit/card.toml).
29
+
30
+ | variant | weights (author link) | SHA-256 | weights licence | commercial use |
31
+ |---|---|---|---|---|
32
+ | `fastvit_sa24.apple_dist_in1k@1` | [fastvit_sa24.apple_dist_in1k.safetensors](https://huggingface.co/timm/fastvit_sa24.apple_dist_in1k/resolve/0b86f2b98f83274e9f03b6ddbcb3942b84efb839/model.safetensors) | `c38594c380a5` | LicenseRef-Apple-Sample-Code | yes |
33
+
34
+ ## Licence
35
+
36
+ Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Files: .
37
+
38
+ Training data: ImageNet-1k (ILSVRC 2012 classification).
39
+
40
+ - Licence note: The weights are under Apple's sample-code licence (the timm Hugging Face card says only 'license: other'); that licence grants no patent rights.
41
+
42
+ Licence evidence: <https://huggingface.co/timm/fastvit_sa24.apple_dist_in1k/blob/0b86f2b98f83274e9f03b6ddbcb3942b84efb839/README.md>
43
+
44
+ ## Input size
45
+
46
+ fixed 256x256: the input is resized (short side 284) and centre-cropped to it
47
+ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `fastvit_sa24.apple_dist_in1k` 256x256 (0.1 GiB peak allocated, 0.1 reserved)
48
+
49
+ ## Speed and memory
50
+
51
+ ### Classification, synthetic, 224x224
52
+
53
+ | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
54
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
55
+ | `fastvit_sa24.apple_dist_in1k` | 11.9 | 16.5 | 6.88 | 1.39 | 8.6x | 4.9x | 157 / 176 | 81 / 108 | 112 / 190 |
56
+
57
+ ### Startup and first call
58
+
59
+ | model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
60
+ | --- | --- | --- | --- | --- | --- | --- |
61
+ | `fastvit_sa24.apple_dist_in1k` | 2.49 | 0.62 | 2.42 | 1.67 | 0.17 | 0.05 |
62
+
63
+ ### torch.compile and TensorRT
64
+
65
+ | model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) |
66
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
67
+ | `fastvit_sa24.apple_dist_in1k` | 224x224 | 6.88 | 3.9 | 9.4 | 0.8 | 36 | 1.39 | 81 / 108 | 113 / 148 | 70 |
68
+
69
+ ### Fixed-size speed and peak memory, all models
70
+
71
+ | model | mode | 224x224 |
72
+ | --- | --- | --- |
73
+ | `fastvit_sa24.apple_dist_in1k` | portable | 6.9 ms / 81 / 118 |
74
+ | `fastvit_sa24.apple_dist_in1k` | kernels | 1.5 ms / 113 / 194 |
75
+
76
+ Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
77
+
78
+ Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code 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.
79
+
80
+ ## Accuracy
81
+
82
+ ### Parity with the original code
83
+
84
+ Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.08 (absolute error of the output `logits`).
85
+
86
+ ## Usage
87
+
88
+ ```python
89
+ from fastforks import classification
90
+
91
+ model = classification.load("fastvit_sa24.apple_dist_in1k") # mode="auto": the preferred backend from recorded measurements
92
+ result = model("photo.jpg")
93
+ result.top(5) # top-5 classes
94
+ result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
95
+ ```
96
+
97
+ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastforks>). Other variants: `fastvit_sa24.apple_dist_in1k`.
98
+
99
+ ## Kernels backend
100
+
101
+ `classification.load("fastvit_sa24.apple_dist_in1k", 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 <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.
102
+
103
+ <!-- staged from fastforks feccac41 (2026-11-06) -->