# How to Run Individual Lesson Code Locally for AI Engineering from Scratch

> Easily run AI Engineering from Scratch lesson code locally. Clone the repository, install dependencies, and execute code from any lesson folder. Get hands-on with AI projects today.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: how-to-guide
- Published: 2026-06-07

---

**TLDR:** Clone the `rohitg00/ai-engineering-from-scratch` repository, install the language-specific dependencies for your stack, navigate to the lesson's `code/` folder, and execute the entry-point file with the appropriate interpreter or compiler.

The `rohitg00/ai-engineering-from-scratch` curriculum is organized into self-contained lessons that you can execute independently on your local machine. Each lesson includes a runnable entry point—such as [`main.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/main.py), [`main.ts`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/main.ts), [`main.rs`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/main.rs), or `main.jl`—and a dedicated test suite, so you can run individual lesson code locally for AI Engineering from Scratch without processing the entire curriculum. The repository follows a predictable directory structure under `phases/<NN>-<phase-name>/<NN>-<lesson-name>/code/`, making it easy to locate and launch any specific topic.

## Clone the Repository

Start by cloning the entire curriculum to get a version-locked snapshot of every lesson:

```bash
git clone https://github.com/rohitg00/ai-engineering-from-scratch.git
cd ai-engineering-from-scratch

```

Because the repository is Git-tracked and each lesson is a separate commit, cloning gives you a clean, reproducible copy of all source files.

## Install Language-Specific Dependencies

The curriculum deliberately limits dependencies to each language's standard library plus a small set of approved Python libraries. This keeps builds reproducible and educational, as documented in **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)**. Install only what your target lesson requires:

- **Python** – Run `pip install -r requirements.txt` from the repository root. The root-level **[`requirements.txt`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/requirements.txt)** file is the single source of truth for all Python dependencies across lessons.
- **TypeScript** – Run `npm install && npm install -g tsx` (requires Node 20 or later). A [`package.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/package.json) is generated by CI and provides the project context.
- **Rust** – No external crates are needed. Every Rust lesson compiles against the standard library only, as noted in the repository rules.
- **Julia** – Standard library only. If a [`Project.toml`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/Project.toml) exists, run `julia -e 'using Pkg; Pkg.instantiate()'`, but most lessons require no extra packages.

## Locate the Lesson Code Directory

The repository tree follows a consistent pattern:

```text
phases/
  <phase-number>-<phase-name>/
    <lesson-number>-<lesson-slug>/
      code/
        main.<ext>
      docs/en.md
      outputs/
      quiz.json

```

For example, the Linear Algebra "Vectors" lesson lives at:

```text
phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py

```

Navigating directly to that folder is the first step before you can execute the lesson.

## Execute the Lesson Entry Point

Once inside the repository, run the lesson's entry-point file from your terminal using the command that matches its language.

### Python Lessons

```bash
python phases/01-math-foundations/01-linear-algebra-intuition/code/vectors.py

```

The file contains an **`if __name__ == "__main__":`** block that prints a self-checking demo, typically found in the lower section of the script.

### TypeScript Lessons

```bash
npx tsx phases/07-transformers-deep-dive/02-self-attention-from-scratch/code/main.ts

```

The TypeScript lessons ship a [`main.ts`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/main.ts) that executes with **tsx**, which bundles ESM support for immediate running.

### Rust Lessons

```bash
rustc phases/10-llms-from-scratch/01-tokenizers/code/main.rs -O && ./main

```

All Rust lessons compile with a single `rustc` invocation because they depend solely on the standard library.

### Julia Lessons

```bash
julia --project=phases/12-multimodal-ai/01-vision-transformer-patch-tokens/code/main.jl

```

Julia lessons use only the standard library, so no additional package installation is required before execution.

## Verify with Lesson Tests (Optional)

Each lesson ships a **`tests/`** directory. Running the native test runner confirms that the implementation matches the curriculum's expected behavior:

- **Python** – `python -m unittest discover -s phases/01-math-foundations/01-linear-algebra-intuition/code/tests -v`
- **TypeScript** – `npx jest` (when a [`jest.config.js`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/jest.config.js) is present)
- **Rust** – `cargo test` (for lessons that include a [`Cargo.toml`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/Cargo.toml) placeholder)
- **Julia** – `julia --project=... -e "using Pkg; Pkg.test()"`

## Quick Reference Cheat Sheet

Keep these one-line patterns handy for any lesson:

- **Clone:** `git clone https://github.com/rohitg00/ai-engineering-from-scratch.git && cd ai-engineering-from-scratch`
- **Install (Python):** `pip install -r requirements.txt`
- **Find lesson files:** `ls phases/09-reinforcement-learning/08-ppo/code`
- **Run (Python):** `python phases/09-reinforcement-learning/08-ppo/code/main.py`
- **Run (TypeScript):** `npx tsx phases/07-transformers-deep-dive/02-self-attention-from-scratch/code/main.ts`
- **Run (Rust):** `rustc .../main.rs -O && ./main`
- **Run (Julia):** `julia --project=.../code/main.jl`
- **Test (Python):** `python -m unittest discover -s .../tests -v`
- **Interactive picker:** `python $(git ls-files "phases/*/*/code/*.py" | fzf)` (replace `python` with `npx tsx`, `rustc … && ./main`, or `julia …` for other languages)

## Summary

- The `rohitg00/ai-engineering-from-scratch` repository arranges every lesson under `phases/<phase>/<lesson>/code/` with a runnable entry-point file.
- You can run individual lesson code locally for AI Engineering from Scratch by cloning the repo, installing the minimal language-specific dependencies, and executing the target `main.<ext>` file.
- Python lessons rely on the root **[`requirements.txt`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/requirements.txt)**, while TypeScript, Rust, and Julia lessons prioritize standard-library or near-standard-library tooling.
- Optional test suites in each **`tests/`** directory let you validate your local execution against the curriculum's expectations.
- The optional helper script **[`scripts/install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/install_skills.py)** automates the installation of reusable skill artifacts produced by lessons.

## Frequently Asked Questions

### Can I run a lesson without completing previous lessons?

Yes. Every lesson is self-contained. The repository structure isolates each topic in its own `code/` directory, so you can jump directly to any phase or lesson and execute its entry point independently without running prior material.

### Why does the curriculum avoid external dependencies?

According to the **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)** policy, the curriculum enforces a standard-library-first dependency policy. This keeps setup minimal, reduces version conflicts, and ensures that you spend time learning AI engineering concepts instead of debugging dependency trees.

### Do I need to install a separate environment for each lesson?

No. A single Python virtual environment with the root **[`requirements.txt`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/requirements.txt)** installed is sufficient for all Python lessons. Similarly, one global **`tsx`** installation handles all TypeScript lessons, while Rust and Julia lessons require no per-lesson package management at all.

### Where are the skill artifacts that lessons produce?

Some lessons generate reusable skill artifacts that are used later in the curriculum. You can automate their installation with the optional helper script **[`scripts/install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/install_skills.py)**, which collects and sets up artifacts produced across the repository.