File size: 2,352 Bytes
adabee1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Night of 2026-11-26, parts 7/8: continue a vocoder-texture run at mel 2 (the strongest buzz
# lever, round 8 E / Ctex-m2) while keeping the vocoder texture term, so the fitted vocoder can
# have both less buzz and T2's vowel motion. Same recipe as Ctex-m2: init the finished run's
# last.pt, fresh cosine 5e-5, 500 warm-up, 20k more steps, T2's pairs.
#   bash scripts/night7_chain.sh GPU WAIT_LOG INIT_RUN OUT VTEX
# e.g. (GPU 0, after night5):
#   docker compose run -d --name tiny-voca-dk-night7 kit-v3 bash -c \
#     "bash scripts/night7_chain.sh 0 checks/night5-chain.log runs/vocoder-r12-CT2-vtex runs/vocoder-r14-CT2-vtex-m2 5 > checks/night7-chain.log 2>&1"
set -uo pipefail
cd /opt/kit
GPU=$1 WAIT_LOG=$2 INIT=$3 OUT=$4 VTEX=$5

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; }

stamp "wait $WAIT_LOG"
until grep -q "^exit=" "$WAIT_LOG" 2>/dev/null; do sleep 60; done
if ! grep -q "^exit=0" "$WAIT_LOG"; then echo "exit=1 stage=wait (previous run failed)"; exit 1; fi
if [[ -f "$OUT/last.pt" ]]; then START=(--resume); STEPS=$(cat "$OUT.steps")
else
  START=(--init-from "$INIT/last.pt" --fresh-schedule)
  STEPS=$(( $(python -c "import torch; print(torch.load('$INIT/last.pt', map_location='cpu', weights_only=False)['step'])") + 20000 ))
  echo "$STEPS" > "$OUT.steps"
fi
wait_gpu "$GPU" 8e9
stamp "vocoder init=$INIT vtex=$VTEX steps=$STEPS"
CUDA_VISIBLE_DEVICES=$GPU VOCODER_TEXTURE=$VTEX VOCODER_TEXTURE_LOW_HZ=1000 python scripts/train_vocoder_texture.py "${START[@]}" \
  --prior --prior-high-hz 2500 --prior-high-gain 0.05 --prior-gain-range 0.0 0.1 --mel-weight 2 \
  --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)"