mirror of https://github.com/coqui-ai/TTS.git
Update VITS LJspeech recipe
This commit is contained in:
parent
98057a00ae
commit
75c507c36a
|
@ -6,6 +6,7 @@ from TTS.tts.configs.shared_configs import BaseDatasetConfig
|
||||||
from TTS.tts.configs.vits_config import VitsConfig
|
from TTS.tts.configs.vits_config import VitsConfig
|
||||||
from TTS.tts.datasets import load_tts_samples
|
from TTS.tts.datasets import load_tts_samples
|
||||||
from TTS.tts.models.vits import Vits
|
from TTS.tts.models.vits import Vits
|
||||||
|
from TTS.tts.utils.text.tokenizer import TTSTokenizer
|
||||||
from TTS.utils.audio import AudioProcessor
|
from TTS.utils.audio import AudioProcessor
|
||||||
|
|
||||||
output_path = os.path.dirname(os.path.abspath(__file__))
|
output_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
@ -35,7 +36,7 @@ config = VitsConfig(
|
||||||
batch_size=48,
|
batch_size=48,
|
||||||
eval_batch_size=16,
|
eval_batch_size=16,
|
||||||
batch_group_size=5,
|
batch_group_size=5,
|
||||||
num_loader_workers=4,
|
num_loader_workers=0,
|
||||||
num_eval_loader_workers=4,
|
num_eval_loader_workers=4,
|
||||||
run_eval=True,
|
run_eval=True,
|
||||||
test_delay_epochs=-1,
|
test_delay_epochs=-1,
|
||||||
|
@ -53,14 +54,24 @@ config = VitsConfig(
|
||||||
datasets=[dataset_config],
|
datasets=[dataset_config],
|
||||||
)
|
)
|
||||||
|
|
||||||
# init audio processor
|
# INITIALIZE THE AUDIO PROCESSOR
|
||||||
ap = AudioProcessor(**config.audio.to_dict())
|
# 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)
|
train_samples, eval_samples = load_tts_samples(dataset_config, eval_split=True)
|
||||||
|
|
||||||
# init model
|
# init model
|
||||||
model = Vits(config)
|
model = Vits(config, ap, tokenizer, speaker_manager=None)
|
||||||
|
|
||||||
# init the trainer and 🚀
|
# init the trainer and 🚀
|
||||||
trainer = Trainer(
|
trainer = Trainer(
|
||||||
|
@ -70,6 +81,5 @@ trainer = Trainer(
|
||||||
model=model,
|
model=model,
|
||||||
train_samples=train_samples,
|
train_samples=train_samples,
|
||||||
eval_samples=eval_samples,
|
eval_samples=eval_samples,
|
||||||
training_assets={"audio_processor": ap},
|
|
||||||
)
|
)
|
||||||
trainer.fit()
|
trainer.fit()
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
"mel_fmax": null
|
"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
|
||||||
"discriminator_model": "melgan_multiscale_discriminator",
|
"discriminator_model": "melgan_multiscale_discriminator",
|
||||||
|
|
Loading…
Reference in New Issue