{"repo":"masonwang025/pitorch","free":true,"listed":false,"github":"https://github.com/masonwang025/pitorch","clone":"git clone https://github.com/masonwang025/pitorch.git","description":"🥧 Baremetal ML library for the Raspberry Pi","language":"C","stars":34,"topics":["distributed","embedded-systems","gpu","raspberry-pi"],"license":null,"category":"machine-learning","readme_excerpt":"🥧 pitorch LLaMA-2 inference and training on bare-metal (no operating system) Raspberry Pi Zero. Optimized with custom assembly kernels for the Raspberry Pi's GPU (VideoCore IV QPUs), achieving a 210x speedup over CPU. Supports distributing work across four Pis, scaling comfortably to 110M parameters (in theory, 400M fp32). Check out the full writeup here! ⭐ This repo has the full PiTorch framework (GPU kernels, tools, and examples). Once you have a Pi Zero, a cable, and an SD card, you should be able to generate text in 10 minutes (setup guide). Running See docs/setup.md for full setup (toolchain, SD card, weights). See docs/hardware.md for 4-Pi wiring. Inference examples/generate.c — the complete single-Pi inference program: pt pi init enables QPUs, maps the weight file from SD-card RAM into the struct, and initializes the GPU arena allocator. pt generate handles BPE tokenization, KV-cache prefill, temperature/top-p sampling, and streams tokens back over UART. Training Pass max T 0 to pt pi init to allocate training buffers: pt train step is zero grads → forward (saving activations) → backward (7 per-operator passes) → SGD update . Convergence on stories15M: loss 7.4 → 0.03 in 18 steps. 4-Pi distributed examples/generate-distributed.c splits the model across 4 Pis. Each Pi loads only its weight shard: Activations flow ring: R3 (embed+head) → R0 → R1 → R2 → R3. The inter-Pi link is a custom 8-bit parallel GPIO bus ( 8 MB/s), making communication less than 1% of step time for","default_branch":null,"files":null,"tree":[],"storefront":"/r/masonwang025","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/masonwang025/pitorch/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}