From 820d18c9226ca451ceb79306a839d2fba4174658 Mon Sep 17 00:00:00 2001 From: Eren Golge Date: Sun, 12 May 2019 17:34:57 +0200 Subject: [PATCH] make dropout at prenet optional --- .compute | 2 +- config_cluster.json | 7 ++++--- layers/tacotron2.py | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.compute b/.compute index fe1c69c7..d2d37fc1 100644 --- a/.compute +++ b/.compute @@ -9,6 +9,6 @@ pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.1.post2-cp36-cp36m wget https://www.dropbox.com/s/wqn5v3wkktw9lmo/install.sh?dl=0 -O install.sh sudo sh install.sh python3 setup.py develop -python3 distribute.py --config_path config_cluster.json --data_path ${USER_DIR}/MozillaAll/Mozilla/ --restore_path ${USER_DIR}/checkpoint_123000_4761.pth.tar +python3 distribute.py --config_path config_cluster.json --data_path ${USER_DIR}/MozillaAll2/Mozilla/ --restore_path ${USER_DIR}/checkpoint_123000_4761.pth.tar # python3 distribute.py --config_path config_cluster.json --data_path ${SHARED_DIR}/data/mozilla/Judy/ # while true; do sleep 1000000; done diff --git a/config_cluster.json b/config_cluster.json index 7b0f19ec..11c2415f 100644 --- a/config_cluster.json +++ b/config_cluster.json @@ -1,6 +1,6 @@ { - "run_name": "mozilla-fattn-no_loc", - "run_description": "Finetune 4761 with BN", + "run_name": "mozilla-fattn", + "run_description": "Finetune 4761 with BN + Dropout. It is to compare to 4780 and see how dropout behaves with BN.", "audio":{ // Audio processing parameters @@ -41,6 +41,7 @@ "memory_size": 5, // ONLY TACOTRON - memory queue size used to queue network predictions to feed autoregressive connection. Useful if r < 5. "attention_norm": "softmax", // softmax or sigmoid. Suggested to use softmax for Tacotron2 and sigmoid for Tacotron. "prenet_type": "bn", // ONLY TACOTRON2 - "original" or "bn". + "prenet_dropout": true, // ONLY TACOTRON2 - enable/disable dropout at prenet. "use_forward_attn": true, // ONLY TACOTRON2 - if it uses forward attention. In general, it aligns faster. "transition_agent": false, // ONLY TACOTRON2 - enable/disable transition agent of forward attention. "location_attn": false, // ONLY TACOTRON2 - enable_disable location sensitive attention. It is enabled for TACOTRON by default. @@ -65,7 +66,7 @@ "dataset": "mozilla", // 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 "max_seq_len": 150, // DATASET-RELATED: maximum text length - "output_path": "/media/erogol/data_ssd/Data/models/mozilla_models/", // DATASET-RELATED: output path for all training outputs. + "output_path": "../keep/", // DATASET-RELATED: output path for all training outputs. "num_loader_workers": 4, // 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. "phoneme_cache_path": "mozilla_us_phonemes", // phoneme computation is slow, therefore, it caches results in the given folder. diff --git a/layers/tacotron2.py b/layers/tacotron2.py index 0826ccc6..175a8ef3 100644 --- a/layers/tacotron2.py +++ b/layers/tacotron2.py @@ -53,9 +53,10 @@ class LinearBN(nn.Module): class Prenet(nn.Module): - def __init__(self, in_features, prenet_type, out_features=[256, 256]): + def __init__(self, in_features, prenet_type, prenet_dropout, out_features=[256, 256]): super(Prenet, self).__init__() self.prenet_type = prenet_type + self.prenet_dropout = prenet_dropout in_features = [in_features] + out_features[:-1] if prenet_type == "bn": self.layers = nn.ModuleList([ @@ -70,9 +71,9 @@ class Prenet(nn.Module): def forward(self, x): for linear in self.layers: - if self.prenet_type == "original": + if self.prenet_dropout: x = F.dropout(F.relu(linear(x)), p=0.5, training=self.training) - elif self.prenet_type == "bn": + else: x = F.relu(linear(x)) return x