πŸ“ˆ GH Trending Explorer 🎲 Surprise me

← all repos

duoan / TorchCode

git clone https://github.com/duoan/TorchCode.git πŸ”₯ on GitHub Trending today

Interactive Jupyter-based practice platform with 41 PyTorch problems, such as implementing softmax, attention, and GPT-2 from scratch, with automated grading.

Why you might care

Aimed at engineers preparing for ML interviews who need to write core operations like LayerNorm and multi-head attention from memory. Each problem has a judge that checks correctness, gradients, and timing, plus hints and reference solutions. Runs self-hosted via Docker or Podman, or on Hugging Face Spaces and Colab without setup.

Categories

Alternatives

LeetCodeDeep-MLNeetcode
+5
stars, 24h Β· #6,453
β€”
stars, 7 days
β€”
stars, 30 days
4.7k
β˜… total
420
forks Β· 9 open issues

Star history starts 2026-10-23; the chart appears after the second daily snapshot.

LanguageJupyter Notebook
Licenseβ€”
Created2026-03-04 (7mo ago)
Last push2mo ago
Watchers10
OwnerUser

Seen on GitHub Trending

  • 2026-10-23 β€” #15 daily in jupyter-notebook Β· +5 β˜…

GitHub topics

Links

README excerpt
---
title: TorchCode
emoji: πŸ”₯
colorFrom: red
colorTo: yellow
sdk: docker
app_port: 7860
pinned: false
---
# πŸ”₯ TorchCode
**Crack the PyTorch interview.**
Practice implementing operators and architectures from scratch β€” the exact skills top ML teams test for.
*An interactive coding platform, but for tensors. Self-hosted. Jupyter-based. Instant feedback.*
---
## 🎯 Why TorchCode?
Top companies (Meta, Google DeepMind, OpenAI, etc.) expect ML engineers to implement core operations **from memory on a whiteboard**. Reading papers isn't enough β€” you need to write `softmax`, `LayerNorm`, `MultiHeadAttention`, and full Transformer blocks code.
TorchCode gives you a **structured practice environment** with:
| | Feature | |
|---|---|---|
| 🧩 | **41 curated problems** | The most frequently asked PyTorch interview topics |
| βš–οΈ | **Automated judge** | Correctness checks, gradient verification, and timing |
| 🎨 | **Instant feedback** | Colored pass/fail per test case, just like competitive programming |
| πŸ’‘ | **Hints when stuck** | Nudges without full spoilers |
| πŸ“– | **Reference solutions** | Study optimal implementations after your attempt |
| πŸ“Š | **Progress tracking** | What you've solved, best times, and attempt counts |
| πŸ”„ | **One-click reset** | Toolbar button to reset any notebook back to its blank template β€” practice the same problem as many times as you want |
| | **Open in Colab** | Every notebook has an "Open in Colab" badge + toolbar button β€” run problems in Google Colab with zero setup |
No cloud. No signup. No GPU needed. Just `make run` β€” or try it instantly on Hugging Face.
---
## πŸš€ Quick Start
### Option 0 β€” Try it online (zero install)
**Launch on Hugging Face Spaces** β€” opens a full JupyterLab environment in your browser. Nothing to install.
Or open any problem directly in Google Colab β€” every notebook has an badge.
### Option 0b β€” Use the judge in Colab (pip)
In Google Colab, install the judge from PyPI so you can run `check(...)` without cloning the repo:
 [code] 
Then in a notebook cell:
 [code] 
### Option 1 β€” Pull the pre-built image (fastest)
 [code] 
If the registry image is unavailable for your platform, use Option 2 instead. This is the common path on Apple Silicon / `arm64`.
### Option 2 β€” Build locally
 [code] 
`make run` will try the prebuilt image first and automatically fall back to a local build when needed.
Open ** ** β€” that's it. Works with both Docker and Podman (auto-detected).
### Option 3 β€” Standalone Web UI (Next.js + FastAPI)
For a modern, standalone coding experience with an integrated IDE and dual-pane layout:
1. **Start Backend (FastAPI):**
 [code] 
2. **Start Frontend (Next.js):**
 [code] 
3. Open ** ** in your browser.
---
## πŸ“‹ Problem Set
> **Frequency**: πŸ”₯ = very likely in interviews, ⭐ = commonly asked, πŸ’‘ = emerging / differentiator
### 🧱 Fundamentals β€” "Implement X from scratch"
The bread and butter of ML coding interviews. You'll be asked to write these without `torch.nn`.
| # | Problem | What You'll Implement

Blurb generated by claude-haiku-5-5 today. Star deltas marked ~ are extrapolated from partial history.