tiny-voca-da / recipe /scripts /voice_night.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.89 kB
#!/usr/bin/env bash
# Night of 2026-11-25: two voice-model fine-tunes against "too still" long vowels.
# User verdict on round 7: C (least buzz, 0.40 vs real 0.33) is "the best now, just a little
# better than before". Buzz is no longer the main thing the ear hears. Measured
# (work/vowel_motion.py, voiced runs >= 150 ms, frame-to-frame log-mel change): TTS moves
# 12-16% less than the real speaker above 1 kHz (1-2k 0.421 vs 0.479, 2-4k 0.379 vs 0.442,
# 4-8k 0.334 vs 0.398). Copy synthesis keeps the real motion, so this is the voice model.
# English tiny-voca moves more than either (1-2k 0.60-0.63).
# Both runs branch from v3-trim 100k (runs/v3trim-en-gan/last.pt) with the vml config
# (vocos_mel_loss 10; the texture term is only computed with it), 20k steps:
# T (GPU 0): --texture 20, match the amount of frame-to-frame change above 2 kHz
# (tiny-voca-it round 10: detail 0.88 -> 0.93-0.95);
# M (GPU 1): --mel-critic, an adversarial critic on the Vocos log-mel above 1 kHz.
# Starts when round 7 (vocoder C/D) ends; round 8 was cancelled before it started.
# Run detached in the v3 image:
# docker compose run -d --name tiny-voca-dk-voice-night kit-v3 \
# bash -c "bash scripts/voice_night.sh > checks/voice-night.log 2>&1"
# Stop cleanly: touch runs/v3trim-{tex,mc}/STOP.
set -uo pipefail
cd /opt/kit
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; }
ANN=data/v3trim-prepared/annotations
stamp wait-round7
until grep -q "^exit=0" checks/round7-chain.log 2>/dev/null; do sleep 60; done
cp --update=none runs/vocoder-r7-C/vocoder.pt models/vocoder-r7-C-s132000.pt
cp --update=none runs/vocoder-r7-D/vocoder.pt models/vocoder-r7-D-s132000.pt
run() { # name, gpu, extra flags...
local name=$1 gpu=$2; shift 2
local out=runs/v3trim-$name
local start=(--init-from runs/v3trim-en-gan/last.pt); [[ -f "$out/last.pt" ]] && start=(--resume "$out/last.pt")
wait_gpu "$gpu" 13e9
stamp "$name"
CUDA_VISIBLE_DEVICES=$gpu python -m tiny_voca.train --train "$ANN/train.jsonl" --validation "$ANN/validation.jsonl" \
--config work/config.v3trim-vml.json --output "$out" --device cuda --steps 120000 --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" "${start[@]}" "$@" >> "$out.log" 2>&1
local code=$?
[[ $code -eq 0 ]] && python tiny-voca/scripts/export_checkpoint.py --checkpoint "$out/last.pt" \
--output "models/v3trim-$name-s120000.pt" > /dev/null
echo "$name exit=$code $(date -u +%FT%TZ)"
}
run tex 0 --texture 20 &
run mc 1 --mel-critic &
wait
echo "exit=0 (see the tex/mc exit lines above)"