tiny-voca-da / recipe /scripts /pairs_round7.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
2.7 kB
#!/usr/bin/env bash
# Round 7 vocoder fine-tunes (queued 2026-11-25 ~16:40 UTC), both from B =
# runs/vocoder-da-hb-pairs-vv/last.pt at 112k (pairs with TTS voicing; AGENTS.md Round 4).
# After the pairs, the vocoder's own share is the largest left: copy synthesis 0.44 vs real
# 0.33 at 1-2 kHz (Vocos 0.38).
# C (GPU 0): --mel-weight 5. The adversarial share grows; tiny-voca-it's review blamed weak
# critics (averaged over 8 networks, ~8x weaker than Vocos' sum) for over-locking.
# D (GPU 1): --mel-weight 15, the control: the same extra steps without the change.
# Both use a fresh cosine schedule (--fresh-schedule) at 5e-5 with 500 warm-up steps, for 20k
# steps (112k -> 132k). That is near the ~4e-5 the A/B runs started at. Same pairs, high band
# and teacher.
# Run detached in the v3 image:
# docker compose run -d --name tiny-voca-dk-round7 kit-v3 \
# bash -c "bash scripts/pairs_round7.sh > checks/round7-chain.log 2>&1"
set -uo pipefail
cd /opt/kit
stamp() { echo "== stage $1 $(date -u +%FT%TZ)"; }
wait_for() { # log, pattern; gives up if that chain failed
until grep -q "$2" "$1" 2>/dev/null; do
grep -q "^exit=1" "$1" 2>/dev/null && { echo "exit=1 waiting for $1"; exit 1; }
sleep 60; done; }
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; }
PAIRS=data/vocoder-pairs-v3trim100k-vv/train/pairs.jsonl
INIT=runs/vocoder-da-hb-pairs-vv/last.pt
stamp wait-ab
wait_for checks/pairs-vv-chain.gpu0.log "^exit=0"
wait_for checks/pairs-chain.log "^exit=0"
cp --update=none runs/vocoder-da-hb-pairs-vv/vocoder.pt models/vocoder-da-hb-pairs-vv-s112000.pt
cp --update=none runs/vocoder-da-hb-pairs/vocoder.pt models/vocoder-da-hb-pairs-s112000.pt
run() { # name, gpu, mel weight
local out=runs/vocoder-r7-$1
local start=(--init-from "$INIT" --fresh-schedule); [[ -f "$out/last.pt" ]] && start=(--resume)
wait_gpu "$2" 8e9
stamp "$1"
CUDA_VISIBLE_DEVICES=$2 python -m tiny_voca.train_vocoder "${start[@]}" --prior --prior-high-hz 2500 --prior-high-gain 0.05 \
--prior-gain-range 0.0 0.1 --mel-weight "$3" \
--manifests data/full-features/train.jsonl --validation data/full-features/validation.jsonl --output "$out" \
--steps 132000 --learning-rate 5e-5 --warmup 500 --batch 32 --teacher vocos --distill-mode spectrum --distill-weight 4 \
--pairs "$PAIRS" --pair-fraction 0.7 \
--device cuda --workers 6 --save-every 1000 --keep-every 5000 >> "$out.log" 2>&1
echo "$1 exit=$? $(date -u +%FT%TZ)"
}
run C 0 5 &
run D 1 15 &
wait
echo "exit=0 (see the C/D exit lines above)"