Merge branch 'dev-embedding-init' into dev

This commit is contained in:
Eren Golge 2019-02-12 10:14:14 +01:00
commit ebc166b54f
3 changed files with 26 additions and 21 deletions

View File

@ -1,18 +1,18 @@
{ {
"model_name": "TTS-phoneme", "model_name": "embed_init_loss_weight",
"model_description": "Training with phonemes created by phonemizer.", "model_description": "Lower loss freq is weight 0.0, higher weight decay, ref_level_db: 40->20, sample_rate:16000 -> 22050",
"audio":{ "audio":{
"audio_processor": "audio", // to use dictate different audio processors, if available. "audio_processor": "audio", // to use dictate different audio processors, if available.
// Audio processing parameters // Audio processing parameters
"num_mels": 80, // size of the mel spec frame. "num_mels": 80, // size of the mel spec frame.
"num_freq": 1025, // number of stft frequency levels. Size of the linear spectogram frame. "num_freq": 1025, // number of stft frequency levels. Size of the linear spectogram frame.
"sample_rate": 16000, // wav sample-rate. If different than the original data, it is resampled. "sample_rate": 22050, // wav sample-rate. If different than the original data, it is resampled.
"frame_length_ms": 50, // stft window length in ms. "frame_length_ms": 50, // stft window length in ms.
"frame_shift_ms": 12.5, // stft window hop-lengh in ms. "frame_shift_ms": 12.5, // stft window hop-lengh in ms.
"preemphasis": 0.98, // pre-emphasis to reduce spec noise and make it more structured. If 0.0, no -pre-emphasis. "preemphasis": 0.98, // pre-emphasis to reduce spec noise and make it more structured. If 0.0, no -pre-emphasis.
"min_level_db": -100, // normalization range "min_level_db": -100, // normalization range
"ref_level_db": 40, // reference level db, theoretically 20db is the sound of air. "ref_level_db": 20, // reference level db, theoretically 20db is the sound of air.
"power": 1.5, // value to sharpen wav signals after GL algorithm. "power": 1.5, // value to sharpen wav signals after GL algorithm.
"griffin_lim_iters": 60,// #griffin-lim iterations. 30-60 is a good range. Larger the value, slower the generation. "griffin_lim_iters": 60,// #griffin-lim iterations. 30-60 is a good range. Larger the value, slower the generation.
// Normalization parameters // Normalization parameters
@ -30,29 +30,30 @@
"epochs": 1000, // total number of epochs to train. "epochs": 1000, // total number of epochs to train.
"lr": 0.001, // Initial learning rate. If Noam decay is active, maximum learning rate. "lr": 0.001, // Initial learning rate. If Noam decay is active, maximum learning rate.
"lr_decay": false, // if true, Noam learning rate decaying is applied through training. "lr_decay": false, // if true, Noam learning rate decaying is applied through training.
"loss_weight": 0.0, // loss weight to emphasize lower frequencies. Lower frequencies are in general more important for speech signals.
"warmup_steps": 4000, // Noam decay steps to increase the learning rate from 0 to "lr" "warmup_steps": 4000, // Noam decay steps to increase the learning rate from 0 to "lr"
"windowing": true, // Enables attention windowing. Used only in eval mode. "windowing": false, // Enables attention windowing. Used only in eval mode.
"batch_size": 32, // Batch size for training. Lower values than 32 might cause hard to learn attention. "batch_size": 32, // Batch size for training. Lower values than 32 might cause hard to learn attention.
"eval_batch_size":32, "eval_batch_size":32,
"r": 5, // Number of frames to predict for step. "r": 5, // Number of frames to predict for step.
"wd": 0.000001, // Weight decay weight. "wd": 0.00001, // Weight decay weight.
"checkpoint": true, // If true, it saves checkpoints per "save_step" "checkpoint": true, // If true, it saves checkpoints per "save_step"
"save_step": 5000, // Number of training steps expected to save traning stats and checkpoints. "save_step": 5000, // Number of training steps expected to save traning stats and checkpoints.
"print_step": 10, // Number of steps to log traning on console. "print_step": 50, // Number of steps to log traning on console.
"tb_model_param_stats": true, // true, plots param stats per layer on tensorboard. Might be memory consuming, but good for debugging. "tb_model_param_stats": false, // true, plots param stats per layer on tensorboard. Might be memory consuming, but good for debugging.
"run_eval": true, "run_eval": true,
"data_path": "/home/erogol/Data/en_UK/by_book/female/elizabeth_klett/", // DATASET-RELATED: can overwritten from command argument "data_path": "/media/erogol/data_ssd/Data/LJSpeech-1.1", // DATASET-RELATED: can overwritten from command argument
"meta_file_train": "jane_eyre/metadata_train.csv, wives_and_daughters/metadata_train.csv", // DATASET-RELATED: metafile for training dataloader. "meta_file_train": "metadata_train.csv", // DATASET-RELATED: metafile for training dataloader.
"meta_file_val": "jane_eyre/metadata_val.csv, wives_and_daughters/metadata_val.csv", // DATASET-RELATED: metafile for evaluation dataloader. "meta_file_val": "metadata_val.csv", // DATASET-RELATED: metafile for evaluation dataloader.
"dataset": "mailabs", // DATASET-RELATED: one of TTS.dataset.preprocessors depending on your target dataset. Use "tts_cache" for pre-computed dataset by extract_features.py "dataset": "ljspeech", // DATASET-RELATED: one of TTS.dataset.preprocessors depending on your target dataset. Use "tts_cache" for pre-computed dataset by extract_features.py
"min_seq_len": 0, // DATASET-RELATED: minimum text length to use in training "min_seq_len": 0, // DATASET-RELATED: minimum text length to use in training
"max_seq_len": 300, // DATASET-RELATED: maximum text length "max_seq_len": 300, // DATASET-RELATED: maximum text length
"output_path": "/media/erogol/data_ssd/Data/models/en_UK/", // DATASET-RELATED: output path for all training outputs. "output_path": "/media/erogol/data_ssd/Data/models/ljspeech_models/", // DATASET-RELATED: output path for all training outputs.
"num_loader_workers": 8, // number of training data loader processes. Don't set it too big. 4-8 are good values. "num_loader_workers": 8, // number of training data loader processes. Don't set it too big. 4-8 are good values.
"num_val_loader_workers": 4, // number of evaluation data loader processes. "num_val_loader_workers": 4, // number of evaluation data loader processes.
"phoneme_cache_path": "tmp_phonemes_gb", // phoneme computation is slow, therefore, it caches results in the given folder. "phoneme_cache_path": "ljspeech_us_phonemes", // phoneme computation is slow, therefore, it caches results in the given folder.
"use_phonemes": true, // use phonemes instead of raw characters. It is suggested for better pronounciation. "use_phonemes": true, // use phonemes instead of raw characters. It is suggested for better pronounciation.
"phoneme_language": "en-gb" // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages "phoneme_language": "en-us" // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages
} }

View File

@ -323,6 +323,10 @@ class Decoder(nn.Module):
[nn.GRUCell(256, 256) for _ in range(2)]) [nn.GRUCell(256, 256) for _ in range(2)])
# RNN_state -> |Linear| -> mel_spec # RNN_state -> |Linear| -> mel_spec
self.proj_to_mel = nn.Linear(256, memory_dim * r) self.proj_to_mel = nn.Linear(256, memory_dim * r)
# learn init values instead of zero init.
self.attention_rnn_init = nn.Embedding(1, 256)
self.memory_init = nn.Embedding(1, r * memory_dim)
self.decoder_rnn_inits = nn.Embedding(2, 256)
self.stopnet = StopNet(256 + memory_dim * r) self.stopnet = StopNet(256 + memory_dim * r)
# self.init_layers() # self.init_layers()
@ -354,12 +358,12 @@ class Decoder(nn.Module):
B = inputs.size(0) B = inputs.size(0)
T = inputs.size(1) T = inputs.size(1)
# go frame as zeros matrix # go frame as zeros matrix
initial_memory = inputs.data.new(B, self.memory_dim * self.r).zero_() initial_memory = self.memory_init(inputs.data.new_zeros(B).long())
# decoder states # decoder states
attention_rnn_hidden = inputs.data.new(B, 256).zero_() attention_rnn_hidden = self.attention_rnn_init(inputs.data.new_zeros(B).long())
decoder_rnn_hiddens = [ decoder_rnn_hiddens = [
inputs.data.new(B, 256).zero_() self.decoder_rnn_inits(inputs.data.new_tensor([idx]*B).long())
for _ in range(len(self.decoder_rnns)) for idx in range(len(self.decoder_rnns))
] ]
current_context_vec = inputs.data.new(B, self.in_features).zero_() current_context_vec = inputs.data.new(B, self.in_features).zero_()
# attention states # attention states

View File

@ -126,8 +126,8 @@ def train(model, criterion, criterion_st, optimizer, optimizer_st,
# loss computation # loss computation
stop_loss = criterion_st(stop_tokens, stop_targets) stop_loss = criterion_st(stop_tokens, stop_targets)
mel_loss = criterion(mel_output, mel_input, mel_lengths) mel_loss = criterion(mel_output, mel_input, mel_lengths)
linear_loss = 0.5 * criterion(linear_output, linear_input, mel_lengths)\ linear_loss = (1 - c.loss_weight) * criterion(linear_output, linear_input, mel_lengths)\
+ 0.5 * criterion(linear_output[:, :, :n_priority_freq], + c.loss_weight * criterion(linear_output[:, :, :n_priority_freq],
linear_input[:, :, :n_priority_freq], linear_input[:, :, :n_priority_freq],
mel_lengths) mel_lengths)
loss = mel_loss + linear_loss loss = mel_loss + linear_loss