Update VITS LJspeech recipe

pull/1324/head
Eren Gölge 2021-11-30 15:57:12 +01:00
parent 98057a00ae
commit 75c507c36a
2 changed files with 17 additions and 7 deletions

View File

@ -6,6 +6,7 @@ from TTS.tts.configs.shared_configs import BaseDatasetConfig
from TTS.tts.configs.vits_config import VitsConfig
from TTS.tts.datasets import load_tts_samples
from TTS.tts.models.vits import Vits
from TTS.tts.utils.text.tokenizer import TTSTokenizer
from TTS.utils.audio import AudioProcessor
output_path = os.path.dirname(os.path.abspath(__file__))
@ -35,7 +36,7 @@ config = VitsConfig(
batch_size=48,
eval_batch_size=16,
batch_group_size=5,
num_loader_workers=4,
num_loader_workers=0,
num_eval_loader_workers=4,
run_eval=True,
test_delay_epochs=-1,
@ -53,14 +54,24 @@ config = VitsConfig(
datasets=[dataset_config],
)
# init audio processor
ap = AudioProcessor(**config.audio.to_dict())
# INITIALIZE THE AUDIO PROCESSOR
# Audio processor is used for feature extraction and audio I/O.
# It mainly serves to the dataloader and the training loggers.
ap = AudioProcessor.init_from_config(config)
# load training samples
# INITIALIZE THE TOKENIZER
# Tokenizer is used to convert text to sequences of token IDs.
tokenizer = TTSTokenizer.init_from_config(config)
# LOAD DATA SAMPLES
# Each sample is a list of ```[text, audio_file_path, speaker_name]```
# You can define your custom sample loader returning the list of samples.
# Or define your custom formatter and pass it to the `load_tts_samples`.
# Check `TTS.tts.datasets.load_tts_samples` for more details.
train_samples, eval_samples = load_tts_samples(dataset_config, eval_split=True)
# init model
model = Vits(config)
model = Vits(config, ap, tokenizer, speaker_manager=None)
# init the trainer and 🚀
trainer = Trainer(
@ -70,6 +81,5 @@ trainer = Trainer(
model=model,
train_samples=train_samples,
eval_samples=eval_samples,
training_assets={"audio_processor": ap},
)
trainer.fit()

View File

@ -86,7 +86,7 @@
"mel_fmax": null
},
"target_loss": "avg_G_loss", // loss value to pick the best model to save after each epoch
"target_loss": "G_avg_loss", // loss value to pick the best model to save after each epoch
// DISCRIMINATOR
"discriminator_model": "melgan_multiscale_discriminator",