Spaces:
Sleeping
Sleeping
Upload f5_tts/train/README.md with huggingface_hub
Browse files- f5_tts/train/README.md +82 -0
f5_tts/train/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Training
|
| 2 |
+
|
| 3 |
+
## Prepare Dataset
|
| 4 |
+
|
| 5 |
+
Example data processing scripts, and you may tailor your own one along with a Dataset class in `src/f5_tts/model/dataset.py`.
|
| 6 |
+
|
| 7 |
+
### 1. Some specific Datasets preparing scripts
|
| 8 |
+
Download corresponding dataset first, and fill in the path in scripts.
|
| 9 |
+
|
| 10 |
+
```bash
|
| 11 |
+
# Prepare the Emilia dataset
|
| 12 |
+
python src/f5_tts/train/datasets/prepare_emilia.py
|
| 13 |
+
|
| 14 |
+
# Prepare the Wenetspeech4TTS dataset
|
| 15 |
+
python src/f5_tts/train/datasets/prepare_wenetspeech4tts.py
|
| 16 |
+
|
| 17 |
+
# Prepare the LibriTTS dataset
|
| 18 |
+
python src/f5_tts/train/datasets/prepare_libritts.py
|
| 19 |
+
|
| 20 |
+
# Prepare the LJSpeech dataset
|
| 21 |
+
python src/f5_tts/train/datasets/prepare_ljspeech.py
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
### 2. Create custom dataset with metadata.csv
|
| 25 |
+
Use guidance see [#57 here](https://github.com/SWivid/F5-TTS/discussions/57#discussioncomment-10959029).
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
python src/f5_tts/train/datasets/prepare_csv_wavs.py
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Training & Finetuning
|
| 32 |
+
|
| 33 |
+
Once your datasets are prepared, you can start the training process.
|
| 34 |
+
|
| 35 |
+
### 1. Training script used for pretrained model
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
# setup accelerate config, e.g. use multi-gpu ddp, fp16
|
| 39 |
+
# will be to: ~/.cache/huggingface/accelerate/default_config.yaml
|
| 40 |
+
accelerate config
|
| 41 |
+
|
| 42 |
+
# .yaml files are under src/f5_tts/configs directory
|
| 43 |
+
accelerate launch src/f5_tts/train/train.py --config-name F5TTS_Base_train.yaml
|
| 44 |
+
|
| 45 |
+
# possible to overwrite accelerate and hydra config
|
| 46 |
+
accelerate launch --mixed_precision=fp16 src/f5_tts/train/train.py --config-name F5TTS_Small_train.yaml ++datasets.batch_size_per_gpu=19200
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
### 2. Finetuning practice
|
| 50 |
+
Discussion board for Finetuning [#57](https://github.com/SWivid/F5-TTS/discussions/57).
|
| 51 |
+
|
| 52 |
+
Gradio UI training/finetuning with `src/f5_tts/train/finetune_gradio.py` see [#143](https://github.com/SWivid/F5-TTS/discussions/143).
|
| 53 |
+
|
| 54 |
+
The `use_ema = True` is harmful for early-stage finetuned checkpoints (which goes just few updates, thus ema weights still dominated by pretrained ones), try turn it off and see if provide better results.
|
| 55 |
+
|
| 56 |
+
### 3. Wandb Logging
|
| 57 |
+
|
| 58 |
+
The `wandb/` dir will be created under path you run training/finetuning scripts.
|
| 59 |
+
|
| 60 |
+
By default, the training script does NOT use logging (assuming you didn't manually log in using `wandb login`).
|
| 61 |
+
|
| 62 |
+
To turn on wandb logging, you can either:
|
| 63 |
+
|
| 64 |
+
1. Manually login with `wandb login`: Learn more [here](https://docs.wandb.ai/ref/cli/wandb-login)
|
| 65 |
+
2. Automatically login programmatically by setting an environment variable: Get an API KEY at https://wandb.ai/site/ and set the environment variable as follows:
|
| 66 |
+
|
| 67 |
+
On Mac & Linux:
|
| 68 |
+
|
| 69 |
+
```
|
| 70 |
+
export WANDB_API_KEY=<YOUR WANDB API KEY>
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
On Windows:
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
set WANDB_API_KEY=<YOUR WANDB API KEY>
|
| 77 |
+
```
|
| 78 |
+
Moreover, if you couldn't access Wandb and want to log metrics offline, you can the environment variable as follows:
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
export WANDB_MODE=offline
|
| 82 |
+
```
|