SPB Git

spb/wp31_uqo

Public
2.6 KB · 33 lines shellscript
1#!/bin/bash2# Stage C (labels) -> Stage D (controller, h+entropy, early stopping) -> routing evaluation on dev-iid, for one3# finished editor run on one node. Usage: scripts/run_stage_cd.sh <node> <editor_run_id> <tag>4set -e5NODE=$1; RUN=$2; TAG=$36cd "$(dirname "$0")/.."7.venv/bin/python - "$RUN" "$TAG" <<'PY'8import sys, yaml9run, tag = sys.argv[1], sys.argv[2]10ck = f"experiments/runs/{run}/checkpoint"11lab = yaml.safe_load(open("configs/experiments/labels_p4.yaml")); lab.update(name=f"labels_{tag}", model="from_checkpoint", checkpoint=ck)12lab["partitions"] = {"train": {"split": "ctrl_train", "n_batches": 300, "stream_seed": 11}, "calib": {"split": "calib", "n_batches": 40, "stream_seed": 12}}13yaml.safe_dump(lab, open(f"configs/experiments/labels_{tag}.yaml", "w"), sort_keys=False)14ctl = yaml.safe_load(open("configs/experiments/controller_p4_hent.yaml")); ctl.update(name=f"controller_{tag}", model="from_checkpoint", checkpoint=ck)15ctl["labels"] = {"train": f"LABELS_DIR/labels_train.pt", "calib": f"LABELS_DIR/labels_calib.pt"}16ctl["train"]["steps"] = 2000; ctl["train"]["eval_every"] = 25017yaml.safe_dump(ctl, open(f"configs/experiments/controller_{tag}.yaml", "w"), sort_keys=False)18rt = yaml.safe_load(open("configs/experiments/routing_p4.yaml")); rt["model"] = "from_checkpoint"; rt["checkpoint"] = "CONTROLLER_CKPT"19yaml.safe_dump(rt, open(f"configs/experiments/routing_{tag}.yaml", "w"), sort_keys=False)20PY21rsync -az configs training evaluation prisme baselines data/synthetic_dataset.py $NODE:~/wp31/prisme-slm/ 2>/dev/null || rsync -az configs training evaluation prisme baselines $NODE:~/wp31/prisme-slm/22ssh $NODE "cd ~/wp31/prisme-slm && nohup bash -c '23set -e24.venv/bin/python -m training.collect_interventions --config configs/experiments/labels_$TAG.yaml --device mps > experiments/logs/labels_$TAG.log 2>&125L=\$(ls -td experiments/runs/labels_${TAG}_seed* | head -1)26sed -i \"\" \"s|LABELS_DIR|\$L|g\" configs/experiments/controller_$TAG.yaml27.venv/bin/python -m training.train_controller --config configs/experiments/controller_$TAG.yaml --device mps > experiments/logs/controller_$TAG.log 2>&128C=\$(ls -td experiments/runs/controller_${TAG}_seed* | head -1)29sed -i \"\" \"s|CONTROLLER_CKPT|\$C/checkpoint|g\" configs/experiments/routing_$TAG.yaml30.venv/bin/python -m evaluation.routing --config configs/experiments/routing_$TAG.yaml --split dev_iid --device mps --out results/raw/routing_$TAG.json > experiments/logs/routing_$TAG.log 2>&131echo STAGE_CD_DONE >> experiments/logs/routing_$TAG.log32' > experiments/logs/stage_cd_$TAG.log 2>&1 < /dev/null & disown; echo launched stage C/D for $RUN on $NODE"33
Files · a2c46f03643fdd75e8e87595931d35e18c590d57
Menu

Theme