tiny-voca-da / recipe /scripts /night12_chain.sh
inlanger's picture
tiny-voca-da v0.1: frontend v4 + sm9 vocoder (ONNX fp32/int8, PyTorch, frontend, recipe, samples)
adabee1 verified
Raw History Blame Contribute Delete
3.04 kB
#!/usr/bin/env bash
# 2026-11-26 morning, part 12 (GPU 0). The texture voice model T2 (140k) is in both of the
# morning's candidates (T2 + C and T2 + sm9), so train it further while the user listens:
# 1. T3 = T2 continued 140k -> 180k, same recipe (texture 20 from 1 kHz), runs/v3trim-tex1k-180k;
# 2. vocoder pairs from T3;
# 3. vocoder C fitted to T3's pairs with 9-frame pair smoothing (the sm9 recipe), runs/vocoder-r19-CT3-sm9.
# Scored by work/eval_when.sh as tex1k180k-vocC132k and tex1k180k-vocCT3sm9.
# docker compose run -d --name tiny-voca-dk-night12 kit-v3 \
# bash -c "bash scripts/night12_chain.sh > checks/night12-chain.log 2>&1"
set -uo pipefail
cd /opt/kit
stamp() { echo "== stage $1 $(date -u +%FT%TZ)"; }
fail() { echo "exit=1 stage=$1"; exit 1; }
wait_gpu() { # device index, free bytes needed
until CUDA_VISIBLE_DEVICES=$1 python -c "import sys, torch; sys.exit(0 if torch.cuda.mem_get_info(0)[0] > $2 else 1)" 2>/dev/null
do sleep 30; done; }
GPU=${GPU:-0}
ANN=data/v3trim-prepared/annotations
OUT=runs/v3trim-tex1k-180k
VOICE=models/v3trim-tex1k-s180000.pt
PAIRS=data/vocoder-pairs-tex1k180k
VOC=runs/vocoder-r19-CT3-sm9
if [[ ! -f "$VOICE" ]]; then
START=(--init-from runs/v3trim-tex1k/last.pt); [[ -f "$OUT/last.pt" ]] && START=(--resume "$OUT/last.pt")
wait_gpu "$GPU" 13e9
stamp voice
CUDA_VISIBLE_DEVICES=$GPU TEXTURE_LOW_HZ=1000 python scripts/train_texture_low.py \
--train "$ANN/train.jsonl" --validation "$ANN/validation.jsonl" \
--config work/config.v3trim-vml.json --output "$OUT" --device cuda --steps 180000 --batch-frames 9000 --max-batch 32 \
--gan-start 8000 --gan-ratio 0.7 --teacher-final 0 --save-every 1000 --keep-every 5000 --log-every 50 \
--max-seconds inf --stop-file "$OUT/STOP" --texture 20 "${START[@]}" >> "$OUT.log" 2>&1 || fail voice
python tiny-voca/scripts/export_checkpoint.py --checkpoint "$OUT/last.pt" --output "$VOICE" > /dev/null || fail export
fi
if [[ ! -f "$PAIRS/train/pairs.jsonl" ]]; then
stamp pairs
CUDA_VISIBLE_DEVICES=$GPU python scripts/make_pairs.py --checkpoint "$VOICE" \
--annotations "$ANN/train.jsonl" --output "$PAIRS/train" --device cuda | tail -1 || fail pairs
fi
START=(--init-from runs/vocoder-r7-C/last.pt --fresh-schedule); [[ -f "$VOC/last.pt" ]] && START=(--resume)
wait_gpu "$GPU" 8e9
stamp vocoder
CUDA_VISIBLE_DEVICES=$GPU PAIR_SMOOTH=9 python scripts/train_vocoder_smooth.py "${START[@]}" \
--prior --prior-high-hz 2500 --prior-high-gain 0.05 --prior-gain-range 0.0 0.1 --mel-weight 5 \
--manifests data/full-features/train.jsonl --validation data/full-features/validation.jsonl --output "$VOC" \
--steps 152000 --learning-rate 5e-5 --warmup 500 --batch 32 --teacher vocos --distill-mode spectrum --distill-weight 4 \
--pairs "$PAIRS/train/pairs.jsonl" --pair-fraction 0.7 \
--device cuda --workers 6 --save-every 1000 --keep-every 4000 >> "$VOC.log" 2>&1 || fail vocoder
cp --update=none "$VOC/vocoder.pt" models/vocoder-r19-CT3-sm9-s152000.pt
echo "exit=0 $(date -u +%FT%TZ)"