#!/bin/bash # run_smoke.sh — Step 1 smoke test: 1 seed of StBR and SPOT at 10% subset, # short training (20k gradient steps), end-to-end incl. D4RL evaluation. # Env vars: none required. Outputs -> /out (bucket mount). set -uo pipefail export DEBIAN_FRONTEND=noninteractive echo "=== STBR repro SMOKE $(date -u) ===" echo "HF_JOB_FLAVOR=${HF_JOB_FLAVOR:-unknown} HF_JOB_ID=${HF_JOB_ID:-unknown} HF_JOB_IMAGE=${HF_JOB_IMAGE:-unknown}" nvidia-smi || echo "no GPU visible" mkdir -p /out/logs /workspace df -h / | tail -1 # ---------- 1. environment (mirrors authors' conda_env.yml) ---------- time bash /repo/code/setup_env.sh > /out/logs/setup_env.log 2>&1 || { echo SETUP_FAILED; tail -50 /out/logs/setup_env.log; exit 1; } tail -5 /out/logs/setup_env.log source /root/stbr_env.rc source /opt/conda/etc/profile.d/conda.sh conda activate stbr # ---------- 2. clone the authors' repos at pinned commits ---------- cd /workspace [ -d StBR ] || git clone -q https://github.com/DarrenJum/StBR StBR git -C StBR checkout -q c47ebe2bf1c4bc801a225c8b86ae00917e7e706a [ -d SPOT ] || git clone -q https://github.com/thuml/SPOT SPOT git -C SPOT checkout -q 4be91cce407e93a8631043328f868b1b7abb86ba echo "STBR_COMMIT=$(git -C /workspace/StBR rev-parse HEAD)" echo "SPOT_COMMIT=$(git -C /workspace/SPOT rev-parse HEAD)" git -C /workspace/StBR log -1 --format='%ci %s' git -C /workspace/SPOT log -1 --format='%ci %s' # ---------- 3. StBR smoke: 10% subset, seed 0, 20k steps ---------- echo "=== STBR smoke start $(date -u) ===" time python /repo/code/launch.py --repo /workspace/StBR --entry main.py \ --config configs/offline/hopper-medium.yml \ --method stbr --fraction 0.1 --seed 0 --max_timesteps 20000 \ --out /out/stbr_f0.1_s0_smoke > /out/logs/stbr_smoke.log 2>&1 \ || echo "STBR_SMOKE_EXIT_NONZERO" echo "=== STBR smoke log tail ==="; tail -30 /out/logs/stbr_smoke.log # ---------- 4. SPOT smoke: VAE on the SAME subset, then policy, 20k steps ---------- echo "=== SPOT VAE smoke start $(date -u) ===" time python /repo/code/launch.py --repo /workspace/SPOT --entry train_vae.py \ --method spot --fraction 0.1 --seed 0 \ --out /out/spot_f0.1_s0_smoke_vae \ --extra_args --env hopper --dataset medium > /out/logs/spot_vae_smoke.log 2>&1 \ || echo "SPOT_VAE_SMOKE_EXIT_NONZERO" echo "=== SPOT VAE log tail ==="; tail -5 /out/logs/spot_vae_smoke.log VAE_PT=$(ls /workspace/SPOT/runs/train_vae/hopper_medium/*/model/vae_model_hopper_medium_b0.5_100000.pt 2>/dev/null | head -1) echo "VAE_PT=$VAE_PT" if [ -n "$VAE_PT" ]; then mkdir -p /workspace/SPOT/models/vae_trained_models cp "$VAE_PT" /workspace/SPOT/models/vae_trained_models/vae_model_hopper_medium.pt fi echo "=== SPOT policy smoke start $(date -u) ===" time python /repo/code/launch.py --repo /workspace/SPOT --entry main.py \ --config configs/offline/hopper-medium.yml \ --method spot --fraction 0.1 --seed 0 --max_timesteps 20000 \ --out /out/spot_f0.1_s0_smoke > /out/logs/spot_smoke.log 2>&1 \ || echo "SPOT_SMOKE_EXIT_NONZERO" echo "=== SPOT smoke log tail ==="; tail -30 /out/logs/spot_smoke.log # ---------- 5. collect artifacts ---------- mkdir -p /out/run_dirs [ -d /workspace/StBR/runs ] && cp -r /workspace/StBR/runs /out/run_dirs/stbr_runs_smoke [ -d /workspace/SPOT/runs ] && cp -r /workspace/SPOT/runs /out/run_dirs/spot_runs_smoke echo "=== /out tree ==="; find /out -maxdepth 3 | head -60 echo "=== SMOKE DONE $(date -u) ==="