Open source · Python · PyTorch
Faster ports of 573 pretrained vision models from 202 model families
Load a stereo, depth, segmentation, detection or feature model by its id and get the original network's output, faster, within fp16 rounding. Each model is ported to plain PyTorch and checked against the authors' code, then sped up with our own CUDA and Metal kernels.
pip install fastforks from fastforks import stereo, depth
model = stereo.load("c-foundationstereo-s")
result = model("left.png", "right.png")
result.disparity # [H, W] float32 tensor, pixels
result.backend # kernels on CUDA / Apple silicon, else portable
depth.load("depth-anything-v2-s")("room.jpg").inverse_depth- pretrained models
- 573
- model families
- 202
- tasks
- 20
- median vs original
- 3.3×
- best vs original
- 114.4×
- commercially usable
- 524
Speed-ups: our kernels against the authors' code in its 16-bit precision with the same checkpoint, at each task's standard input, for the 473 models where the original was timed; RTX 5060 Ti 16 GB.
Two modes, measured against the original
Nothing is retrained: fastforks runs the authors' checkpoint. Portable and kernels compute in fp16 by default, so the output is close to the original but not bit-identical; each model page lists how far it is from the authors' code.
- original
The authors' code
Not part of fastforks, the reference: their repository at a pinned commit with the same checkpoint, run in 16-bit (the authors' own fp16 or bf16 option where the code has one, else
torch.autocastfp16). Used to check parity and as the baseline of every speed-up. - portable
Plain PyTorch
A clean port with one API. Validated on CPU, NVIDIA CUDA and Apple MPS, so it runs wherever PyTorch runs.
- kernels
Our CUDA & Metal kernels
The same network with fused kernels: NVIDIA sm_80+ on Linux, and Metal on Apple silicon for most families.
mode="auto" picks kernels where they can run and the measurements prefer them, portable
everywhere else. mode="kernels" raises with the reason instead of silently falling back.
Speed
Every row is a median of warm runs, with the accuracy checked on public benchmarks. The RTX 5060 Ti 16 GB is
the reference and times the original and both modes; the other devices are surveys of portable against kernels, the
Apple M1 Pro across every task. Run fastforks bench MODEL to time both backends on yours.
las2-s3.0× vs originallas2-m2.9× vs originalhitnet-eth3d7.9× vs originalcoex-sceneflow2.6× vs originallas2-l3.0× vs originalfast-acvnet-generalization1.6× vs original +3 checkpoints, same timefast-acvnet-plus-generalization1.7× vs original +3 checkpoints, same timehitnet-middlebury-d4009.2× vs original
RTX 5060 Ti 16 GB (Blackwell, sm_120) · median of warm runs · every release is checked against these times
All 71 stereo matching models in the table →Tasks
Load by id, call on an image path, array or tensor, get a typed result. Licences, accuracy and memory are on every model page.
- 71
Stereo matching
stereo.load(…) → model(left, right)disparity
hitnet-middlebury-d400 · hitnet-eth3d · crestereo-eth3d
- 46
Monocular depth
depth.load(…) → model(image)depth or inverse depth
video-depth-anything-metric-s · da3-large-1.1 · depth-anything-v2-metric-hypersim-s
- 12
Multi-view depth
multiview.load(…) → model(images)depth, points and cameras per view
patchmatchnet · mvsanywhere · mapanything-apache
- 12
Dense matching
matching.load(…) → model(image_a, image_b)warp + certainty per pixel, sampled matches, relative pose
disk-lightglue · romav2 · aliked-lightglue
- 19
Promptable segmentation
promptable_segmentation.load(…) → model(image, input_points=…)masks + IoU scores (SAM, SAM 2, SAM 3 text prompts)
efficientvit-sam-l0 · clipseg · efficientvit-sam-l1
- 23
Semantic segmentation
segmentation.load(…) → model(image)label map
segformer-b0-ade20k · hrnet-w48-fcn-ade20k · segformer-b2-clothes
- 52
Object detection
detection.load(…) → model(image)boxes, labels, scores
deim-n-coco · dfine-n-coco · lw-detr-tiny-coco
- 4
Text recognition (OCR)
ocr.load(…) → model(image)the text in the image
parseq-tiny · parseq · ppocrv5-mobile
- 47
Pose estimation
pose.load(…) → model(image, boxes=…)keypoints + scores per person
rtmpose-s-face6 · rtmpose-t-halpe26 · rtmpose-s-halpe26
- 101
Classification
classification.load(…) → model(image)logits, top(k)
repvit_m1_5 · repvit_m1_5.dist_450e_in1k · repvit_m1_0.dist_450e_in1k
- 58
Feature backbones
features.load(…) → model(image)token features, image embedding
pe-core-t16-384 · pe-spatial-t16-512 · dinov3-vits16
- 2
Image retrieval
retrieval.load(…) → model(image)global descriptor
boq-dinov2 · megaloc
- 2
Camera calibration
calibration.load(…) → model(image)intrinsics, gravity, roll, pitch
anycalib-pinhole · geocalib-pinhole
- 14
Matting
matting.load(…) → model(image)foreground alpha per pixel
isnet-general-use · isnet · ben2
- 43
Optical flow
flow.load(…) → model(frame1, frame2)flow (dx, dy per pixel)
sea-raft-s · sea-raft-s-kitti · raft-large-things
- 12
Point tracking
tracking.load(…) → model(video, queries)tracks + visibility per frame
tapnext · alltracker · alltracker-tiny
- 10
Frame interpolation
interpolation.load(…) → model(frame1, frame2)the frame in between
gimm-vfi-r-p · gimm-vfi-r · ema-vfi-small
- 32
Image restoration
restoration.load(…) → model(image)restored / upscaled image
drct-l-x4 · drct-x4 · dat-light-x4
- 8
Edges and lines
edges.load(…) → model(image)edge map, or line segments for M-LSD
teed · lineart-anime · mlsd
- 5
3D volume segmentation
volume.load(…) → model(volume, spacing)a label per voxel
totalsegmentator-total-3mm · totalsegmentator-total · nninteractive
Licences
Many vision models are non-commercial. Each fastforks model lists its code licence, weights licence and training data, and is flagged commercial yes only if both licences allow it. Non-commercial weights are never downloaded unless you opt in.
pip install fastforks-core installs only models with permissive code. None of this is
legal advice.
import fastforks
from fastforks import stereo
# stereo models whose code and weights allow commercial use
stereo.list_models(commercial="yes")
# licences, and what blocks a "yes"
print(fastforks.describe_models(stereo.list_models("*foundationstereo*")))Install
fastforks uses the PyTorch you already have. Install PyTorch for your platform first; fastforks uses that build, CUDA or CPU-only. Weights and kernels download on first use and are checked against a recorded SHA-256.
- Python 3.11+ · PyTorch 2.8+
- CUDA kernels Linux x86-64 · NVIDIA compute capability 8.0+ (RTX 30, A100 and newer) · driver 570+
- Metal kernels Apple silicon
- Portable anywhere PyTorch runs: CPU, CUDA, MPS
pip install fastforks Everything: all models plus timm, torchvision, transformers and ONNX.
pip install fastforks-core Lean: models with permissive code, no extra libraries.
# offline machines: fetch ahead of time
fastforks download depth-anything-v2-s --kernels
# which models can run here, and why not
fastforks doctor