fridge_m setup: chunked_runner + run_gen_chunk + check_mismatch + push_watchdog
Browse files
fridge_m/_setup/scripts/extend_chunks_89.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# After chunk 7 + its final flush finish, run chunks 8 and 9 (sim+gen each),
|
| 3 |
+
# then do another final flush to push the additional ~100 trajs.
|
| 4 |
+
#
|
| 5 |
+
# Sequencing rationale: chunk 7 gen is using all 4 GPUs; co-launching chunks 8
|
| 6 |
+
# sim now would force VRAM sharing (gen 21.2 GB + sim 1.5 GB per GPU = 22.7 GB
|
| 7 |
+
# on a 24 GB 3090, too close to OOM). Wait for chunk 7 to fully complete, then
|
| 8 |
+
# sequential chunks 8 and 9 the same way chunks 1-6 ran.
|
| 9 |
+
set -uo pipefail
|
| 10 |
+
|
| 11 |
+
CHUNK7_RUNNER_PID=${CHUNK7_RUNNER_PID:-1546061}
|
| 12 |
+
POST7_PID=${POST7_PID:-1546543}
|
| 13 |
+
|
| 14 |
+
echo "[ext] waiting for chunk-7 chunked_runner pid=$CHUNK7_RUNNER_PID ..."
|
| 15 |
+
while kill -0 "$CHUNK7_RUNNER_PID" 2>/dev/null; do sleep 30; done
|
| 16 |
+
echo "[ext] chunked_runner (chunk 7) exited at $(date -Iseconds)"
|
| 17 |
+
|
| 18 |
+
echo "[ext] waiting for post_chunk7_flush pid=$POST7_PID (final HF push) ..."
|
| 19 |
+
while kill -0 "$POST7_PID" 2>/dev/null; do sleep 15; done
|
| 20 |
+
echo "[ext] post_chunk7_flush exited at $(date -Iseconds)"
|
| 21 |
+
|
| 22 |
+
# Sanity: confirm no GPU users remain
|
| 23 |
+
sleep 5
|
| 24 |
+
echo "[ext] residual GPU users (should be empty):"
|
| 25 |
+
pgrep -af '[r]un_pipeline_no_clip\.py|[i]nference_long_video\.py|[d]epth_methods\.py' 2>/dev/null || true
|
| 26 |
+
|
| 27 |
+
# Archive the chunk-7 runner log
|
| 28 |
+
mv /scr/ravenh/fridge_m/logs/chunked_runner.log /scr/ravenh/fridge_m/logs/chunked_runner.log.chunk7done 2>/dev/null || true
|
| 29 |
+
|
| 30 |
+
echo "[ext] launching chunked_runner for chunks 8..9 at $(date -Iseconds)"
|
| 31 |
+
START_CHUNK=8 NUM_CHUNKS=9 SAMPLES_PER_HOUSE=3 SEED_BASE=30000 GPUS="0,1,2,3" STOP_AT_TRAJS=100000 \
|
| 32 |
+
bash /scr/ravenh/fridge_m/scripts/chunked_runner.sh
|
| 33 |
+
echo "[ext] chunked_runner (chunks 8..9) exited at $(date -Iseconds)"
|
| 34 |
+
|
| 35 |
+
# Re-run the final flush to push chunks 7+8+9 (chunk 7 was already pushed in post7).
|
| 36 |
+
echo "[ext] final HF flush at $(date -Iseconds)"
|
| 37 |
+
source /svl/u/ravenh/miniconda3/etc/profile.d/conda.sh
|
| 38 |
+
conda activate mlspaces
|
| 39 |
+
python -u /scr/ravenh/fridge_m/scripts/final_flush.py 2>&1 | tee -a /scr/ravenh/fridge_m/logs/final_flush.log
|
| 40 |
+
echo "[ext] DONE at $(date -Iseconds)"
|
fridge_m/_setup/scripts/extend_chunks_89_simfirst.sh
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# After chunk 7 + its final flush finish, do:
|
| 3 |
+
# 1. chunk 8 sim
|
| 4 |
+
# 2. chunk 9 sim (only after chunk 8 sim done; both use 4 GPUs)
|
| 5 |
+
# 3. chunk 8 gen
|
| 6 |
+
# 4. chunk 9 gen
|
| 7 |
+
# 5. final HF flush
|
| 8 |
+
#
|
| 9 |
+
# I.e. all sim work first, then all gen work. Different from the chunked_runner
|
| 10 |
+
# default of sim+gen interleaved per chunk, per user request.
|
| 11 |
+
set -uo pipefail
|
| 12 |
+
|
| 13 |
+
CHUNK7_RUNNER_PID=${CHUNK7_RUNNER_PID:-1546061}
|
| 14 |
+
POST7_PID=${POST7_PID:-1546543}
|
| 15 |
+
REPO_MOLMO=/svl/u/ravenh/renderscale/molmospaces
|
| 16 |
+
ROOT=/scr/ravenh/fridge_m
|
| 17 |
+
SCRIPTS=$ROOT/scripts
|
| 18 |
+
SIM_CHUNKS=$ROOT/sim_chunks
|
| 19 |
+
GEN_CHUNKS=$ROOT/gen_chunks
|
| 20 |
+
SCRATCH_GEN=$ROOT/_workdir_gen
|
| 21 |
+
LOGS=$ROOT/logs
|
| 22 |
+
GPUS=${GPUS:-0,1,2,3}
|
| 23 |
+
SAMPLES_PER_HOUSE=${SAMPLES_PER_HOUSE:-3}
|
| 24 |
+
SEED_BASE=${SEED_BASE:-30000}
|
| 25 |
+
|
| 26 |
+
source /svl/u/ravenh/miniconda3/etc/profile.d/conda.sh
|
| 27 |
+
conda activate mlspaces
|
| 28 |
+
|
| 29 |
+
# data_gen_fridge_m.sh expects cwd=$REPO_MOLMO (relative camera_extrinsics path).
|
| 30 |
+
cd "$REPO_MOLMO"
|
| 31 |
+
|
| 32 |
+
# ---- Phase 1: wait for chunk 7 + post7-flush to fully exit ----
|
| 33 |
+
echo "[ext-sf] waiting for chunk-7 chunked_runner pid=$CHUNK7_RUNNER_PID ..."
|
| 34 |
+
while kill -0 "$CHUNK7_RUNNER_PID" 2>/dev/null; do sleep 30; done
|
| 35 |
+
echo "[ext-sf] chunked_runner (chunk 7) exited at $(date -Iseconds)"
|
| 36 |
+
|
| 37 |
+
echo "[ext-sf] waiting for post_chunk7_flush pid=$POST7_PID (final HF push) ..."
|
| 38 |
+
while kill -0 "$POST7_PID" 2>/dev/null; do sleep 15; done
|
| 39 |
+
echo "[ext-sf] post_chunk7_flush exited at $(date -Iseconds)"
|
| 40 |
+
|
| 41 |
+
sleep 5
|
| 42 |
+
echo "[ext-sf] residual GPU users (should be empty):"
|
| 43 |
+
pgrep -af '[r]un_pipeline_no_clip\.py|[i]nference_long_video\.py|[d]epth_methods\.py' 2>/dev/null || true
|
| 44 |
+
|
| 45 |
+
# ---- Phase 2: chunk 8 sim ----
|
| 46 |
+
launch_sim_chunk() {
|
| 47 |
+
local n=$1
|
| 48 |
+
local chunk_dir="$SIM_CHUNKS/chunk_$(printf '%03d' $n)"
|
| 49 |
+
mkdir -p "$chunk_dir"
|
| 50 |
+
echo "[ext-sf] phase: chunk $n sim -> $chunk_dir $(date -Iseconds)"
|
| 51 |
+
declare -a PIDS=()
|
| 52 |
+
for s in 1 2 3 4; do
|
| 53 |
+
GPU=$((s - 1))
|
| 54 |
+
SEED=$((SEED_BASE + n*100 + s))
|
| 55 |
+
LOG="$LOGS/sim_chunk_$(printf '%03d' $n)_shard_${s}.log"
|
| 56 |
+
CUDA_VISIBLE_DEVICES=$GPU OUTPUT_DIR="$chunk_dir" SAMPLES_PER_HOUSE="$SAMPLES_PER_HOUSE" \
|
| 57 |
+
nohup bash "$REPO_MOLMO/scripts/datagen/data_gen_fridge_m.sh" "$s" 4 "$SEED" \
|
| 58 |
+
> "$LOG" 2>&1 &
|
| 59 |
+
PIDS+=($!)
|
| 60 |
+
echo " shard $s/4 GPU=$GPU SEED=$SEED PID=$! log=$LOG"
|
| 61 |
+
done
|
| 62 |
+
echo "[ext-sf] waiting for chunk $n sim shards to exit..."
|
| 63 |
+
for pid in "${PIDS[@]}"; do
|
| 64 |
+
if ! wait "$pid"; then
|
| 65 |
+
echo "[ext-sf] WARN: sim shard pid=$pid exited non-zero"
|
| 66 |
+
fi
|
| 67 |
+
done
|
| 68 |
+
echo "[ext-sf] chunk $n sim done at $(date -Iseconds)"
|
| 69 |
+
echo "[ext-sf] check_mismatch on chunk $n ..."
|
| 70 |
+
if ! python "$SCRIPTS/check_mismatch.py" --sim_dir "$chunk_dir"; then
|
| 71 |
+
echo "[ext-sf] FATAL: mismatch in chunk $n; aborting before launching any more work"
|
| 72 |
+
exit 2
|
| 73 |
+
fi
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
run_gen_chunk_oneshot() {
|
| 77 |
+
local n=$1
|
| 78 |
+
local chunk_dir="$SIM_CHUNKS/chunk_$(printf '%03d' $n)"
|
| 79 |
+
local gen_dir="$GEN_CHUNKS/chunk_$(printf '%03d' $n)"
|
| 80 |
+
local scratch="$SCRATCH_GEN/chunk_$(printf '%03d' $n)"
|
| 81 |
+
mkdir -p "$gen_dir" "$scratch"
|
| 82 |
+
local count=$(ls "$chunk_dir"/episode_*_exo_camera_1_robot_rgb*.mp4 2>/dev/null | wc -l)
|
| 83 |
+
echo "[ext-sf] phase: chunk $n gen ($count trajs) using GPUs=$GPUS $(date -Iseconds)"
|
| 84 |
+
SEQ_OFFSET=$((n*100))
|
| 85 |
+
python "$SCRIPTS/run_gen_chunk.py" \
|
| 86 |
+
--sim_src "$chunk_dir" \
|
| 87 |
+
--out_dir "$gen_dir" \
|
| 88 |
+
--scratch "$scratch" \
|
| 89 |
+
--gpus "$GPUS" \
|
| 90 |
+
--seq_offset "$SEQ_OFFSET" 2>&1 | stdbuf -oL tee "$LOGS/gen_chunk_$(printf '%03d' $n).log" || \
|
| 91 |
+
echo "[ext-sf] WARN: gen chunk $n exited non-zero (some trajs may have failed; continuing)"
|
| 92 |
+
echo "[ext-sf] chunk $n gen done at $(date -Iseconds)"
|
| 93 |
+
rm -rf "$scratch/_inf_tmp" 2>/dev/null || true
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
# Phase 2: chunk 8 sim
|
| 97 |
+
launch_sim_chunk 8
|
| 98 |
+
|
| 99 |
+
# Phase 3: chunk 9 sim (sequential — must wait for chunk 8 sim before launching 9 sim, so the 4 GPUs free up)
|
| 100 |
+
launch_sim_chunk 9
|
| 101 |
+
|
| 102 |
+
# Phase 4: chunk 8 gen
|
| 103 |
+
run_gen_chunk_oneshot 8
|
| 104 |
+
|
| 105 |
+
# Phase 5: chunk 9 gen
|
| 106 |
+
run_gen_chunk_oneshot 9
|
| 107 |
+
|
| 108 |
+
# Phase 6: final HF flush (pushes chunks 1..9 sim+gen+h5)
|
| 109 |
+
echo "[ext-sf] final HF flush at $(date -Iseconds)"
|
| 110 |
+
python -u "$SCRIPTS/final_flush.py" 2>&1 | tee -a "$LOGS/final_flush.log"
|
| 111 |
+
echo "[ext-sf] DONE at $(date -Iseconds)"
|
fridge_m/_setup/scripts/post_chunk7_flush.sh
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Waits for chunked_runner to fully exit (chunk 7 is the only chunk in this
|
| 3 |
+
# run, so when it exits the loop is done), then re-runs the final HF flush.
|
| 4 |
+
set -uo pipefail
|
| 5 |
+
|
| 6 |
+
RUNNER_PID=${RUNNER_PID:-1546061}
|
| 7 |
+
|
| 8 |
+
echo "[post7] waiting for chunked_runner pid=$RUNNER_PID to exit ..."
|
| 9 |
+
while kill -0 "$RUNNER_PID" 2>/dev/null; do
|
| 10 |
+
sleep 30
|
| 11 |
+
done
|
| 12 |
+
echo "[post7] chunked_runner exited at $(date -Iseconds); waiting 10s to settle..."
|
| 13 |
+
sleep 10
|
| 14 |
+
|
| 15 |
+
# Confirm chunk 7 produced trajs
|
| 16 |
+
n=$(ls /scr/ravenh/fridge_m/sim_chunks/chunk_007/episode_*_exo_camera_1_robot_rgb*.mp4 2>/dev/null | wc -l)
|
| 17 |
+
echo "[post7] chunk_007 finalized sim trajs: $n"
|
| 18 |
+
if [ "$n" = "0" ]; then
|
| 19 |
+
echo "[post7] WARN: chunk 7 produced 0 trajs; nothing new to flush. Exiting."
|
| 20 |
+
exit 1
|
| 21 |
+
fi
|
| 22 |
+
|
| 23 |
+
g=$(ls /scr/ravenh/fridge_m/gen_chunks/chunk_007/generated_episode_*_exo_camera_1*.mp4 2>/dev/null | wc -l)
|
| 24 |
+
echo "[post7] chunk_007 finalized gen trajs: $g"
|
| 25 |
+
|
| 26 |
+
source /svl/u/ravenh/miniconda3/etc/profile.d/conda.sh
|
| 27 |
+
conda activate mlspaces
|
| 28 |
+
|
| 29 |
+
echo "[post7] starting final HF flush at $(date -Iseconds)"
|
| 30 |
+
python -u /scr/ravenh/fridge_m/scripts/final_flush.py 2>&1 | tee -a /scr/ravenh/fridge_m/logs/final_flush.log
|
| 31 |
+
echo "[post7] final flush done at $(date -Iseconds)"
|