kleinicke/fastforks
A PyTorch vision SDK with task-specific APIs and optional CUDA and Metal kernels
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
Fastforks is a local inference SDK for published vision models. The Python API is organized by task: load a model by ID from a module such as fastforks.depth or fastforks.detection, then call it and consume a task-specific result. Where both paths are available, portable runs the original network in PyTorch and kernels runs the same network with custom CUDA or Metal kernels. auto selects kernels only when the environment supports them and recorded measurements favor them; forcing kernels surfaces incompatibility instead of falling back.
The SDK uses the installed PyTorch build. The lean fastforks-core package keeps model-library dependencies such as timm, torchvision, and transformers in extras; for example, R-CNN detection models need torchvision, while stereo and depth need none of those extras. The CLI complements the Python API with model discovery, asset prefetching, diagnostics, benchmarking, and export.
Key Capabilities & Differentiators
The model catalog spans stereo and monocular or multi-view depth, optical flow, dense matching, detection, classification, semantic and SAM-style promptable segmentation, and DINOv2/DINOv3 feature backbones. The API does not flatten all outputs into one tensor format: RAFT returns [2, H, W] pixel motion, while RoMa returns [2, H1, W1] correspondence coordinates and an [H1, W1] certainty map. The structure-from-motion workflow can build a COLMAP database and optionally reconstruct camera poses and sparse points via pycolmap.
The measured kernel-versus-portable comparisons report a median 1.6× speedup across tested models and sizes, with a quarter at 2.5× or more. The 11× best case is for small classifiers at batch 1; some plain ViT classifiers see no gain. These are comparisons with Fastforks’ own portable backend, not with upstream packages or external runtimes. Use fastforks bench with your target model and input size before relying on the aggregate numbers.
Trade-offs & Limitations
Compared with integrating upstream PyTorch models individually, Fastforks gives applications a consistent way to load models, select backends, and read task results. The trade-off is relying on the SDK’s supported model IDs and exposed controls; direct upstream integration is a better fit when you need behavior outside those wrappers. Kernel gains are workload-dependent. For a fixed, exportable model, compare the built-in kernels with TensorRT on the target hardware: TensorRT can be faster for some models, but it adds an export and engine deployment step.
The distributable project metadata marks it as Alpha. Pin versions and validate the exact model, backend, and result contract before integrating it into a production path. Licensing needs a separate review: the core and wrappers are Apache-2.0, the package manifest also lists BSD-3-Clause and MIT components, and individual model code and weights retain their own terms. The commercial-use flag checks code and weight permissions; training-data terms are shown separately and still need review.
Hardware & Deployment Guide
Use Python 3.11 or newer and install a platform-appropriate PyTorch build first, since a default install may resolve to CPU-only PyTorch. The portable backend is validated on CPU, NVIDIA CUDA, and Apple MPS. Custom CUDA kernels require sm_80 or newer on supported x86-64 Linux or Windows systems; Metal kernels cover 19 model families on Apple silicon. MLX is a separate Apple silicon option enabled with [mlx] and device="mlx". Size memory for the selected model, resolution, precision, batch size, and concurrency rather than assuming a fixed VRAM requirement.
This is a local Python/CLI deployment, not a required hosted API. Use fastforks doctor and fastforks env to check compatibility, and fastforks download MODEL --kernels to stage weights and kernel binaries as applicable. For offline targets, also stage dependencies and verify the model loads with networking disabled. Version 0.3.0 added Windows CUDA support, MLX, and two ComfyUI node packs; 0.4.0 added PP-LCNet document orientation and UVDoc.
[2, H, W], and RoMa dense matching returns pixel coordinates plus a certainty map.auto uses compatibility and recorded measurements; portable forces PyTorch; kernels reports why it cannot run rather than silently falling back.fastforks sfm builds a COLMAP database; [sfm] supplies pycolmap for the optional reconstruction step that produces camera poses and sparse points.Teams running local vision pipelines that need consistent task APIs across published models, a portable PyTorch path, and optional GPU acceleration they can benchmark on their own hardware.
You need a hosted inference API, a model or upstream control the SDK does not expose, or a single fixed engine whose performance and deployment are already validated.
Quick Start & Installation
uv pip install -e '.[libs]' # or pip install -e '.[libs]'; `pip install .` (no -e) works too
Comparison vs. Top Voice, Vision & Video Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| fastforks ★ | 33 | — | Python | Apache-2.0 | A PyTorch vision SDK with task-specific APIs and optional CUDA and Metal kernels |
| pytorch-grad-cam | 13k | +4 | Python | MIT | PyTorch CAM SDK for visual attribution across CNNs and vision transformers |
| diffusers | 35k | +36 | Python | Apache-2.0 | A modular PyTorch SDK for running and customizing multimodal diffusion pipelines |
| vit-pytorch | 25.6k | +13 | Python | MIT | PyTorch Vision Transformers for classification, pretraining, and architecture ex |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/kleinicke/fastforks.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about fastforks
What changes in my integration when I switch backends?
depth.load("depth-anything-v2-s") returns a callable whose result exposes inverse_depth. Choose the execution backend at load time with mode; the task interface stays the same.How do I check GPU compatibility and size VRAM?
fastforks doctor to check compatibility and fastforks env to capture the runtime and GPU configuration. Then run fastforks bench MODEL --size HxW at representative resolutions and measure peak memory with your actual precision, batch size, and concurrency. CUDA kernels require an NVIDIA GPU with compute capability 8.0 or newer on supported x86-64 Linux or Windows systems; the portable backend also has validated CPU and Apple MPS paths.Does self-hosting make every included model commercially usable?
--commercial yes filter as a first pass: it checks code and weight permissions, while training-data terms are listed separately. Review those terms and applicable third-party notices before shipping or redistributing anything.When should I use Fastforks instead of upstream PyTorch or TensorRT?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy