tiny-voca-da / recipe /scripts /t3b_sm9.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.16 kB
#!/usr/bin/env bash
# The control voice's own sm9 vocoder, so v4 + sm9 (scripts/v4_chain.sh) is compared with
# control + sm9 at equal steps on both sides. Runs in the kit-v3 image on GPU 1 after
# scripts/t3b_control.sh has exported models/v3trim-tex1k-s220000.pt:
# 1. vocoder pairs from that voice on the v3trim annotations;
# 2. the sm9 recipe, the same as v4_chain.sh (init C 132k, fresh schedule, 20k steps, PAIR_SMOOTH=9).
# Started by scripts/day1127_host.sh:
# docker compose run -d --name tiny-voca-dk-t3b-sm9 -e GPU=1 kit-v3 bash -c "bash scripts/t3b_sm9.sh > checks/t3b-sm9.log 2>&1"
set -uo pipefail
cd /opt/kit
GPU=${GPU:-1}
ANN=data/v3trim-prepared/annotations
VOICE=models/v3trim-tex1k-s220000.pt
PAIRS=data/vocoder-pairs-tex1k220k
VOC=runs/vocoder-r22-CT3b-sm9
fail() { echo "exit=1 stage=$1 $(date -u +%FT%TZ)"; exit 1; }
[[ -f "$VOICE" ]] || fail "missing $VOICE"
until CUDA_VISIBLE_DEVICES=$GPU python -c "import sys, torch; sys.exit(0 if torch.cuda.mem_get_info(0)[0] > 8e9 else 1)" 2>/dev/null
do sleep 30; done
if [[ ! -f "$PAIRS/train/pairs.jsonl" ]]; then
echo "== stage pairs $(date -u +%FT%TZ)"
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)
echo "== stage vocoder $(date -u +%FT%TZ)"
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-r22-CT3b-sm9-s152000.pt
echo "exit=0 $(date -u +%FT%TZ)"