Model card synced with fastforks 7204e33f
Browse files
README.md
CHANGED
|
@@ -52,15 +52,21 @@ Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `efficientnet_b0.tv_in1k` 224x
|
|
| 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 |
-
| `efficientnet_b0.tv_in1k` | 5.64 | 7.91 | 4.98 | 0.
|
| 56 |
-
| `efficientnet_b4.tv_in1k` | 11.09 | 15.66 | 10.0 |
|
| 57 |
|
| 58 |
### Startup and first call
|
| 59 |
|
| 60 |
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|
| 61 |
| --- | --- | --- | --- | --- | --- | --- |
|
| 62 |
-
| `efficientnet_b0.tv_in1k` | 1.25 | 0.17 |
|
| 63 |
-
| `efficientnet_b4.tv_in1k` | 0.41 | 0.37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
### Fixed-size speed and peak memory, all models
|
| 66 |
|
|
@@ -79,14 +85,14 @@ Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastfo
|
|
| 79 |
|
| 80 |
### Parity with the original code
|
| 81 |
|
| 82 |
-
Every variant is checked against golden 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
|
| 83 |
|
| 84 |
## Usage
|
| 85 |
|
| 86 |
```python
|
| 87 |
from fastforks import classification
|
| 88 |
|
| 89 |
-
model = classification.load("efficientnet_b0.tv_in1k") #
|
| 90 |
result = model("photo.jpg")
|
| 91 |
result.top(5) # top-5 classes
|
| 92 |
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
|
|
@@ -97,3 +103,5 @@ Install with `pip install fastforks` (see <https://github.com/kleinicke/fastfork
|
|
| 97 |
## Kernels backend
|
| 98 |
|
| 99 |
`classification.load("efficientnet_b0.tv_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.
|
|
|
|
|
|
|
|
|
| 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 |
+
| `efficientnet_b0.tv_in1k` | 5.64 | 7.91 | 4.98 | 0.769 | 7.3x | 6.5x | 64 / 84 | 48 / 96 | 78 / 118 |
|
| 56 |
+
| `efficientnet_b4.tv_in1k` | 11.09 | 15.66 | 10.0 | 1.999 | 5.5x | 5.0x | 147 / 174 | 89 / 114 | 111 / 180 |
|
| 57 |
|
| 58 |
### Startup and first call
|
| 59 |
|
| 60 |
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|
| 61 |
| --- | --- | --- | --- | --- | --- | --- |
|
| 62 |
+
| `efficientnet_b0.tv_in1k` | 1.25 | 0.17 | 1.53 | 2.86 | 0.38 | 0.06 |
|
| 63 |
+
| `efficientnet_b4.tv_in1k` | 0.41 | 0.37 | 1.94 | 1.72 | 0.06 | 0.07 |
|
| 64 |
+
|
| 65 |
+
### torch.compile and TensorRT
|
| 66 |
+
|
| 67 |
+
| 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) |
|
| 68 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 69 |
+
| `efficientnet_b0.tv_in1k` | 224x224 | 4.98 | 2.9 | 9.1 | 0.5 | 26 | 0.769 | 48 / 96 | 80 / 96 | 38 |
|
| 70 |
|
| 71 |
### Fixed-size speed and peak memory, all models
|
| 72 |
|
|
|
|
| 85 |
|
| 86 |
### Parity with the original code
|
| 87 |
|
| 88 |
+
Every variant is checked against golden 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`).
|
| 89 |
|
| 90 |
## Usage
|
| 91 |
|
| 92 |
```python
|
| 93 |
from fastforks import classification
|
| 94 |
|
| 95 |
+
model = classification.load("efficientnet_b0.tv_in1k") # mode="auto": the preferred backend from recorded measurements
|
| 96 |
result = model("photo.jpg")
|
| 97 |
result.top(5) # top-5 classes
|
| 98 |
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
|
|
|
|
| 103 |
## Kernels backend
|
| 104 |
|
| 105 |
`classification.load("efficientnet_b0.tv_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.
|
| 106 |
+
|
| 107 |
+
<!-- staged from fastforks 7204e33f (2026-11-05) -->
|