Download scripts/train_single_speaker.sh from Skyrmion/naturaltts_data: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/datasets/Skyrmion/naturaltts_data/resolve/main/scripts/train_single_speaker.sh
- Command line
-
hf download hf://datasets/Skyrmion/naturaltts_data/scripts/train_single_speaker.sh
-
curl -L -o train_single_speaker.sh https://huggingface.co/datasets/Skyrmion/naturaltts_data/resolve/main/scripts/train_single_speaker.sh
2.33 kB
| # Single-speaker conversation-aware SFT of MOSS-TTS Local v1.5 on /data/mukil/datasets/fused. | |
| # GPUS=2,3,4,5 BS=4 ACCUM=4 RUN_NAME=... bash train_single_speaker.sh [extra sft.py args] | |
| # Needs WANDB_API_KEY in the environment when REPORT_TO=wandb. Resume: RESUME_FROM=<out>/checkpoint-step-N. | |
| set -euo pipefail | |
| GPUS="${GPUS:-2,3,4,5}" | |
| NPROC=$(awk -F, '{print NF}' <<< "${GPUS}") | |
| DATA=/data/mukil/datasets/fused | |
| RUN_NAME="${RUN_NAME:-moss_v15_single_speaker_fused_bs64}" | |
| OUTPUT_DIR="${OUTPUT_DIR:-${DATA}/runs/${RUN_NAME}}" | |
| TRAIN_JSONL="${TRAIN_JSONL:-${DATA}/jsonl}" | |
| REPORT_TO="${REPORT_TO:-wandb}" | |
| RESUME_ARGS=(); [[ -n "${RESUME_FROM:-}" ]] && RESUME_ARGS=(--resume-from "${RESUME_FROM}") | |
| export CUDA_VISIBLE_DEVICES="${GPUS}" HF_HOME=/data/mukil/hf HF_HUB_OFFLINE=1 \ | |
| OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 TOKENIZERS_PARALLELISM=false \ | |
| PYTORCH_ALLOC_CONF=expandable_segments:True WANDB_DIR="${DATA}/wandb" | |
| mkdir -p "${OUTPUT_DIR}" "${WANDB_DIR}" | |
| cd "${DATA}/tts" | |
| PY=/data/mukil/mininconda3/envs/moss-tts/bin | |
| "${PY}/accelerate" launch --num_processes "${NPROC}" --num_machines 1 --mixed_precision bf16 --dynamo_backend no \ | |
| --main_process_port "${PORT:-29531}" \ | |
| moss_tts_local_v1.5/finetuning/sft.py \ | |
| --task single_speaker \ | |
| --model-path OpenMOSS-Team/MOSS-TTS-Local-Transformer-v1.5 \ | |
| --codec-path OpenMOSS-Team/MOSS-Audio-Tokenizer-v2 \ | |
| --codec-weight-dtype fp32 --codec-compute-dtype bf16 \ | |
| --train-jsonl "${TRAIN_JSONL}" \ | |
| --prompt-index-dir "${DATA}/prompt_index" \ | |
| --reference-drop-prob 0.1 --context-drop-prob 0.3 --instruction-drop-prob 0.3 \ | |
| --speaker-loss-weight "${SPEAKER_LOSS_WEIGHT:-0.1}" --speaker-model microsoft/wavlm-base-plus-sv \ | |
| --per-device-batch-size "${BS:-4}" --gradient-accumulation-steps "${ACCUM:-4}" \ | |
| --learning-rate 1.0e-5 --warmup-steps 200 --lr-scheduler-type cosine --num-epochs 1 \ | |
| --mixed-precision bf16 --channelwise-loss-weight 1,32 --gradient-checkpointing \ | |
| --num-workers 4 --skip-nonfinite-batches \ | |
| --save-steps "${SAVE_STEPS:-1000}" --eval-steps "${EVAL_STEPS:-1000}" --eval-num-samples "${EVAL_SAMPLES:-32}" \ | |
| --output-dir "${OUTPUT_DIR}" --report-to "${REPORT_TO}" \ | |
| --wandb-project "${WANDB_PROJECT:-moss-tts-single-speaker}" --run-name "${RUN_NAME}" \ | |
| "${RESUME_ARGS[@]}" "$@" 2>&1 | tee -a "${OUTPUT_DIR}/train.log" | |