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.
Star history starts 2026-10-23; the chart appears after the second daily snapshot.
Seen on GitHub Trending
- 2026-10-23 β #15 daily in jupyter-notebook Β· +5 β
GitHub topics
Links
- GitHub: github.com/duoan/TorchCode
- Homepage: https://huggingface.co/spaces/duoan/TorchCode
- Releases Β· Issues Β· Hacker News mentions
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.