| #!/bin/bash | |
| #SBATCH --job-name=sa_test_set | |
| #SBATCH --mail-type=FAIL,END | |
| #SBATCH --mail-user=dingqy@umich.edu | |
| #SBATCH --nodes=1 | |
| #SBATCH --ntasks-per-node=1 | |
| #SBATCH --cpus-per-task=4 | |
| #SBATCH --mem-per-cpu=11GB | |
| #SBATCH --time=4:00:00 | |
| #SBATCH --account=ahowens1 | |
| #SBATCH --partition=spgpu | |
| #SBATCH --qos=foe | |
| #SBATCH --reservation=spgpu_foe_nodes | |
| #SBATCH --gres=gpu:a40:1 | |
| #SBATCH --output=/nfs/turbo/coe-ahowens-nobackup/dingqy/sa_test_set-%j.log | |
| # | |
| # Stable Audio Open bulk inference on the full 3919-pair test set. | |
| # | |
| # Best ckpt picked from the full lbkb1h5z + dbdxldk4 chain (combined steps | |
| # 1 → 37743). Smoothed (200-step rolling mean) train/loss minimum lives at | |
| # lbkb1h5z step ~9601 (mean=0.610), vs dbdxldk4's plateau ~0.62. Closest | |
| # saved ckpt = lbkb1h5z step 10000. The earlier best_ckpts.json picked | |
| # dbdxldk4 step 30000 (test MSE 0.283), but that eval may have only | |
| # considered dbdxldk4-era ckpts. | |
| # | |
| # Output: /nfs/turbo/coe-ahowens-nobackup/dingqy/inference_demo/sa_test_set/<rel_path>/{bg,fg_pred,mix}.wav | |
| # LUFS protocol: bg=-30 (FIXED), mix=-23 (binary search on fg gain). | |
| set -eu | |
| source /nfs/turbo/coe-ahowens-nobackup/dingqy/miniforge3/etc/profile.d/conda.sh | |
| source /home/dingqy/.hf_token | |
| export HF_CACHE=/nfs/turbo/coe-ahowens-nobackup/dingqy/.cache/huggingface | |
| conda activate stable-audio | |
| # Override SA_CKPT_PATH on sbatch CLI to swap ckpts (e.g. for A/B comparison). | |
| : "${SA_CKPT_PATH:=sa_open_bg2fg_rebalance/lbkb1h5z/epoch=0-step=10000.ckpt}" | |
| export SA_CKPT_PATH | |
| # Download from HF (cached, so re-runs are free). | |
| SA_CKPT=$(python - <<'PYEOF' | |
| from huggingface_hub import hf_hub_download | |
| import os | |
| p = hf_hub_download(repo_id="AE-W/ckpt", | |
| filename=os.environ["SA_CKPT_PATH"], | |
| repo_type="dataset", | |
| cache_dir=os.environ["HF_CACHE"]) | |
| print(p, end="") | |
| PYEOF | |
| ) | |
| echo "ckpt: $SA_CKPT" | |
| # OUT_DIR overridable so A/B comparison runs (e.g. step 10000 vs 30000) write | |
| # to separate folders without overwriting each other. | |
| : "${OUT_DIR:=/nfs/turbo/coe-ahowens-nobackup/dingqy/inference_demo/sa_test_set}" | |
| python /nfs/turbo/coe-ahowens-nobackup/dingqy/infer_sa_test_set.py \ | |
| --ckpt "$SA_CKPT" \ | |
| --out "$OUT_DIR" \ | |
| --steps 100 --cfg-scale 1.0 \ | |
| --batch-size 4 | |
| echo "" | |
| echo "=== sample subfolder check ===" | |
| SAMPLE_DIR=$(find "$OUT_DIR" -name "mix.wav" 2>/dev/null | head -1 | xargs dirname 2>/dev/null) | |
| echo "first subfolder: $SAMPLE_DIR" | |
| [ -n "$SAMPLE_DIR" ] && ls -la "$SAMPLE_DIR" | |
| echo "" | |
| echo "=== count ===" | |
| find "$OUT_DIR" -name "mix.wav" 2>/dev/null | wc -l | |
| echo "done" | |