Created
December 11, 2021 20:43
-
-
Save KakoozaJerry/075792cafda5afd38e74a8240648e423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from TTS.config.shared_configs import BaseAudioConfig | |
from TTS.trainer import Trainer, TrainingArgs | |
from TTS.utils.audio import AudioProcessor | |
from TTS.vocoder.configs import HifiganConfig | |
from TTS.vocoder.datasets.preprocess import load_wav_data | |
from TTS.vocoder.models.gan import GAN | |
output_path = "/content/drive/MyDrive/Emergent/train/hifigan" | |
audio_config = BaseAudioConfig( | |
sample_rate=22050, | |
do_trim_silence=False, | |
trim_db=60.0, | |
signal_norm=False, | |
mel_fmin=0.0, | |
mel_fmax=8000, | |
spec_gain=1.0, | |
log_func="np.log", | |
ref_level_db=20, | |
preemphasis=0.98, | |
) | |
config = HifiganConfig( | |
audio=audio_config, | |
batch_size=32, | |
eval_batch_size=16, | |
num_loader_workers=8, | |
num_eval_loader_workers=4, | |
run_eval=True, | |
test_delay_epochs=10, | |
epochs=10000, | |
wd= 0.0, | |
seq_len=8192, | |
pad_short=2000, | |
use_noise_augment=True, | |
eval_split_size=10, | |
print_step=25, | |
print_eval=False, | |
mixed_precision=False, | |
lr_gen=1e-5, | |
lr_disc=1e-5, | |
feat_match_loss_weight=10, | |
target_loss="avg_G_loss", | |
use_cache=True, | |
data_path="/content/drive/MyDrive/Emergent/recorded_dataset/dataset/newData/LJSpeech-1.1/wavs", | |
output_path=output_path, | |
) | |
# init audio processor | |
ap = AudioProcessor(**config.audio.to_dict()) | |
# load training samples | |
eval_samples, train_samples = load_wav_data(config.data_path, config.eval_split_size) | |
# init model | |
model = GAN(config) | |
# init the trainer and 🚀 | |
trainer = Trainer( | |
TrainingArgs(), | |
config, | |
output_path, | |
model=model, | |
train_samples=train_samples, | |
eval_samples=eval_samples, | |
training_assets={"audio_processor": ap}, | |
) | |
trainer.fit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment