Download code/train_Japanese.sh from davidguzmanr/VITS-JSUT-Japanese: direct link, hf CLI and curl.
- Browser
- Download file 3.32 kB
-
https://huggingface.co/davidguzmanr/VITS-JSUT-Japanese/resolve/main/code/train_Japanese.sh
- Command line
-
hf download hf://davidguzmanr/VITS-JSUT-Japanese/code/train_Japanese.sh
-
curl -L -o train_Japanese.sh https://huggingface.co/davidguzmanr/VITS-JSUT-Japanese/resolve/main/code/train_Japanese.sh
3.32 kB
| #SBATCH --job-name=vits_Japanese | |
| #SBATCH --partition=main | |
| #SBATCH --nodes=1 | |
| #SBATCH --gres=gpu:l40s:2 | |
| #SBATCH --cpus-per-task=8 | |
| #SBATCH --mem=32G | |
| #SBATCH --time=2-00:00:00 | |
| #SBATCH --output=jobs/logs/vits_Japanese-%j.out | |
| #SBATCH --mail-type=END,FAIL | |
| # Japanese VITS on JSUT with the Open Bible VITS recipe (open-bible-models/jobs/VITS/VITS-Open-Bible-Yoruba.sh): same scripts | |
| # (copies in vits/; train_vits.py only adds a fix so a resumed job stops at --target_steps) and the same settings: 22,050 Hz, | |
| # global batch 64 over 2 GPUs, 250k steps, fp16, no eval split, a checkpoint every 5k steps (5 kept). The only training | |
| # difference is the input text: katakana from vits/prepare_jsut.py instead of the raw script. Measured on one L40S at batch 32: | |
| # ~0.5 s per step. Submit from the repo root: | |
| # python vits/prepare_jsut.py # once, env CoquiTTS: writes data/JSUT-VITS/metadata.csv | |
| # sbatch vits/train_Japanese.sh | |
| # A preempted or timed-out job resumes from the newest checkpoint under $OUT when resubmitted (train_vits.py auto-resume), so | |
| # keep smoke tests in their own OUT. Overrides (environment): TARGET_STEPS, GLOBAL_BATCH, SAVE_STEP, PRINT_STEP, OUT, STAGE. | |
| # Smoke test on the GPU of an interactive allocation (1 GPU, batch 32, a few hundred steps): | |
| # TARGET_STEPS=400 GLOBAL_BATCH=32 SAVE_STEP=200 PRINT_STEP=50 OUT=checkpoints/VITS-Japanese-smoke bash vits/train_Japanese.sh | |
| set -eo pipefail | |
| REPO=/network/scratch/g/guzmand/Repositories/Multilingual-MOS | |
| cd "$REPO" | |
| TARGET_STEPS="${TARGET_STEPS:-250000}" | |
| GLOBAL_BATCH="${GLOBAL_BATCH:-64}" | |
| SAVE_STEP="${SAVE_STEP:-5000}" | |
| PRINT_STEP="${PRINT_STEP:-5000}" | |
| OUT="$(realpath -m "${OUT:-checkpoints/VITS-Japanese}")" | |
| STAGE="${STAGE:-${SLURM_TMPDIR:-$(mktemp -d)}}" # node-local copy of the resampled audio, rebuilt by every job | |
| DATA_SRC="$REPO/data/JSUT-VITS" | |
| DATA_DST="$STAGE/data/JSUT-VITS" | |
| START_TIME=$(date +%s) | |
| echo "Job ${SLURM_JOB_ID:-local} starting on $(hostname) at $(date)" | |
| module load miniconda/3 gcc/9.3.0 cuda/12.3.2 # as in the Open Bible jobs | |
| export WANDB_MODE=disabled | |
| conda activate CoquiTTS | |
| nvidia-smi --query-gpu=name,memory.total --format=csv,noheader | |
| NUM_GPUS=$(nvidia-smi -L | wc -l) | |
| [ -f "$DATA_SRC/metadata.csv" ] || { echo "no $DATA_SRC/metadata.csv: run python vits/prepare_jsut.py first"; exit 1; } | |
| echo "Resampling JSUT to 22,050 Hz mono into $DATA_DST ..." | |
| python vits/preprocess_open_bible_audio.py --metadata "$DATA_SRC/metadata.csv" --output-dir "$DATA_DST" --target-sample-rate 22050 | |
| ARGS=(--metadata "$DATA_DST/metadata.csv" --language ja --output_path "$OUT" | |
| --global_batch_size "$GLOBAL_BATCH" --num_gpus "$NUM_GPUS" --target_steps "$TARGET_STEPS" | |
| --sample_rate 22050 --win_length 1024 --hop_length 256 --num_mels 80 | |
| --save_step "$SAVE_STEP" --save_n_checkpoints 5 --print_step "$PRINT_STEP" --no_eval --run_name vits_japanese) | |
| echo "Training on $NUM_GPUS GPU(s): ${ARGS[*]}" | |
| if [ "$NUM_GPUS" -gt 1 ]; then | |
| python -m trainer.distribute --script vits/train_vits.py --gpus "$(seq -s, 0 $((NUM_GPUS - 1)))" "${ARGS[@]}" | |
| else | |
| python vits/train_vits.py "${ARGS[@]}" | |
| fi | |
| DURATION=$(( $(date +%s) - START_TIME )) | |
| echo "Job ${SLURM_JOB_ID:-local} finished on $(hostname) at $(date), $((DURATION / 3600))h $(((DURATION % 3600) / 60))m" | |