Forge
What is it
Forge is a runtime for training and running neural networks, aiming to be the efficient and portable one: a single Rust crate and one set of WGSL kernels, with no CUDA toolchain and no Python interpreter anywhere in the loop.
Why
Running a transformer usually means Python, a CUDA toolchain, and a dependency stack tied to one vendor's hardware. Forge is a single Rust crate that trains and infers on any GPU wgpu reaches — Vulkan, Metal, D3D12, and WebGPU in a browser tab — with no CUDA, no Python interpreter, and no server round trip. That's not just a portability trick. Portable and efficient is where this is going: one runtime on every device you own, down to the edge, and eventually across them — the floor a vendor-independent runtime has to stand on before it can carry real research, and eventually local, safety-focused AI work, on hardware you control end to end.
Demo
Try by using your own hardware at https://aisuko.github.io/forge/
https://github.com/user-attachments/assets/d3487d8f-40a1-4c84-9f98-d4a7c5ce1550
Run it
# Generate — the 43 MB char-level Shakespeare model ships in the repo
# Real GPT-2 124M weights — the parity run from tests/gpt2_e2e.rs
# Train from scratch
# Terminal model browser + run dashboard
# Website + in-browser WebGPU demo
&&
# Tests
As a library:
# The crate publishes as `forge-ml` (the name `forge` was taken on crates.io in
# 2017); the library it builds is still `forge`, so imports read `use forge::…`.
[]
= "0.1"
use ;
// assets/shakespeare_char ships in the repo; swap in models/gpt2 after
// running download_gpt2.sh — AnyTokenizer picks char or BPE by what it finds.
let device = wgpu?; // or Device::Cpu
let config = from_json?;
let model = from_safetensors?;
let tok = from_dir?;
let text = model.generate?;
On Linux, wgpu needs a Vulkan ICD — install mesa-vulkan-drivers for a
software fallback, or run scripts/setup_nvidia_vulkan.sh
for NVIDIA inside a container. Check with cargo run --release --example wgpu_probe.
Acknowledgement
Supported by the RACE Merit Allocation Scheme (RMAS), RMIT University.
License
GNU Affero General Public License v3.0 — see LICENSE.