#!/usr/bin/env bash # Night of 2026-11-26, parts 9/10: fit vocoder C to T2's pairs with the paired crops graded on a # time-smoothed spectrum (scripts/train_vocoder_smooth.py), so the fitting can cut the buzz # without teaching the vocoder to flatten T2's vowel motion. Recipe otherwise as Ctex / vtex: # init C 132k, fresh cosine 5e-5, 500 warm-up, 20k steps, T2's pairs, distillation 4. # bash scripts/night9_chain.sh GPU WAIT_LOG|none OUT MEL_WEIGHT PAIR_SMOOTH # e.g. # docker compose run -d --name tiny-voca-dk-night9 kit-v3 bash -c \ # "bash scripts/night9_chain.sh 0 none runs/vocoder-r16-CT2-sm9 5 9 > checks/night9-chain.log 2>&1" set -uo pipefail cd /opt/kit GPU=$1 WAIT_LOG=$2 OUT=$3 MEL=$4 SMOOTH=$5 STEPS=${STEPS:-152000} # C is at 132000; STEPS=192000 = 60k more stamp() { echo "== stage $1 $(date -u +%FT%TZ)"; } 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; } if [[ $WAIT_LOG != none ]]; then stamp "wait $WAIT_LOG" until grep -q "^exit=" "$WAIT_LOG" 2>/dev/null; do sleep 60; done fi START=(--init-from runs/vocoder-r7-C/last.pt --fresh-schedule); [[ -f "$OUT/last.pt" ]] && START=(--resume) wait_gpu "$GPU" 8e9 stamp "vocoder mel=$MEL smooth=$SMOOTH" CUDA_VISIBLE_DEVICES=$GPU PAIR_SMOOTH=$SMOOTH 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 "$MEL" \ --manifests data/full-features/train.jsonl --validation data/full-features/validation.jsonl --output "$OUT" \ --steps "$STEPS" --learning-rate 5e-5 --warmup 500 --batch 32 --teacher vocos --distill-mode spectrum --distill-weight 4 \ --pairs data/vocoder-pairs-tex1k140k/train/pairs.jsonl --pair-fraction 0.7 \ --device cuda --workers 6 --save-every 1000 --keep-every 4000 >> "$OUT.log" 2>&1 code=$? [[ $code -eq 0 ]] && cp --update=none "$OUT/vocoder.pt" "models/$(basename "$OUT")-s$STEPS.pt" echo "exit=$code $(date -u +%FT%TZ)"