#!/bin/bash # One recaption.py worker per GPU inside the recap-vllm container; workers claim shards through lock files, # finished shards have .done (run) / .fixed (fix) markers, so rerunning this script resumes. # docker exec recap-vllm bash /workspace/prh-vlm/blip3o_recap/launch.sh 0,1,2,3,4,5,6 [out_dir] [run|fix] [extra args] # Several nodes may share one out_dir, so locks are kept by default; CLEAN_LOCKS=1 removes stale locks (only when no # worker is alive on any node). set -e GPUS=${1:-0,1,2,3,4,5,6,7} OUT=${2:-/workspace/prh-vlm/data/blip3o_recap/recap} MODE=${3:-run} cd /workspace/prh-vlm/blip3o_recap if pgrep -f "^python3 recaption.py" >/dev/null; then echo "workers already running" >&2; exit 1; fi mkdir -p "$OUT/logs" if [ "${CLEAN_LOCKS:-0}" = 1 ]; then rm -f "$OUT"/*.lock "$OUT"/*.fixlock; fi for g in ${GPUS//,/ }; do CUDA_VISIBLE_DEVICES=$g nohup python3 recaption.py $MODE --shards ../data/blip3o_recap/shards/*.tar --out "$OUT" \ --gpu-mem 0.85 "${@:4}" >> "$OUT/logs/${MODE}_$(hostname)_gpu$g.log" 2>&1 & done sleep 2; pgrep -f "^python3 recaption.py" | wc -l