#!/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] 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" rm -f "$OUT"/*.lock "$OUT"/*.fixlock # no worker is alive, so every lock is stale 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 >> "$OUT/logs/${MODE}_gpu$g.log" 2>&1 & done sleep 2; pgrep -f "^python3 recaption.py" | wc -l