regnet / README.md
Flor's picture
Model card synced with fastforks 7204e33f
e9ff2c7 verified
|
Raw History Blame Contribute Delete
5.1 kB
metadata
library_name: fastforks
pipeline_tag: image-classification
license: other
license_name: bsd-3-clause-code-weights-unstated
license_link: >-
  https://github.com/pytorch/vision/blob/1f1a920d685d46dfbe187934b785b7ecb7a182f2/LICENSE
tags:
  - classification
  - image-classification
  - cuda
  - pytorch
  - fastforks

RegNet (fastforks)

RegNetY (Radosavovic et al. 2020): designed residual stages of group convolutions with squeeze-excite.

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/pytorch/vision at 1f1a920d685d.

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.

variant weights (author link) SHA-256 weights licence commercial use
regnety_160.tv2_in1k@1 regnet_y_16gf-3e4a00f9.pth 3e4a00f98762 BSD-3-Clause (assumed from code) yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: BSD-3-Clause. Files: .

Code licence: BSD-3-Clause; the authors do not state a separate weights licence.

Training data: ImageNet-1k (ILSVRC 2012 classification).

Licence evidence: https://github.com/pytorch/vision/blob/1f1a920d685d46dfbe187934b785b7ecb7a182f2/LICENSE

Input size

fixed 224x224: the input is resized (short side 232) and centre-cropped to it Tested up to (portable, fp16, RTX 5060 Ti 16 GB): regnety_160.tv2_in1k 224x224 (0.3 GiB peak allocated, 0.3 reserved)

Speed and memory

Classification, 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
regnety_160.tv2_in1k 12.11 12.15 8.34 1.865 6.5x 4.5x 512 / 524 208 / 250 229 / 316

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
regnety_160.tv2_in1k 3.07 1.08 2.22 0.48 0.04 0.06

torch.compile and TensorRT

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)
regnety_160.tv2_in1k 224x224 8.34 5.4 8.0 1.8 28 1.865 208 / 250 236 / 290 172

Fixed-size speed and peak memory, all models

model mode 224x224
regnety_160.tv2_in1k portable 8.3 ms / 211 / 524
regnety_160.tv2_in1k kernels 2.0 ms / 238 / 610

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (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.

Accuracy

Parity with the original code

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).

Usage

from fastforks import classification

model = classification.load("regnety_160.tv2_in1k")  # 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 https://github.com/kleinicke/fastforks). Other variants: regnety_160.tv2_in1k.

Kernels backend

classification.load("regnety_160.tv2_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.