buddi-asr-source-code / docs /GPU_TRAINING.md
mrchatgpt's picture
Initial commit of buddi-asr source
f4931e8 verified
|
Raw History Blame Contribute Delete
2.48 kB
# Real GPU training
`scripts/train_gpu.sh` is the one-command path from a CUDA machine to a real, resumable Whisper checkpoint. It can bootstrap the Python environment, prepare Abjad-Kids when manifests are absent, size the batch from available VRAM, run a strict preflight, train on one or several GPUs, and preserve runtime metadata.
Start on a persistent disk with an NVIDIA PyTorch image:
```bash
cd /workspace/buddi-asr
chmod +x scripts/train_gpu.sh
# Twenty-step integration run
./scripts/train_gpu.sh tiny-lora --smoke
# Full run; automatically resumes a complete checkpoint
./scripts/train_gpu.sh tiny-lora
```
Available profiles are `tiny-lora`, `tiny-full`, `base-lora`, and `base-full`. Tiny LoRA is the recommended first baseline. The automatic batch choice is conservative but cannot predict every driver/model combination; halve `--train-batch-size` after an out-of-memory error.
Use the official [PyTorch install selector](https://pytorch.org/get-started/locally/) when the base image does not already expose CUDA to PyTorch. You can pass its wheel index with `--torch-index-url`.
## Useful overrides
```bash
# Low-memory GPU
./scripts/train_gpu.sh tiny-lora \
--train-batch-size 2 \
--eval-batch-size 1 \
--gradient-accumulation 16
# Two local GPUs through Accelerate
./scripts/train_gpu.sh base-lora --num-gpus 2
# Select physical devices explicitly
CUDA_VISIBLE_DEVICES=2,3 ./scripts/train_gpu.sh base-lora --num-gpus 2
# Existing environment and prepared manifests
./scripts/train_gpu.sh tiny-lora --skip-install --prepare-data no
# Stable checkpoint/output location
./scripts/train_gpu.sh tiny-lora \
--output-dir /workspace/models/buddi-tiny-lora \
--resume auto
```
The preflight rejects missing audio, speaker overlap across train/validation/test, repeated audio across splits, unavailable CUDA, unsupported BF16, and incomplete explicit checkpoints before training starts. Every run stores the resolved config, Trainer state, validation metrics, library versions, CUDA runtime, and GPU details beside the output.
The held-out test set is deliberately not evaluated after every experiment. Freeze the candidate using validation results, then run once:
```bash
buddi-asr evaluate \
artifacts/tiny-lora/final \
data/manifests/splits/test.jsonl \
reports/tiny-lora-test \
--device cuda
```
See the [Persian walkthrough](GPU_TRAINING.fa.md) for RunPod details, custom Omani data, recovery, output paths, and manual commands.