From e2e92b63d59279e1ad38687660f4bd9f5daf7c2c Mon Sep 17 00:00:00 2001 From: Eren Golge Date: Tue, 10 Dec 2019 11:21:55 +0100 Subject: [PATCH 1/5] load model checkpoint on cpu, set 'r' for all models with gradual training enabled for all --- server/synthesizer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/synthesizer.py b/server/synthesizer.py index 14de9411..d8852a3e 100644 --- a/server/synthesizer.py +++ b/server/synthesizer.py @@ -53,15 +53,14 @@ class Synthesizer(object): num_speakers = 0 self.tts_model = setup_model(self.input_size, num_speakers=num_speakers, c=self.tts_config) # load model state - map_location = None if use_cuda else torch.device('cpu') - cp = torch.load(tts_checkpoint, map_location=map_location) + cp = torch.load(tts_checkpoint, map_location=torch.device('cpu')) # load the model self.tts_model.load_state_dict(cp['model']) if use_cuda: self.tts_model.cuda() self.tts_model.eval() self.tts_model.decoder.max_decoder_steps = 3000 - if 'r' in cp and self.tts_config.model in ["Tacotron", "TacotronGST"]: + if 'r' in cp: self.tts_model.decoder.set_r(cp['r']) def load_wavernn(self, lib_path, model_path, model_file, model_config, use_cuda): From 856e87a6a88c823dc34f28fd5e7fddaeafbc0ba6 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Wed, 11 Dec 2019 14:31:59 +0100 Subject: [PATCH 2/5] Override checkpoint and config with CLI args if present --- server/server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/server.py b/server/server.py index 2831c754..d40e2427 100644 --- a/server/server.py +++ b/server/server.py @@ -55,8 +55,11 @@ def tts(): if __name__ == '__main__': - if not config or not synthesizer: - args = create_argparser().parse_args() + args = create_argparser().parse_args() + + # Setup synthesizer from CLI args if they're specified or no embedded model + # is present. + if not config or not synthesizer or args.tts_checkpoint or args.tts_config: synthesizer = Synthesizer(args) app.run(debug=config.debug, host='0.0.0.0', port=config.port) From 20b4211af54f68415f24717bbaaf8415b94196f1 Mon Sep 17 00:00:00 2001 From: geneing Date: Fri, 3 Jan 2020 23:59:20 -0800 Subject: [PATCH 3/5] Change to GMMv2b --- layers/common_layers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/layers/common_layers.py b/layers/common_layers.py index 006aa57a..66ffcd1c 100644 --- a/layers/common_layers.py +++ b/layers/common_layers.py @@ -159,20 +159,22 @@ class GravesAttention(nn.Module): k_t = gbk_t[:, 2, :] # attention GMM parameters - inv_sig_t = torch.exp(-torch.clamp(b_t, min=-6, max=9)) # variance + sig_t = torch.nn.functional.softplus(b_t)+self.eps + + #inv_sig_t = torch.exp(-torch.clamp(b_t, min=-6, max=9)) # variance mu_t = self.mu_prev + torch.nn.functional.softplus(k_t) - g_t = torch.softmax(g_t, dim=-1) * inv_sig_t + self.eps + g_t = torch.softmax(g_t, dim=-1) / sig_t + self.eps # each B x K x T_in g_t = g_t.unsqueeze(2).expand(g_t.size(0), g_t.size(1), inputs.size(1)) - inv_sig_t = inv_sig_t.unsqueeze(2).expand_as(g_t) + sig_t = sig_t.unsqueeze(2).expand_as(g_t) mu_t_ = mu_t.unsqueeze(2).expand_as(g_t) j = self.J[:g_t.size(0), :, :inputs.size(1)] # attention weights - phi_t = g_t * torch.exp(-0.5 * inv_sig_t * (mu_t_ - j)**2) + phi_t = g_t * torch.exp(-0.5 * (mu_t_ - j)**2 / (sig_t**2)) alpha_t = self.COEF * torch.sum(phi_t, 1) # apply masking From 34e0291ba798110e66dd3ae9faf0a885513f1045 Mon Sep 17 00:00:00 2001 From: geneing Date: Sat, 4 Jan 2020 00:00:20 -0800 Subject: [PATCH 4/5] Change to GMMv2b --- layers/common_layers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layers/common_layers.py b/layers/common_layers.py index 66ffcd1c..52be8bfd 100644 --- a/layers/common_layers.py +++ b/layers/common_layers.py @@ -127,8 +127,8 @@ class GravesAttention(nn.Module): self.init_layers() def init_layers(self): - torch.nn.init.constant_(self.N_a[2].bias[10:15], 0.5) - torch.nn.init.constant_(self.N_a[2].bias[5:10], 10) + torch.nn.init.constant_(self.N_a[2].bias[(2*self.K):(3*self.K)], 1.) + torch.nn.init.constant_(self.N_a[2].bias[self.K:(2*self.K)], 10) def init_states(self, inputs): if self.J is None or inputs.shape[1] > self.J.shape[-1]: From 748cbbc4039d5ec14e961235e58fbcc56b62cb05 Mon Sep 17 00:00:00 2001 From: geneing Date: Sun, 5 Jan 2020 18:34:01 -0800 Subject: [PATCH 5/5] Change to GMMv2b --- layers/common_layers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/layers/common_layers.py b/layers/common_layers.py index 52be8bfd..cd3ad09a 100644 --- a/layers/common_layers.py +++ b/layers/common_layers.py @@ -161,7 +161,6 @@ class GravesAttention(nn.Module): # attention GMM parameters sig_t = torch.nn.functional.softplus(b_t)+self.eps - #inv_sig_t = torch.exp(-torch.clamp(b_t, min=-6, max=9)) # variance mu_t = self.mu_prev + torch.nn.functional.softplus(k_t) g_t = torch.softmax(g_t, dim=-1) / sig_t + self.eps