pearlygates / Makefile
theapemachine's picture
Add initial project structure with core files and configurations
5d6894b
Raw
History Blame Contribute Delete
3.05 kB
# One command runs the whole scripted harness (slow: 3Γ— model load).
# make # default β€” baseline + frontier + milestone_all
# make quick # baseline only (faster, one load)
#
# Overrides (optional): RUN_MODES="baseline frontier", SOURCE_DUMP_ONCE=0 …
SHELL := /bin/bash
.DEFAULT_GOAL := run
PY := $(abspath $(CURDIR)/.venv/bin/python)
ifeq ($(wildcard $(PY)),)
PY := $(shell command -v python3 2>/dev/null || command -v python 2>/dev/null || echo python3)
endif
MAIN := $(abspath $(CURDIR)/main.py)
export PYTHONUNBUFFERED := 1
export TRANSFORMERLENS_ALLOW_MPS ?= 1
# Full suite: baseline harness, frontier kit, milestone (frozen attn + SAELens slot).
RUN_MODES ?= baseline frontier milestone_all
# Snapshot repo sources on subprocess 1 only (benchmark_specs, main, frontier_lab, milestone_interp).
SOURCE_DUMP_ONCE ?= 1
.PHONY: help install run quick run-full run-all run-baseline run-frontier run-milestone-attn run-milestone-all
help:
@echo "pearlygates"
@echo " make β€” full run (baseline + frontier + milestone_all), sources dumped once"
@echo " make quick β€” baseline only, one subprocess"
@echo " make install β€” create .venv + pip install -r requirements.txt"
@echo ""
@echo "advanced: RUN_MODES=\"baseline frontier milestone_attn\" make run (omit SAELens pass)"
@echo " RUN_MODES=\"baseline frontier\" … (custom slices)"
@echo "SAELens: PG_SAE_RELEASE=… PG_SAE_ID=… make (otherwise SAELens block prints skip)"
install:
python3 -m venv .venv
.venv/bin/pip install -U pip
.venv/bin/pip install -r requirements.txt
run:
@set -e; \
mods="$(strip $(RUN_MODES))"; \
if [ -z "$$mods" ]; then mods="baseline frontier milestone_all"; fi; \
i=0; \
for m in $$mods; do \
i=$$((i + 1)); \
skip=; \
if [ "$(strip $(SOURCE_DUMP_ONCE))" = "1" ] && [ $$i -gt 1 ]; then \
skip="PG_SKIP_SOURCE_DUMP=1"; \
fi; \
echo ""; \
echo "################################################################"; \
echo "# pearlygates β€” mode=$$m"; \
echo "################################################################"; \
case $$m in \
baseline) \
env $$skip "$(PY)" "$(MAIN)" ;; \
frontier) \
env $$skip PG_FRONTIER=1 "$(PY)" "$(MAIN)" ;; \
milestone_attn) \
env $$skip PG_FROZEN_ATTN=1 "$(PY)" "$(MAIN)" ;; \
milestone_all) \
env $$skip PG_MILESTONE=1 "$(PY)" "$(MAIN)" ;; \
*) \
echo "Unknown RUN_MODE: $$m" >&2; \
echo "Use: baseline | frontier | milestone_attn | milestone_all" >&2; \
exit 1 ;; \
esac; \
done
quick:
@$(MAKE) run RUN_MODES=baseline SOURCE_DUMP_ONCE=0
# Aliases β€” same as `make` / `make run`
run-full run-all:
@$(MAKE) run
run-baseline:
@$(MAKE) run RUN_MODES=baseline SOURCE_DUMP_ONCE=0
run-frontier:
@$(MAKE) run RUN_MODES=frontier SOURCE_DUMP_ONCE=0
run-milestone-attn:
@$(MAKE) run RUN_MODES=milestone_attn SOURCE_DUMP_ONCE=0
run-milestone-all:
@$(MAKE) run RUN_MODES=milestone_all SOURCE_DUMP_ONCE=0