#!/usr/bin/env bash
# house-wide (arm 1) train — the mnml v1 recipe, byte-for-byte on every hyperparameter
# except the four changes PREREG-HOUSE-ARMS.md §5.1 marks: C1 epochs 10 -> 5 (lesson 2,
# N_train 331 >= 300), C2 save-every 5 -> 1 (mnml lost its best epoch to disk economy),
# C3 the card (the training box card B, (GPU UUID withheld), 250 W, D-20260905-94), C4 the slug/paths.
# Only the corpus, the slug, the epoch count and the paths differ. That is the experiment.
set -u
RUNID="${1:?runid}"
exec music/ACE-Step-1.5/.venv/bin/python \
  music/ACE-Step-1.5/train.py --plain --yes fixed \
    --checkpoint-dir music/checkpoints \
    --model-variant turbo \
    --base-model turbo \
    --dataset-dir music/tensors/house-wide/$RUNID \
    --output-dir music/adapters/house-wide/$RUNID-r64 \
    --device cuda:0 \
    --precision bf16 \
    --num-devices 1 \
    --adapter-type lora \
    --rank 64 \
    --alpha 128 \
    --dropout 0.1 \
    --target-modules q_proj k_proj v_proj o_proj \
    --attention-type both \
    --batch-size 1 \
    --gradient-accumulation 4 \
    --lr 1e-4 \
    --scheduler-type cosine \
    --warmup-steps 100 \
    --gradient-checkpointing \
    --optimizer-type adamw \
    --shift 3.0 \
    --num-inference-steps 8 \
    --cfg-ratio 0.15 \
    --epochs 5 \
    --save-every 1 \
    --seed 42
