Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Dev Container Configuration

This directory contains the development container configuration for the diffusion model workshop.

## What gets installed

When a user opens this repository in GitHub Codespaces, the following will be automatically set up:

### Base Environment
- Python 3.11 (Debian Bullseye)
- Git and GitHub CLI

### Python Dependencies
- **Workshop dependencies**: Installed from `pyproject.toml`
- Diffusers, transformers, scikit-learn and other ML libraries
- PyTorch CPU version (for lighter resource usage in Codespaces)
- **Documentation dependencies**: Also installed from `pyproject.toml`
- MkDocs and related tools for building documentation

### VS Code Extensions
- Python development: Python, Pylance, Black formatter, Ruff linter
- Jupyter notebooks: Full Jupyter support with renderers and keybindings
- General development: JSON, YAML, and Markdown support

### Port Forwarding
- **Port 8888**: Jupyter notebook server

## Usage

Users simply need to:
1. Fork this repository
2. Open in GitHub Codespaces
3. Wait for the automatic setup to complete
4. Start working with the workshop materials

The environment will be ready to use with all dependencies installed and VS Code properly configured for Python and Jupyter development.
50 changes: 50 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "Diffusion Models Workshop",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",

"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},

"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-keymap",
"ms-toolsai.jupyter-renderers",
"ms-python.black-formatter",
"charliermarsh.ruff",
"ms-vscode.vscode-json",
"redhat.vscode-yaml",
"ms-vscode.vscode-markdown"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": false,
"python.formatting.provider": "black",
"jupyter.askForKernelRestart": false,
"files.associations": {
"*.ipynb": "jupyter-notebook"
}
}
}
},

"postCreateCommand": "./.devcontainer/uv_setup.sh && ./.devcontainer/torch_setup.sh",

"remoteUser": "vscode",

"forwardPorts": [8888],

"portsAttributes": {
"8888": {
"label": "Jupyter",
"onAutoForward": "notify"
}
}
}
5 changes: 5 additions & 0 deletions .devcontainer/torch_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euxo pipefail

# Install torch into venv (CPU build for codespaces)
uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
11 changes: 11 additions & 0 deletions .devcontainer/uv_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euxo pipefail

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install runtime deps into .venv
uv sync

# Activate venv
echo 'source .venv/bin/activate' >> ~/.bashrc
13 changes: 13 additions & 0 deletions docs/setting-up/codespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Codespaces

For this workshop, you can work entirely within Github Codespaces.

!!! warning

GitHub Codespaces only provides CPU resources, which means training and inference of the models will run much slower. If you have access to a GPU on your local machine, we recommend running the workshop locally instead and installing PyTorch manually by following the instructions in [Running Locally](./running-locally.md).

First create a new repository on Github, and then create a codespace from that repository.

Navigate to the LLM workshop repo (click the GitHub symbol in the top right of this page). Switch to the `Handson` branch, and download the content as a zip file. Upload this to your new repo. Open the repo as a Codespace. There is no need to create a virtual environment, since you're already in a containerized environment anyway with a version of Python 3.12.

You don’t need to create or manage a virtual environment yourself. The devcontainer will automatically install `uv`, create and activate a `.venv`, and install all required dependencies when your Codespace is built.
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ nav:
- The Workshop: Home/workshop.md
- License: Home/LICENSE.md
- About us: Home/about.md
- Setting up:
- Codespaces: setting-up/codespaces.md
- Running Locally: setting-up/running-locally.md
- Introduction:
- Introduction: Introduction/Introduction.md
- Running Locally: Introduction/running-locally.md
- Physics: Physics/Physics.md
- Building Blocks:
- BuildingBlocks/index.md
Expand Down