Shared repository for the University of Washington CSED 504 course, Summer 2026.
WashingtonCsed504/
├── assignments/ # Homework and assignment starter code
├── labs/ # Lab exercises and in-class activities
├── resources/ # Supplementary reading materials and references
└── projects/ # Course project templates and guidelines
-
Clone the repository
git clone https://github.com/TrueRottweiler/WashingtonCsed504.git cd WashingtonCsed504 -
Set up a Python virtual environment (recommended)
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r requirements.txt
-
Stay up to date
git pull origin main
Please read CONTRIBUTING.md before submitting any code or assignments.
This repository is licensed under the MIT License.
Shared environment and starter code for UW CSED 504 (Computer Vision + NLP).
Each platform has a one-shot setup script that creates a conda environment named
uw-csed504 (Python 3.12) with a matching package set, so everyone in the group
runs the same stack whether they're on Windows, macOS, Linux, or Google Colab.
| Path | Purpose |
|---|---|
setup_windows.ps1 |
Windows setup (NVIDIA CUDA 12.8) |
setup_mac.sh |
macOS setup (Apple MPS / CPU) |
setup_linux.sh |
Linux / WSL2 setup (NVIDIA CUDA 12.8, or CPU) |
cuda_check.ps1 |
Windows: (re)configure GPU visibility any time |
src/common/gpu_check.py |
Shared device detection + multi-GPU helpers |
src/a1-cv/hello_image.ipynb |
A1 sanity notebook (builds a Vision Transformer) |
src/a2-nlp/hello_text.ipynb |
A2 sanity notebook |
If a hello notebook runs top-to-bottom without errors, your environment is ready.
src/a2-nlp/README.md is the entry point: what the study asks, what
it found, how to reproduce it end to end, and the citations. Then
src/a2-nlp/QUICKSTART.md — ten minutes, one GPU, works on free
Colab.
The two interfaces are mlm_api.py (pretraining) and
ft_api.py (fine-tuning and evaluation); nothing else needs importing.
Findings and methodology are in src/a2-nlp/reports/ — start with
the top board for the argument and its limits.
Headline: a 33.8M-parameter encoder trained from scratch on 64M Yoruba tokens reaches 0.688 macro-F1 on SIB-200 topic classification against mmBERT's 0.582, and the reason is vocabulary fit rather than data volume.
The local setups (Windows / macOS / Linux) use conda. If you don't already have it, grab an installer from the official download page — it offers both the full Anaconda Distribution and the smaller Miniconda (either works; Miniconda is recommended):
- Download page (Windows / macOS / Linux): https://www.anaconda.com/download
- Direct installer archive (all OSes/versions): https://repo.anaconda.com/miniconda/
Pick the installer for your OS (Windows .exe, macOS .pkg / Apple-Silicon, Linux .sh).
Linux / WSL2 one-liner Miniconda install
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
source ~/miniconda3/bin/activate
conda init --all # restart your shell afterwardGoogle Colab needs none of this — conda and PyTorch are already there. Jump to Google Colab.
git clone https://github.com/TrueRottweiler/WashingtonCsed504.git
cd WashingtonCsed504Uses CUDA 12.8 wheels (Blackwell sm_120-compatible) and auto-detects all GPUs.
-
Open the Anaconda Prompt (Start menu → "Anaconda Prompt"), not plain PowerShell — the script needs
condaon the path. -
cdto the repo, then run:powershell -ExecutionPolicy Bypass -File .\setup_windows.ps1
The script installs everything with pip (so PyTorch is the only OpenMP provider — this is
what avoids OMP Error #15), registers the Jupyter kernel, and pins every same-architecture
GPU. Re-run GPU detection any time with .\cuda_check.ps1.
Uses Apple MPS (Metal) acceleration on Apple-Silicon Macs; CPU otherwise.
conda activate base
bash setup_mac.shUses CUDA 12.8 wheels like Windows. CPU-only machines work too (PyTorch falls back to CPU).
conda activate base
bash setup_linux.shRun scripts with
bash setup_*.sh(nochmodneeded). WSL2 counts as Linux — use this script.
No local setup. The hello notebooks self-install their packages and include the clone step.
- Open the notebook in Colab (e.g. from GitHub: File → Open notebook → GitHub, paste the
repo URL, pick
src/a1-cv/hello_image.ipynb). - Runtime → Change runtime type → Hardware accelerator: GPU (T4 is fine).
- Run all cells. The first cells clone the repo,
%cdinto the notebook's folder, and%pip installthe needed packages.
conda activate uw-csed504-
In VS Code or Jupyter, select the kernel "Python (uw-csed504)".
-
Verify the install and see your device:
python src/common/gpu_check.py
Expected device line by platform:
Platform Output Windows / Linux + NVIDIA Device : cuda [N GPUs visible ...]macOS (Apple Silicon) Device : MPS - Apple Silicon GPUCPU-only / Colab CPU Device : CPU (...)
Then open src/a1-cv/hello_image.ipynb or src/a2-nlp/hello_text.ipynb, choose the
uw-csed504 kernel, and Run All. Each ends with "All checks passed."
get_device() picks the best device (CUDA → MPS → CPU) and, on multi-GPU NVIDIA machines,
makes all same-architecture GPUs visible. Helpers you can import:
get_device()/set_seed(42)— device + reproducibility (used by the notebooks).enable_fast_matmul()— TF32 + cuDNN autotune; pair with bf16 autocast for the biggest single-GPU training speedup.get_data_parallel_model(model, DEVICE)—nn.DataParallelacross GPUs (helps only when a step's compute is large enough to outweigh cross-GPU communication).get_max_memory()— budget dict for HuggingFacedevice_map="auto"to split a model that's too big for one card across multiple GPUs.
OMP Error #15/ duplicatelibiomp5md— you have a mixed conda+pip install. Re-run the setup script for your platform; it installs an all-pip stack so PyTorch is the sole OpenMP provider.conda: command not found— on Windows use the Anaconda Prompt; on macOS/Linux runconda activate basefirst (orsource ~/miniconda3/bin/activate).torch.cuda.is_available()is False on an NVIDIA box — check the driver withnvidia-smi, and make sure you're in theuw-csed504env (conda activate uw-csed504).- Permission denied running a
.sh— invoke it asbash setup_linux.sh(orsetup_mac.sh); no execute bit required. - ViT training crashes on macOS with
RuntimeError: view size is not compatible with input tensor's size and stride— this is a confirmed PyTorch MPS bug (present through at least PyTorch 2.5.1). The C++ autograd engine produces non-contiguous gradient tensors duringMultiheadAttentionbackward, and a subsequent.view()call fails. There is no Python-level workaround. Thecifar10_train.ipynbnotebook handles this automatically: it detects MPS and setsVIT_DEVICE = cpufor all ViT training runs while keeping the ResNet and all ViT inference (forward-only) on MPS. The ViT epoch counts are capped at 3 and 5 when on CPU so the cells finish in a few minutes (accuracy will be low — this is a pipeline demo only). For real ViT results (200 epochs), use Google Colab with a GPU runtime or a Windows/Linux machine with CUDA.
The optional additions-only HPO framework lives under src/a1-cv/hpo/. Start with
src/a1-cv/hpo_smoke_test_colab.ipynb, then use
src/a1-cv/hyperparameter_search_colab.ipynb for a persistent Pareto search.
See src/a1-cv/hpo_docs/ for architecture, modes, hardware scheduling, estimation,
persistence, benchmarks, and limitations.