tinygrad  by tinygrad

Minimalist deep learning framework for education and exploration

created 4 years ago
29,752 stars

Top 1.3% on sourcepulse

GitHubView on GitHub
Project Summary

tinygrad is a lightweight deep learning framework designed for simplicity and ease of accelerator integration, targeting researchers and developers who find existing frameworks too complex. It aims to be the easiest framework to add new hardware backends to, supporting both inference and training with a RISC-like philosophy compared to XLA's CISC approach.

How It Works

tinygrad leverages laziness to fuse operations into single kernels, optimizing execution. Its core design prioritizes a minimal set of low-level operations (~25) required for an accelerator to support, making it highly extensible. This approach allows for efficient execution on diverse hardware, from CPUs and GPUs to specialized accelerators.

Quick Start & Requirements

  • Install from source: git clone https://github.com/tinygrad/tinygrad.git && cd tinygrad && python3 -m pip install -e .
  • Direct install: python3 -m pip install git+https://github.com/tinygrad/tinygrad.git
  • Prerequisites: Python 3.x. Supports CPU, OpenCL, LLVM, METAL, CUDA, AMD, NV, QCOM, and WebGPU.
  • Documentation: https://docs.tinygrad.org/

Highlighted Details

  • Supports LLaMA and Stable Diffusion models.
  • Achieves 98% accuracy on MNIST in ~5 seconds with a simple LinearNet example.
  • Extensive accelerator support including CPU, GPU (OpenCL, CUDA, Metal), LLVM, and more.
  • Designed for easy addition of new hardware backends.

Maintenance & Community

Licensing & Compatibility

  • License: Apache 2.0.
  • Compatible with commercial use and closed-source linking.

Limitations & Caveats

The project is explicitly stated as alpha software. The README warns against code golf, complex or large diffs, and unsolicited documentation/whitespace changes, indicating a strict contribution policy focused on simplicity and clarity.

Health Check
Last commit

17 hours ago

Responsiveness

1 day

Pull Requests (30d)
383
Issues (30d)
19
Star History
1,243 stars in the last 90 days

Explore Similar Projects

Starred by Jeff Hammerbacher Jeff Hammerbacher(Cofounder of Cloudera) and Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

InternEvo by InternLM

1.0%
402
Lightweight training framework for model pre-training
created 1 year ago
updated 1 week ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Jiayi Pan Jiayi Pan(Author of SWE-Gym; AI Researcher at UC Berkeley), and
5 more.

Liger-Kernel by linkedin

0.6%
5k
Triton kernels for efficient LLM training
created 1 year ago
updated 1 day ago
Starred by Aravind Srinivas Aravind Srinivas(Cofounder of Perplexity), Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake), and
12 more.

DeepSpeed by deepspeedai

0.2%
40k
Deep learning optimization library for distributed training and inference
created 5 years ago
updated 23 hours ago
Feedback? Help us improve.