Jittor/jittor
Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.
Jittor – a Just‑In‑Time deep‑learning framework
What it is – Jittor is a full‑stack deep‑learning library written in C++/CUDA with a Python front‑end. It compiles the whole computation graph just‑in‑time (JIT) and uses a meta‑operator system to generate highly‑optimized kernels for the specific model you are training. The design follows the familiar dynamic‑graph style used by PyTorch/TensorFlow‑Eager, so you write ordinary Python code and the framework takes care of turning it into fast native code.
Key ideas
- JIT compilation – every operator and the surrounding graph are compiled on the fly, allowing the compiler to specialise the generated code for the exact tensor shapes and hardware.
- Meta‑operators – high‑level building blocks that can be combined or customised, letting users write new ops (e.g., custom convolutions) without leaving Python.
- Unified graph execution – Jittor builds a dynamic graph but can also fuse operations for optimal performance, similar to static‑graph frameworks.
- Backend flexibility – runs on CPU, NVIDIA CUDA, AMD ROCm, and even Hygon DCU; the core is C++/CUDA while the user API is pure Python.
What you can do with it
- Train classic vision models (ResNet, detection, segmentation, generative models) out‑of‑the‑box.
- Experiment with differentiable rendering, geometric deep learning, reinforcement learning, etc., using the provided model libraries.
- Write your own high‑performance custom operators in C++/CUDA and have them JIT‑compiled automatically.
- Profile and tune performance with the built‑in jtune tool.
Installation
- Pip –
python -m pip install jittor(Linux needspython3-devandlibomp-dev). - Docker – pre‑built images
jittor/jittor(CPU only) andjittor/jittor-cuda(GPU). - Manual – clone the repo, install a C++ compiler (g++ ≥ 5.4 or clang ≥ 8), install Python ≥ 3.7, then
sudo pip install ./jittor. - GPU support is optional; set
jt.flags.use_cuda = 1after installing CUDA or letting Jittor download it automatically on Windows.
Quick example (two‑layer regression model) – the README ships a minimal script that shows the typical workflow:
import jittor as jt, numpy as np
from jittor import nn, Module
class Model(Module):
def __init__(self):
self.l1 = nn.Linear(1, 10)
self.relu = nn.Relu()
self.l2 = nn.Linear(10, 1)
def execute(self, x):
return self.l2(self.relu(self.l1(x)))
model = Model()
opt = nn.SGD(model.parameters(), lr=0.1)
for x, y in data_generator():
pred = model(x)
loss = ((pred - y) ** 2).mean()
opt.step(loss)
print('loss', loss.data.item())
The code mirrors PyTorch‑style modules, but under the hood Jittor JIT‑compiles the whole forward‑backward pass for maximum speed.
Learning resources
- Official website and docs: https://cg.cs.tsinghua.edu.cn/jittor/
- Interactive notebooks for basics, meta‑operators, custom ops, profiling, etc.
- Community forum, QQ group, and an “Awesome Jittor” list of third‑party projects.
Ecosystem
- Model zoo covering image classification, detection, segmentation, generative models, differentiable rendering, geometric learning, and RL.
- Tools:
jtunefor kernel tuning, a profiler, and utilities to export/import models. - Extensible via custom C++/CUDA ops and Python meta‑operators.
License – Apache 2.0 (per the LICENSE.txt file).
Citation – If you use Jittor in research, cite the 2020 Science China Information Sciences paper provided in the README.
Related
- Project
- Project
- Project
- Project
- Project