gnn_wm2 / Ctrl-World-Graph /scripts /launch_5fps_eval.sh
EndeavourDD's picture
Upload folder using huggingface_hub (part 17)
f15a766 verified
Raw
History Blame Contribute Delete
2.02 kB
#!/usr/bin/env bash
# Run the 0420 5fps protocol eval for ALL 24 checkpoints across 8 GPUs.
# Generates one worker script per GPU (round-robin job assignment), then launches
# them with setsid nohup. Idempotent: a checkpoint with protocol_metrics.json is skipped.
set -uo pipefail
ROOT="/workspace/Ctrl-World-Graph"
CKPT_ROOT="${ROOT}/model_ckpt"
OUT="${ROOT}/eval_5fps_protocol"
LOG="${ROOT}/logs/eval_5fps_protocol"
mkdir -p "${OUT}" "${LOG}"
cd "${ROOT}"
DIRS=(
ctrl_world_graph_5hz_histcorr_edge_transformer_query
ctrl_world_graph_5hz_histcorr_gatv2_query
ctrl_world_graph_5hz_histcorr_transformer_query
ctrl_world_graph_5hz_histcorr_gine_query
ctrl_world_graph_5hz_histcorr_hybrid_gine_transformer_query
ctrl_world_graph_5hz_histcorr
ctrl_world_graph_5hz
ctrl_world_graph
)
STEPS=(20000 50000 100000)
JOBS=()
for d in "${DIRS[@]}"; do for s in "${STEPS[@]}"; do JOBS+=("${d} ${s}"); done; done
echo "total jobs: ${#JOBS[@]}"
for gpu in 0 1 2 3 4 5 6 7; do
wscript="${LOG}/worker_gpu${gpu}.sh"
{
echo '#!/usr/bin/env bash'
echo "cd ${ROOT}"
i=0
for job in "${JOBS[@]}"; do
if (( i % 8 == gpu )); then
d="${job% *}"; s="${job#* }"
ckpt="${CKPT_ROOT}/${d}/checkpoint-${s}.pt"
donef="${OUT}/${d}/checkpoint-${s}/protocol_metrics.json"
echo "if [[ -f '${donef}' ]]; then echo \"[\$(date -Is)] SKIP ${d}/${s}\"; else echo \"[\$(date -Is)] START ${d}/${s}\"; python -u scripts/eval_5fps_protocol.py --ckpt-path '${ckpt}' --out-dir '${OUT}' --seed 1234 && echo \"[\$(date -Is)] DONE ${d}/${s}\" || echo \"[\$(date -Is)] FAILED ${d}/${s}\"; fi"
fi
i=$((i+1))
done
echo "echo \"[\$(date -Is)] gpu${gpu} ALL ASSIGNED JOBS DONE\""
} > "${wscript}"
njobs=$(grep -c "eval_5fps_protocol" "${wscript}")
CUDA_VISIBLE_DEVICES="${gpu}" setsid nohup bash "${wscript}" > "${LOG}/gpu${gpu}.log" 2>&1 &
echo "launched gpu${gpu} pid=$! (${njobs} jobs) log=${LOG}/gpu${gpu}.log"
done
echo "all 8 workers launched. outputs -> ${OUT}"