Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support hydra config training #518

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/f5_tts/config/E2TTS_Base_finetune.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
hydra:
run:
dir: ckpts/finetune_${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}

datasets:
name: Emilia_ZH_EN # dataset name
batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200
batch_size_type: frame # "frame" or "sample"
max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models
num_workers: 16 # number of workers

optim:
epochs: 15 # max epochs
learning_rate: 7.5e-5 # learning rate
num_warmup_updates: 20000 # warmup steps
grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps
max_grad_norm: 1.0 # gradient clipping
bnb_optimizer: False # use bnb optimizer or not

model:
name: F5TTS_Base # model name
tokenizer: pinyin # tokenizer type
tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt)
arch:
dim: 1024 # model dim
depth: 22 # model depth
heads: 16 # model heads
ff_mult: 2 # feedforward expansion
text_dim: 512 # text encoder dim
conv_layers: 4 # convolution layers
mel_spec:
target_sample_rate: 24000 # target sample rate
n_mel_channels: 100 # mel channel
hop_length: 256 # hop length
win_length: 1024 # window length
n_fft: 1024 # fft length
mel_spec_type: vocos # 'vocos' or 'bigvgan'
is_local_vocoder: False # use local vocoder or not
local_vocoder_path: None # local vocoder path

ckpts:
logger: wandb # wandb | tensorboard | None
save_per_updates: 50000 # save checkpoint per steps
last_per_steps: 5000 # save last checkpoint per steps
pretain_ckpt_path: ckpts/E2TTS_Base/model_1200000.pt
save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
43 changes: 43 additions & 0 deletions src/f5_tts/config/E2TTS_Base_train.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
hydra:
run:
dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}

datasets:
name: Emilia_ZH_EN # dataset name
batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200
batch_size_type: frame # "frame" or "sample"
max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models
num_workers: 16 # number of workers

optim:
epochs: 15 # max epochs
learning_rate: 7.5e-5 # learning rate
num_warmup_updates: 20000 # warmup steps
grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps
max_grad_norm: 1.0 # gradient clipping
bnb_optimizer: False # use bnb optimizer or not

model:
name: E2TTS_Base # model name
tokenizer: pinyin # tokenizer type
tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt)
arch:
dim: 1024 # model dimension
depth: 24 # number of transformer layers
heads: 16 # number of transformer heads
ff_mult: 4 # ff layer expansion
mel_spec:
target_sample_rate: 24000 # target sample rate
n_mel_channels: 100 # mel channel
hop_length: 256 # hop length
win_length: 1024 # window length
n_fft: 1024 # fft length
mel_spec_type: vocos # 'vocos' or 'bigvgan'
is_local_vocoder: False # use local vocoder or not
local_vocoder_path: None # path to local vocoder

ckpts:
logger: wandb # wandb | tensorboard | None
save_per_updates: 50000 # save checkpoint per steps
last_per_steps: 5000 # save last checkpoint per steps
save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
43 changes: 43 additions & 0 deletions src/f5_tts/config/E2TTS_Small_train.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
hydra:
run:
dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}

datasets:
name: Emilia_ZH_EN
batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200
batch_size_type: frame # "frame" or "sample"
max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models
num_workers: 16 # number of workers

optim:
epochs: 15
learning_rate: 7.5e-5
num_warmup_updates: 20000 # warmup steps
grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps
max_grad_norm: 1.0
bnb_optimizer: False

model:
name: E2TTS_Small
tokenizer: pinyin
tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt)
arch:
dim: 768
depth: 20
heads: 12
ff_mult: 4
mel_spec:
target_sample_rate: 24000
n_mel_channels: 100
hop_length: 256
win_length: 1024
n_fft: 1024
mel_spec_type: vocos # 'vocos' or 'bigvgan'
is_local_vocoder: False
local_vocoder_path: None

ckpts:
logger: wandb # wandb | tensorboard | None
save_per_updates: 50000 # save checkpoint per steps
last_per_steps: 5000 # save last checkpoint per steps
save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
46 changes: 46 additions & 0 deletions src/f5_tts/config/F5TTS_Base_finetune.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
hydra:
run:
dir: ckpts/finetune_${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}

datasets:
name: Emilia_ZH_EN # dataset name
batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200
batch_size_type: frame # "frame" or "sample"
max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models
num_workers: 16 # number of workers

optim:
epochs: 15 # max epochs
learning_rate: 7.5e-5 # learning rate
num_warmup_updates: 20000 # warmup steps
grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps
max_grad_norm: 1.0 # gradient clipping
bnb_optimizer: False # use bnb optimizer or not

model:
name: F5TTS_Base # model name
tokenizer: pinyin # tokenizer type
tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt)
arch:
dim: 1024 # model dim
depth: 22 # model depth
heads: 16 # model heads
ff_mult: 2 # feedforward expansion
text_dim: 512 # text encoder dim
conv_layers: 4 # convolution layers
mel_spec:
target_sample_rate: 24000 # target sample rate
n_mel_channels: 100 # mel channel
hop_length: 256 # hop length
win_length: 1024 # window length
n_fft: 1024 # fft length
mel_spec_type: vocos # 'vocos' or 'bigvgan'
is_local_vocoder: False # use local vocoder or not
local_vocoder_path: None # local vocoder path

ckpts:
logger: wandb # wandb | tensorboard | None
save_per_updates: 50000 # save checkpoint per steps
last_per_steps: 5000 # save last checkpoint per steps
pretain_ckpt_path: ckpts/F5TTS_Base/model_1200000.pt
save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
45 changes: 45 additions & 0 deletions src/f5_tts/config/F5TTS_Base_train.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
hydra:
run:
dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}

datasets:
name: Emilia_ZH_EN # dataset name
batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200
batch_size_type: frame # "frame" or "sample"
max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models
num_workers: 16 # number of workers

optim:
epochs: 15 # max epochs
learning_rate: 7.5e-5 # learning rate
num_warmup_updates: 20000 # warmup steps
grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps
max_grad_norm: 1.0 # gradient clipping
bnb_optimizer: False # use bnb optimizer or not

model:
name: F5TTS_Base # model name
tokenizer: pinyin # tokenizer type
tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt)
arch:
dim: 1024 # model dim
depth: 22 # model depth
heads: 16 # model heads
ff_mult: 2 # feedforward expansion
text_dim: 512 # text encoder dim
conv_layers: 4 # convolution layers
mel_spec:
target_sample_rate: 24000 # target sample rate
n_mel_channels: 100 # mel channel
hop_length: 256 # hop length
win_length: 1024 # window length
n_fft: 1024 # fft length
mel_spec_type: vocos # 'vocos' or 'bigvgan'
is_local_vocoder: False # use local vocoder or not
local_vocoder_path: None # local vocoder path

ckpts:
logger: wandb # wandb | tensorboard | None
save_per_updates: 50000 # save checkpoint per steps
last_per_steps: 5000 # save last checkpoint per steps
save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
45 changes: 45 additions & 0 deletions src/f5_tts/config/F5TTS_Small_train.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
hydra:
run:
dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}

datasets:
name: Emilia_ZH_EN
batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200
batch_size_type: frame # "frame" or "sample"
max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models
num_workers: 16 # number of workers

optim:
epochs: 15
learning_rate: 7.5e-5
num_warmup_updates: 20000 # warmup steps
grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps
max_grad_norm: 1.0
bnb_optimizer: False

model:
name: F5TTS_Small
tokenizer: pinyin
tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt)
arch:
dim: 768
depth: 18
heads: 12
ff_mult: 2
text_dim: 512
conv_layers: 4
mel_spec:
target_sample_rate: 24000
n_mel_channels: 100
hop_length: 256
win_length: 1024
n_fft: 1024
mel_spec_type: vocos # 'vocos' or 'bigvgan'
is_local_vocoder: False
local_vocoder_path: None

ckpts:
logger: wandb # wandb | tensorboard | None
save_per_updates: 50000 # save checkpoint per steps
last_per_steps: 5000 # save last checkpoint per steps
save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
4 changes: 2 additions & 2 deletions src/f5_tts/eval/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Then update in the following scripts with the paths you put evaluation model ckp
Update the path with your batch-inferenced results, and carry out WER / SIM evaluations:
```bash
# Evaluation for Seed-TTS test set
python src/f5_tts/eval/eval_seedtts_testset.py
python src/f5_tts/eval/eval_seedtts_testset.py --gen_wav_dir <GEN_WAVE_DIR>

# Evaluation for LibriSpeech-PC test-clean (cross-sentence)
python src/f5_tts/eval/eval_librispeech_test_clean.py
python src/f5_tts/eval/eval_librispeech_test_clean.py --gen_wav_dir
```
4 changes: 2 additions & 2 deletions src/f5_tts/eval/eval_infer_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
n_fft = 1024
target_rms = 0.1


tokenizer = "pinyin"
rel_path = str(files("f5_tts").joinpath("../../"))


Expand All @@ -49,6 +47,7 @@ def main():
parser.add_argument("-n", "--expname", required=True)
parser.add_argument("-c", "--ckptstep", default=1200000, type=int)
parser.add_argument("-m", "--mel_spec_type", default="vocos", type=str, choices=["bigvgan", "vocos"])
parser.add_argument("-to", "--tokenizer", default="pinyin", type=str, choices=["pinyin", "char"])

parser.add_argument("-nfe", "--nfestep", default=32, type=int)
parser.add_argument("-o", "--odemethod", default="euler")
Expand All @@ -64,6 +63,7 @@ def main():
ckpt_step = args.ckptstep
ckpt_path = rel_path + f"/ckpts/{exp_name}/model_{ckpt_step}.pt"
mel_spec_type = args.mel_spec_type
tokenizer = args.tokenizer

nfe_step = args.nfestep
ode_method = args.odemethod
Expand Down
Loading
Loading