#!/bin/bash
# Wait for mels to finish regenerating, then resume v1 training

echo "Waiting for mels to finish..."
while [ $(ls /home/ubuntu/lewm-tts/processed_data/mels/ 2>/dev/null | wc -l) -lt 7009 ]; do
    sleep 10
done
echo "Mels ready: $(ls /home/ubuntu/lewm-tts/processed_data/mels/ | wc -l)"

echo "Starting v1 training from epoch 70, 1000 total epochs..."
cd /home/ubuntu/lewm-tts
python3 -u train.py \
    --epochs 300 \
    --batch_size 64 \
    --lr 1e-4 \
    --kl_weight 0.1 \
    --recon_weight 1.0 \
    --num_workers 4 \
    --print_every 20 \
    --log_every 5 \
    --save_every 50 \
    --resume output/checkpoints/epoch_0070.pt \
    --output_dir /home/ubuntu/lewm-tts/output
