catmcgee/mech-interp-runner
0
mech-interp-runner
Backend kernel for the learn-mech-interp curriculum site. Runs Python code submitted by the frontend in a per-session namespace and returns stdout, stderr, and matplotlib figures.
This Space is not meant to be browsed directly — it's the execution backend for the curriculum site.
endpoints
GET /healthz— livenessPOST /run— body{ session_id, code }→{ stdout, stderr, figures, error }. Figures are base64-encoded PNGs.POST /reset— body{ session_id }→ drops the namespaceGET /— tiny status page
Per-session kernel namespaces live in process memory and are reaped after 10 minutes idle.
deploy
This is a Hugging Face Spaces "Docker" Space. To deploy:
# from the site repo:
cd space/
git init
git remote add origin https://huggingface.co/spaces/catmcgee/mech-interp-runner
git add . && git commit -m "init"
git push origin mainOr use the HF web UI: create a new Space, SDK "Docker", upload these files. First build takes a few minutes (PyTorch + transformer_lens).
hardware
Free CPU tier is enough for steps 0, 1, and 5 (toy models). For steps 2, 3, and 4 (transformers) bump to a T4 small (paid).
local dev
cd space/
pip install -r requirements.txt
uvicorn app:app --reload --port 7860Then hit http://localhost:7860/healthz.
