tiny-voca-da / recipe /scripts /eval_vocoder.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.18 kB
#!/usr/bin/env bash
# Score one voice + vocoder combination the same way every time (CPU, Docker; run on the GPU
# host from ~/stacks/tiny-voca-dk):
# bash scripts/eval_vocoder.sh NAME VOICE.pt VOCODER.pt [render_pair/tf_synth flags, e.g. --high-gain 0.0]
# Writes:
# out/probes-NAME, out/val-NAME free-running TTS (render_pair: dsp + vocoded)
# out/tf-NAME teacher-forced with TTS voicing (tf_synth --voiced-vowels)
# checks/locking/NAME.json pulse locking: TTS val120 + teacher-forced 64
# checks/quality/NAME.json DNSMOS/UTMOS on the 20 probes
# checks/asr/NAME.json Whisper large-v3 CER/WER on val120
set -uo pipefail
NAME=$1; VOICE=$2; VOCODER=$3; shift 3
RUN="docker compose run --rm -T -e CUDA_VISIBLE_DEVICES= -e OMP_NUM_THREADS=3 ${KIT_SERVICE:-kit-v3} python" # KIT_SERVICE=kit-v4 for frontend-v4 models
TOOLS="docker compose --profile tools run --rm -T -e OMP_NUM_THREADS=5"
quiet() { grep -v -i "orphan\|^ Container" || true; }
( $RUN scripts/render_pair.py --checkpoint "$VOICE" --vocoder "$VOCODER" --set probes_da.jsonl --output "out/probes-$NAME" "$@" 2>&1 | tail -1 ) &
( $RUN scripts/render_pair.py --checkpoint "$VOICE" --vocoder "$VOCODER" --set out/val120.jsonl --output "out/val-$NAME" "$@" 2>&1 | tail -1 ) &
( $RUN scripts/tf_synth.py --checkpoint "$VOICE" --vocoder "$VOCODER" --annotations data/v3trim-prepared/annotations/validation.jsonl \
--ids out/val120.jsonl --voiced-vowels --output "out/tf-$NAME" "$@" 2>&1 | tail -1 ) &
wait
( $TOOLS quality python scripts/pulse_locking.py --out "checks/locking/$NAME.json" \
--group "$NAME TTS=out/val-$NAME/vocoded/*.wav" --group "$NAME teacher-forced=out/tf-$NAME/tf_vocoded/*.wav" \
--group "$NAME copy (TTS voicing)=out/tf-$NAME/copy/*.wav" 2>&1 | grep "n=" ) &
( $TOOLS quality python scripts/quality.py --out "checks/quality/$NAME.json" \
--group "$NAME probes=out/probes-$NAME/vocoded/*.wav" 2>&1 | grep "n=" ) &
( $TOOLS -e MKL_NUM_THREADS=5 asr python scripts/intelligibility.py --ids out/val120.jsonl --out "checks/asr/$NAME.json" \
--group "$NAME=out/val-$NAME/render.json:vocoded" 2>&1 | quiet | tail -1 ) &
wait