mirror of
https://github.com/wassname/TTS.git
synced 2026-10-27 12:30:27 +08:00
disabling multispeaker with num_speakers=0
This commit is contained in:
1 parent
04e452d8cb
commit
ba8cc8054b
11 files changed
+165
-251
No files matched your search
+1
-1
@@ -76,6 +76,6 @@
|
||||
"use_phonemes": true, // use phonemes instead of raw characters. It is suggested for better pronounciation.
|
||||
"phoneme_language": "en-us", // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages
|
||||
"text_cleaner": "phoneme_cleaners",
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers, 0 disables speaker embeddings
|
||||
}
|
||||
|
||||
@@ -77,6 +77,6 @@
|
||||
"use_phonemes": true, // use phonemes instead of raw characters. It is suggested for better pronounciation.
|
||||
"phoneme_language": "en-us", // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages
|
||||
"text_cleaner": "phoneme_cleaners",
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers, 0 disables speaker embeddings
|
||||
}
|
||||
|
||||
@@ -79,6 +79,6 @@
|
||||
"use_phonemes": true, // use phonemes instead of raw characters. It is suggested for better pronounciation.
|
||||
"phoneme_language": "en-us", // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages
|
||||
"text_cleaner": "phoneme_cleaners",
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers, 0 disables speaker embeddings
|
||||
}
|
||||
|
||||
@@ -77,6 +77,6 @@
|
||||
"use_phonemes": false, // use phonemes instead of raw characters. It is suggested for better pronounciation.
|
||||
"phoneme_language": "de", // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages
|
||||
"text_cleaner": "phoneme_cleaners",
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers, 0 disables speaker embeddings
|
||||
}
|
||||
|
||||
@@ -77,6 +77,6 @@
|
||||
"use_phonemes": true, // use phonemes instead of raw characters. It is suggested for better pronounciation.
|
||||
"phoneme_language": "en-us", // depending on your target language, pick one from https://github.com/bootphon/phonemizer#languages
|
||||
"text_cleaner": "phoneme_cleaners",
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers
|
||||
"num_speakers": 10 // should just be bigger than the actual number of speakers, 0 disables speaker embeddings
|
||||
}
|
||||
|
||||
+21
-20
@@ -29,9 +29,9 @@ class Tacotron(nn.Module):
|
||||
self.linear_dim = linear_dim
|
||||
self.embedding = nn.Embedding(num_chars, 256)
|
||||
self.embedding.weight.data.normal_(0, 0.3)
|
||||
self.speaker_embedding = nn.Embedding(num_speakers,
|
||||
256)
|
||||
self.speaker_embedding.weight.data.normal_(0, 0.3)
|
||||
if num_speakers > 0:
|
||||
self.speaker_embedding = nn.Embedding(num_speakers, 256)
|
||||
self.speaker_embedding.weight.data.normal_(0, 0.3)
|
||||
self.encoder = Encoder(256)
|
||||
self.decoder = Decoder(256, mel_dim, r, memory_size, attn_win,
|
||||
attn_norm, prenet_type, prenet_dropout,
|
||||
@@ -42,18 +42,13 @@ class Tacotron(nn.Module):
|
||||
nn.Linear(self.postnet.cbhg.gru_features * 2, linear_dim),
|
||||
nn.Sigmoid())
|
||||
|
||||
def forward(self, characters, speaker_ids, text_lengths, mel_specs):
|
||||
def forward(self, characters, text_lengths, mel_specs, speaker_ids=None):
|
||||
B = characters.size(0)
|
||||
mask = sequence_mask(text_lengths).to(characters.device)
|
||||
inputs = self.embedding(characters)
|
||||
encoder_outputs = self.encoder(inputs)
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
mel_outputs, alignments, stop_tokens = self.decoder(
|
||||
encoder_outputs, mel_specs, mask)
|
||||
mel_outputs = mel_outputs.view(B, -1, self.mel_dim)
|
||||
@@ -61,20 +56,26 @@ class Tacotron(nn.Module):
|
||||
linear_outputs = self.last_linear(linear_outputs)
|
||||
return mel_outputs, linear_outputs, alignments, stop_tokens
|
||||
|
||||
def inference(self, characters, speaker_ids):
|
||||
def inference(self, characters, speaker_ids=None):
|
||||
B = characters.size(0)
|
||||
inputs = self.embedding(characters)
|
||||
encoder_outputs = self.encoder(inputs)
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
mel_outputs, alignments, stop_tokens = self.decoder.inference(
|
||||
encoder_outputs)
|
||||
mel_outputs = mel_outputs.view(B, -1, self.mel_dim)
|
||||
linear_outputs = self.postnet(mel_outputs)
|
||||
linear_outputs = self.last_linear(linear_outputs)
|
||||
return mel_outputs, linear_outputs, alignments, stop_tokens
|
||||
return mel_outputs, linear_outputs, alignments, stop_tokens
|
||||
|
||||
def _add_speaker_embedding(self, encoder_outputs, speaker_ids):
|
||||
if hasattr(self, "speaker_embedding") and speaker_ids is not None:
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
return encoder_outputs
|
||||
+24
-28
@@ -29,8 +29,9 @@ class Tacotron2(nn.Module):
|
||||
std = sqrt(2.0 / (num_chars + 512))
|
||||
val = sqrt(3.0) * std # uniform bounds for std
|
||||
self.embedding.weight.data.uniform_(-val, val)
|
||||
self.speaker_embedding = nn.Embedding(num_speakers, 512)
|
||||
self.speaker_embedding.weight.data.normal_(0, 0.3)
|
||||
if num_speakers > 0:
|
||||
self.speaker_embedding = nn.Embedding(num_speakers, 512)
|
||||
self.speaker_embedding.weight.data.normal_(0, 0.3)
|
||||
self.encoder = Encoder(512)
|
||||
self.decoder = Decoder(512, self.n_mel_channels, r, attn_win,
|
||||
attn_norm, prenet_type, prenet_dropout,
|
||||
@@ -43,19 +44,13 @@ class Tacotron2(nn.Module):
|
||||
mel_outputs_postnet = mel_outputs_postnet.transpose(1, 2)
|
||||
return mel_outputs, mel_outputs_postnet, alignments
|
||||
|
||||
def forward(self, text, speaker_ids, text_lengths, mel_specs=None):
|
||||
def forward(self, text, text_lengths, mel_specs=None, speaker_ids=None):
|
||||
# compute mask for padding
|
||||
mask = sequence_mask(text_lengths).to(text.device)
|
||||
embedded_inputs = self.embedding(text).transpose(1, 2)
|
||||
encoder_outputs = self.encoder(embedded_inputs, text_lengths)
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
|
||||
encoder_outputs += speaker_embeddings
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
mel_outputs, stop_tokens, alignments = self.decoder(
|
||||
encoder_outputs, mel_specs, mask)
|
||||
mel_outputs_postnet = self.postnet(mel_outputs)
|
||||
@@ -64,16 +59,11 @@ class Tacotron2(nn.Module):
|
||||
mel_outputs, mel_outputs_postnet, alignments)
|
||||
return mel_outputs, mel_outputs_postnet, alignments, stop_tokens
|
||||
|
||||
def inference(self, text, speaker_ids):
|
||||
def inference(self, text, speaker_ids=None):
|
||||
embedded_inputs = self.embedding(text).transpose(1, 2)
|
||||
encoder_outputs = self.encoder.inference(embedded_inputs)
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
mel_outputs, stop_tokens, alignments = self.decoder.inference(
|
||||
encoder_outputs)
|
||||
mel_outputs_postnet = self.postnet(mel_outputs)
|
||||
@@ -82,23 +72,29 @@ class Tacotron2(nn.Module):
|
||||
mel_outputs, mel_outputs_postnet, alignments)
|
||||
return mel_outputs, mel_outputs_postnet, alignments, stop_tokens
|
||||
|
||||
def inference_truncated(self, text, speaker_ids):
|
||||
def inference_truncated(self, text, speaker_ids=None):
|
||||
"""
|
||||
Preserve model states for continuous inference
|
||||
"""
|
||||
embedded_inputs = self.embedding(text).transpose(1, 2)
|
||||
encoder_outputs = self.encoder.inference_truncated(embedded_inputs)
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
mel_outputs, stop_tokens, alignments = self.decoder.inference_truncated(
|
||||
encoder_outputs)
|
||||
mel_outputs_postnet = self.postnet(mel_outputs)
|
||||
mel_outputs_postnet = mel_outputs + mel_outputs_postnet
|
||||
mel_outputs, mel_outputs_postnet, alignments = self.shape_outputs(
|
||||
mel_outputs, mel_outputs_postnet, alignments)
|
||||
return mel_outputs, mel_outputs_postnet, alignments, stop_tokens
|
||||
return mel_outputs, mel_outputs_postnet, alignments, stop_tokens
|
||||
|
||||
def _add_speaker_embedding(self, encoder_outputs, speaker_ids):
|
||||
if hasattr(self, "speaker_embedding") and speaker_ids is not None:
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
return encoder_outputs
|
||||
+22
-21
@@ -30,8 +30,9 @@ class TacotronGST(nn.Module):
|
||||
self.linear_dim = linear_dim
|
||||
self.embedding = nn.Embedding(num_chars, 256)
|
||||
self.embedding.weight.data.normal_(0, 0.3)
|
||||
self.speaker_embedding = nn.Embedding(num_speakers, 256)
|
||||
self.speaker_embedding.weight.data.normal_(0, 0.3)
|
||||
if num_speakers > 0:
|
||||
self.speaker_embedding = nn.Embedding(num_speakers, 256)
|
||||
self.speaker_embedding.weight.data.normal_(0, 0.3)
|
||||
self.encoder = Encoder(256)
|
||||
self.gst = GST(num_mel=80, num_heads=4, num_style_tokens=10, embedding_dim=256)
|
||||
self.decoder = Decoder(256, mel_dim, r, memory_size, attn_win,
|
||||
@@ -43,22 +44,16 @@ class TacotronGST(nn.Module):
|
||||
nn.Linear(self.postnet.cbhg.gru_features * 2, linear_dim),
|
||||
nn.Sigmoid())
|
||||
|
||||
def forward(self, characters, speaker_ids, text_lengths, mel_specs):
|
||||
def forward(self, characters, text_lengths, mel_specs, speaker_ids=None):
|
||||
B = characters.size(0)
|
||||
mask = sequence_mask(text_lengths).to(characters.device)
|
||||
inputs = self.embedding(characters)
|
||||
encoder_outputs = self.encoder(inputs)
|
||||
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
gst_outputs = self.gst(mel_specs)
|
||||
gst_outputs = gst_outputs.expand(-1, encoder_outputs.size(1), -1)
|
||||
encoder_outputs = encoder_outputs + gst_outputs + speaker_embeddings
|
||||
encoder_outputs = encoder_outputs + gst_outputs
|
||||
mel_outputs, alignments, stop_tokens = self.decoder(
|
||||
encoder_outputs, mel_specs, mask)
|
||||
mel_outputs = mel_outputs.view(B, -1, self.mel_dim)
|
||||
@@ -66,24 +61,30 @@ class TacotronGST(nn.Module):
|
||||
linear_outputs = self.last_linear(linear_outputs)
|
||||
return mel_outputs, linear_outputs, alignments, stop_tokens
|
||||
|
||||
def inference(self, characters, speaker_ids, style_mel=None):
|
||||
def inference(self, characters, speaker_ids=None, style_mel=None):
|
||||
B = characters.size(0)
|
||||
inputs = self.embedding(characters)
|
||||
encoder_outputs = self.encoder(inputs)
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs = self._add_speaker_embedding(encoder_outputs,
|
||||
speaker_ids)
|
||||
if style_mel is not None:
|
||||
gst_outputs = self.gst(style_mel)
|
||||
gst_outputs = gst_outputs.expand(-1, encoder_outputs.size(1), -1)
|
||||
encoder_outputs = encoder_outputs + gst_outputs
|
||||
encoder_outputs += speaker_embeddings
|
||||
mel_outputs, alignments, stop_tokens = self.decoder.inference(
|
||||
encoder_outputs)
|
||||
mel_outputs = mel_outputs.view(B, -1, self.mel_dim)
|
||||
linear_outputs = self.postnet(mel_outputs)
|
||||
linear_outputs = self.last_linear(linear_outputs)
|
||||
return mel_outputs, linear_outputs, alignments, stop_tokens
|
||||
return mel_outputs, linear_outputs, alignments, stop_tokens
|
||||
|
||||
def _add_speaker_embedding(self, encoder_outputs, speaker_ids):
|
||||
if hasattr(self, "speaker_embedding") and speaker_ids is not None:
|
||||
speaker_embeddings = self.speaker_embedding(speaker_ids)
|
||||
|
||||
speaker_embeddings.unsqueeze_(1)
|
||||
speaker_embeddings = speaker_embeddings.expand(encoder_outputs.size(0),
|
||||
encoder_outputs.size(1),
|
||||
-1)
|
||||
encoder_outputs += speaker_embeddings
|
||||
return encoder_outputs
|
||||
+43
-142
@@ -19,7 +19,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
@@ -31,30 +31,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"The autoreload extension is already loaded. To reload it, use:\n",
|
||||
" %reload_ext autoreload\n",
|
||||
"Populating the interactive namespace from numpy and matplotlib\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/Users/thomas/miniconda2/envs/mztts/lib/python3.6/site-packages/IPython/core/magics/pylab.py:160: UserWarning: pylab import has clobbered these variables: ['plt']\n",
|
||||
"`%matplotlib` prevents importing * from pylab and numpy\n",
|
||||
" \"\\n`%matplotlib` prevents importing * from pylab and numpy\"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
@@ -96,15 +78,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def tts(model, text, speaker_id, CONFIG, use_cuda, ap, use_gl, figures=True):\n",
|
||||
"def tts(model, text, CONFIG, use_cuda, ap, use_gl, speaker_id=None, figures=True):\n",
|
||||
" t_1 = time.time()\n",
|
||||
" waveform, alignment, mel_spec, mel_postnet_spec, stop_tokens = synthesis(model, text, speaker_id, CONFIG, use_cuda, ap, truncated=False, enable_eos_bos_chars=CONFIG.enable_eos_bos_chars)\n",
|
||||
" waveform, alignment, mel_spec, mel_postnet_spec, stop_tokens = synthesis(model, text, CONFIG, use_cuda, ap, truncated=False, speaker_id=speaker_id, enable_eos_bos_chars=CONFIG.enable_eos_bos_chars)\n",
|
||||
" if CONFIG.model == \"Tacotron\" and not use_gl:\n",
|
||||
" mel_postnet_spec = ap.out_linear_to_mel(mel_postnet_spec.T).T\n",
|
||||
" if not use_gl:\n",
|
||||
@@ -123,7 +105,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
@@ -153,39 +135,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" > Using model: TacotronGST\n",
|
||||
" > Setting up Audio Processor...\n",
|
||||
" | > sample_rate:16000\n",
|
||||
" | > num_mels:80\n",
|
||||
" | > min_level_db:-100\n",
|
||||
" | > frame_shift_ms:12.5\n",
|
||||
" | > frame_length_ms:50\n",
|
||||
" | > ref_level_db:20\n",
|
||||
" | > num_freq:1025\n",
|
||||
" | > power:1.5\n",
|
||||
" | > preemphasis:0.98\n",
|
||||
" | > griffin_lim_iters:60\n",
|
||||
" | > signal_norm:True\n",
|
||||
" | > symmetric_norm:False\n",
|
||||
" | > mel_fmin:0.0\n",
|
||||
" | > mel_fmax:8000.0\n",
|
||||
" | > max_norm:1.0\n",
|
||||
" | > clip_norm:True\n",
|
||||
" | > do_trim_silence:False\n",
|
||||
" | > n_fft:2048\n",
|
||||
" | > hop_length:200\n",
|
||||
" | > win_length:800\n",
|
||||
"5000\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# LOAD TTS MODEL\n",
|
||||
"from utils.text.symbols import symbols, phonemes\n",
|
||||
@@ -214,7 +168,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
@@ -257,71 +211,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"scrolled": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/Users/thomas/miniconda2/envs/mztts/lib/python3.6/site-packages/librosa/util/utils.py:1725: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
|
||||
" if np.issubdtype(x.dtype, float) or np.issubdtype(x.dtype, complex):\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
" > Run-time: 2.2084879875183105\n",
|
||||
"bɪl ɡoːt ɪn ðə habɪt oːf askɪŋ hɪmzɛlf iːs tɑːt (en)θɔːt(de) tɾuːə? ant iːf heː vasnt apzoːluːtɛliː kɛɾtaɪn iːt vas, heː jʊst leːt iːt ɡoː.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/Users/thomas/miniconda2/envs/mztts/lib/python3.6/site-packages/librosa/display.py:656: FutureWarning: Conversion of the second argument of issubdtype from `complex` to `np.complexfloating` is deprecated. In future, it will be treated as `np.complex128 == np.dtype(complex).type`.\n",
|
||||
" if np.issubdtype(data.dtype, np.complex):\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"\n",
|
||||
" <audio controls=\"controls\" >\n",
|
||||
" <source src=\"data:audio/wav;base64,UklGRtSUAQBXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YbCUAQCI/yT/Lv8Y/nr9Jf0E/Tb9Af1B/Wn9Yv3N/FX9Ev5s/jr+FP51/nn+Q/9wACgBTgHHAacCRwOzA7ADcAPQA0gEOQTuA7IDmANtA5ACFALNAUoBaAANALz/Qv9z/vj95f0n/e/8tvxx/LH7Rfud+9v7ivuQ++f7evwc/CT8JvyG/KH8RPzQ/C79JP3S/Db9T/13/df9k/5v/oH+aP+T/6r/aADsADkBKgF9AdcBVAEoAYYBGQI2AgACFQJiAogCXwJJAq8CTwO/A/kDNARKBBsEXgRCBX0FIAU8BVMGPQacBXsFTQXABAoEWQOiAlMC3QHgAL3/NP+b/gr+0fwT/Iv7d/rk+UH5lfhu+Ez4GPgO+Gb45/jF+PH4TvnW+dL5ffqv+wP8xPtN/ND9Mv6m/rT/IAAwAIUADwEvAY0APACKAO0AWwHGAbwBvAHcAeACWwM3AyUDXgNCBHoEJAVaBRQFGQVLBRAFOASVBEUFBQVxBHEEuAQCBI0DqgM9A58CMgNsA/cBzwD3AGoAwf7W/sD/WP92/kv+o/6N/jv+xv0q/Qz9eP3a/fn88fvd+2b8xPvF+n36sPkK+TL5lPn3+Jb4jfmr+sn6Svsp/Cz9Yf6f/6j/2P6JAGcCwAIkAioDdQQzBOkExwVKBigGYQY3ByEHyAVmBJUEhgTFAj8BHAAJ//v9x/1H/eb8R/yi++f8nf0m/YP8Mv3c/ZH+6/+uAKQAcQG8ArECDQOxBLwFggSlA8gEVgUbBNgCJQOWA1ADXwIbAcEAwQAvAAX/0/6A/lH9RPy2/FL9T/xy+/L6sfpc+mz6P/q9+sD6K/vX+3H8Hvz/+1f+Uv/L/on+h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M8Z7B4lJMAo/SxEMd817jiKO4Q+G0LJRNNFG0eMSHlJQUk2STFIK0aJQ+ZAhz2iOCEz3y04KOogLhlXEjML7wKT+nTyhOoh4tvaPdRtzdzG7MF/vXS5RrdRtrq1erWdt4+6bL3lwTHICs5D01LavuJq6TfvI/Y5/hgEWgikDZoSJRblFyEaZxv7G4IbaBr4GFcWLxMUEKENAwrzBbAClf9B/Nr5EPkD9zn0hvOd9Ev1b/VD9+n4BfrG+/z/bAPxBOEGUwrNDX0PzBHUFM8WnxfXGCYayRopG6UbsBpiGYgY9RdoFbsSuhA6DlsLPgjCBSQCvv7l+0j5T/ZZ87rwce667EXrb+kk6N/nxeeB58fngekc6zbsou1O8KTzNvax+MD7qv6IAY4EogdmCVAKJwwTDg0PfQ45DqANOw2CDO4K6QhfBvEEhQJ5APL9WPuV+P72hPZd9EHySfEs8mvxzPCi8bbzBfRH9Df39/nd++/8PADTAgIFEgeiCRQLiQt6DbEOCw+fDT8NigwQC+8IlAaLA43/Dv0R+8X3pvI+73ftL+s16Bnm2eTp42TjzeOt5InlLOew6Sbtw/DG9GH5ff5UBF0KphBUFqEcwSJUKAMuzDI+NyE6lD0nQHNB20ACQKI+0jvQOPU0BjAfKU4jzh3UFr0OoAcQAKj31+8o6kfjKttU1DrP9MkOxLbAFb7lumq3vLYHt/+2FbeJuTy8u70WwE7F6sobzvzRPtj+3jDjBOnK7yb2Avt9ALkGyAvMELQUwBhdHB4gaCJQIwUloSacJ08n9CYrJjAlrySLI2wi5SGYIQ0Line truncated
|
||||
" Your browser does not support the audio element.\n",
|
||||
" </audio>\n",
|
||||
" "
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.lib.display.Audio object>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjgAAAa4CAYAAACNiqM9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzA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ApwO7APtExC3dYzyDY2ZmaZBTVBVL+tWMiGuArYDNe4ObzvGVEbEiIlYs0pLmL9DMzMyGItkZnC5XAI+QdAXwrYg4YdgXZC2X+FS22bDEhg3DvoSRlRX6c4qqSqMQ4JwILI+IfXoPOEVlZmapcDfxao3Cq/k44DGSlvUecIrKzMxsPI3CDM5PgPURsXbYF2KJyCvg5vSVddTasbusMkXryqh5J2qpbuLFJ6/v3BUI5BRVxUYhwLmLbLv4JpyiMjOzVEyNRFKlPZIPcCJiraSHS7oa+Eb3IuNN6uCYFWlxef6hGsOZrbLtEGqdASrTMmFYsz91KzND0+bZOhtY8gFOx4aIWN57p2dwzMwsBREw6RRVpZIPcCTtByyVtKx3HY5ncMzMLBVeg1Ot5AOciLhU0j2Fi4wjfwGbv63McrQ1ddfi1NmwOn4XKVcsd6Lckxekx5R3+sIU1ODXVri4uaBrh7VT8gFOHqeozMwsBdkuqpb+IZGokX41Z9TBwXVwzMysvSZRJbe5kHSYpJ9LWi3pxFmOL5F0Zuf4xZJ26Tr2OEkXSbpG0lWSllb2IlQo2Rmczov9DeCHwK8knQ8cERF/nP0Line truncated
|
||||
"text/plain": [
|
||||
"<matplotlib.figure.Figure at 0x12d244eb8>"
|
||||
]
|
||||
},
|
||||
"metadata": {
|
||||
"needs_background": "light"
|
||||
},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"model.eval()\n",
|
||||
"model.decoder.max_decoder_steps = 2000\n",
|
||||
"speaker_id = 0\n",
|
||||
"sentence = \"Bill got in the habit of asking himself “Is that thought true?” And if he wasn’t absolutely certain it was, he just let it go.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -334,7 +235,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Be a voice, not an echo.\" # 'echo' is not in training set. \n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -346,7 +247,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"The human voice is the most perfect instrument of all.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -358,7 +259,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"I'm sorry Dave. I'm afraid I can't do that.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -371,7 +272,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"This cake is great. It's so delicious and moist.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -390,7 +291,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Generative adversarial network or variational auto-encoder.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -402,7 +303,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Scientists at the CERN laboratory say they have discovered a new particle.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -414,7 +315,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Here’s a way to measure the acute emotional intelligence that has never gone out of style.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -426,7 +327,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"President Trump met with other leaders at the Group of 20 conference.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -438,7 +339,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"The buses aren't the problem, they actually provide a solution.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -457,7 +358,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Generative adversarial network or variational auto-encoder.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -469,7 +370,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Basilar membrane and otolaryngology are not auto-correlations.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -481,7 +382,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \" He has read the whole thing.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -493,7 +394,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"He reads books.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -506,7 +407,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Thisss isrealy awhsome.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -519,7 +420,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"This is your internet browser, Firefox.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -531,7 +432,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"This is your internet browser Firefox.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -543,7 +444,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"The quick brown fox jumps over the lazy dog.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -555,7 +456,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Does the quick brown fox jump over the lazy dog?\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -567,7 +468,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Eren, how are you?\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -586,7 +487,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Encouraged, he started with a minute a day.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -598,7 +499,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"His meditation consisted of “body scanning” which involved focusing his mind and energy on each section of the body from head to toe .\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -610,7 +511,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Recent research at Harvard has shown meditating for as little as 8 weeks can actually increase the grey matter in the parts of the brain responsible for emotional regulation and learning . \"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -622,7 +523,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"If he decided to watch TV he really watched it.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -635,7 +536,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"sentence = \"Often we try to bring about change through sheer effort and we put all of our energy into a new initiative .\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -648,7 +549,7 @@
|
||||
"source": [
|
||||
"# for twb dataset\n",
|
||||
"sentence = \"In our preparation for Easter, God in his providence offers us each year the season of Lent as a sacramental sign of our conversion.\"\n",
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, speaker_id, CONFIG, use_cuda, ap, use_gl=use_gl, figures=True)"
|
||||
"align, spec, stop_tokens, wav = tts(model, sentence, CONFIG, use_cuda, ap, speaker_id=speaker_id, use_gl=use_gl, figures=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -78,7 +78,8 @@ def setup_loader(is_val=False, verbose=False):
|
||||
def train(model, criterion, criterion_st, optimizer, optimizer_st, scheduler,
|
||||
ap, epoch):
|
||||
data_loader = setup_loader(is_val=False, verbose=(epoch==0))
|
||||
speaker_mapping = load_speaker_mapping(OUT_PATH)
|
||||
if c.num_speakers > 0:
|
||||
speaker_mapping = load_speaker_mapping(OUT_PATH)
|
||||
model.train()
|
||||
epoch_time = 0
|
||||
avg_postnet_loss = 0
|
||||
@@ -101,19 +102,23 @@ def train(model, criterion, criterion_st, optimizer, optimizer_st, scheduler,
|
||||
avg_text_length = torch.mean(text_lengths.float())
|
||||
avg_spec_length = torch.mean(mel_lengths.float())
|
||||
|
||||
speaker_ids = []
|
||||
for speaker_name in speaker_names:
|
||||
if speaker_name not in speaker_mapping:
|
||||
speaker_mapping[speaker_name] = len(speaker_mapping)
|
||||
speaker_ids.append(speaker_mapping[speaker_name])
|
||||
speaker_ids = torch.LongTensor(speaker_ids)
|
||||
if c.num_speakers > 0:
|
||||
speaker_ids = []
|
||||
for speaker_name in speaker_names:
|
||||
if speaker_name not in speaker_mapping:
|
||||
speaker_mapping[speaker_name] = len(speaker_mapping)
|
||||
speaker_ids.append(speaker_mapping[speaker_name])
|
||||
speaker_ids = torch.LongTensor(speaker_ids)
|
||||
|
||||
if len(speaker_mapping) > c.num_speakers:
|
||||
raise ValueError("It seems there are at least {} speakers in "
|
||||
"your dataset, while 'num_speakers' is set to {}. "
|
||||
"Found the following speakers: {}".format(len(speaker_mapping),
|
||||
c.num_speakers,
|
||||
list(speaker_mapping)))
|
||||
if len(speaker_mapping) > c.num_speakers:
|
||||
raise ValueError("It seems there are at least {} speakers in "
|
||||
"your dataset, while 'num_speakers' is set to "
|
||||
"{}. Found the following speakers: {}".format(
|
||||
len(speaker_mapping),
|
||||
c.num_speakers,
|
||||
list(speaker_mapping)))
|
||||
else:
|
||||
speaker_ids = None
|
||||
|
||||
# set stop targets view, we predict a single stop token per r frames prediction
|
||||
stop_targets = stop_targets.view(text_input.shape[0],
|
||||
@@ -137,11 +142,12 @@ def train(model, criterion, criterion_st, optimizer, optimizer_st, scheduler,
|
||||
mel_lengths = mel_lengths.cuda(non_blocking=True)
|
||||
linear_input = linear_input.cuda(non_blocking=True) if c.model in ["Tacotron", "TacotronGST"] else None
|
||||
stop_targets = stop_targets.cuda(non_blocking=True)
|
||||
speaker_ids = speaker_ids.cuda(non_blocking=True)
|
||||
if speaker_ids is not None:
|
||||
speaker_ids = speaker_ids.cuda(non_blocking=True)
|
||||
|
||||
# forward pass model
|
||||
decoder_output, postnet_output, alignments, stop_tokens = model(
|
||||
text_input, speaker_ids, text_lengths, mel_input)
|
||||
text_input, text_lengths, mel_input, speaker_ids=speaker_ids)
|
||||
|
||||
# loss computation
|
||||
stop_loss = criterion_st(stop_tokens, stop_targets) if c.stopnet else torch.zeros(1)
|
||||
@@ -266,13 +272,15 @@ def train(model, criterion, criterion_st, optimizer, optimizer_st, scheduler,
|
||||
tb_logger.tb_model_weights(model, current_step)
|
||||
|
||||
# save speaker mapping
|
||||
save_speaker_mapping(OUT_PATH, speaker_mapping)
|
||||
if c.num_speakers > 0:
|
||||
save_speaker_mapping(OUT_PATH, speaker_mapping)
|
||||
return avg_postnet_loss, current_step
|
||||
|
||||
|
||||
def evaluate(model, criterion, criterion_st, ap, current_step, epoch):
|
||||
data_loader = setup_loader(is_val=True)
|
||||
speaker_mapping = load_speaker_mapping(OUT_PATH)
|
||||
if c.num_speakers > 0:
|
||||
speaker_mapping = load_speaker_mapping(OUT_PATH)
|
||||
model.eval()
|
||||
epoch_time = 0
|
||||
avg_postnet_loss = 0
|
||||
@@ -303,9 +311,12 @@ def evaluate(model, criterion, criterion_st, ap, current_step, epoch):
|
||||
mel_lengths = data[5]
|
||||
stop_targets = data[6]
|
||||
|
||||
speaker_ids = [speaker_mapping[speaker_name]
|
||||
for speaker_name in speaker_names]
|
||||
speaker_ids = torch.LongTensor(speaker_ids)
|
||||
if c.num_speakers > 0:
|
||||
speaker_ids = [speaker_mapping[speaker_name]
|
||||
for speaker_name in speaker_names]
|
||||
speaker_ids = torch.LongTensor(speaker_ids)
|
||||
else:
|
||||
speaker_ids = None
|
||||
|
||||
# set stop targets view, we predict a single stop token per r frames prediction
|
||||
stop_targets = stop_targets.view(text_input.shape[0],
|
||||
@@ -320,12 +331,13 @@ def evaluate(model, criterion, criterion_st, ap, current_step, epoch):
|
||||
mel_lengths = mel_lengths.cuda()
|
||||
linear_input = linear_input.cuda() if c.model in ["Tacotron", "TacotronGST"] else None
|
||||
stop_targets = stop_targets.cuda()
|
||||
speaker_ids = speaker_ids.cuda()
|
||||
if speaker_ids is not None:
|
||||
speaker_ids = speaker_ids.cuda()
|
||||
|
||||
# forward pass
|
||||
decoder_output, postnet_output, alignments, stop_tokens =\
|
||||
model.forward(text_input, speaker_ids,
|
||||
text_lengths, mel_input)
|
||||
model.forward(text_input, text_lengths, mel_input,
|
||||
speaker_ids=speaker_ids)
|
||||
|
||||
# loss computation
|
||||
stop_loss = criterion_st(stop_tokens, stop_targets) if c.stopnet else torch.zeros(1)
|
||||
@@ -403,11 +415,12 @@ def evaluate(model, criterion, criterion_st, ap, current_step, epoch):
|
||||
test_audios = {}
|
||||
test_figures = {}
|
||||
print(" | > Synthesizing test sentences")
|
||||
speaker_id = 0
|
||||
speaker_id = 0 if c.num_speakers > 0 else None
|
||||
for idx, test_sentence in enumerate(test_sentences):
|
||||
try:
|
||||
wav, alignment, decoder_output, postnet_output, stop_tokens = synthesis(
|
||||
model, test_sentence, speaker_id, c, use_cuda, ap)
|
||||
model, test_sentence, c, use_cuda, ap,
|
||||
speaker_id=speaker_id)
|
||||
file_path = os.path.join(AUDIO_PATH, str(current_step))
|
||||
os.makedirs(file_path, exist_ok=True)
|
||||
file_path = os.path.join(file_path,
|
||||
@@ -471,7 +484,8 @@ def main(args):
|
||||
args.restore_step = checkpoint['step']
|
||||
# copying speakers.json
|
||||
prev_out_path = os.path.dirname(args.restore_path)
|
||||
copy_speaker_mapping(prev_out_path, OUT_PATH)
|
||||
if c.num_speakers > 0:
|
||||
copy_speaker_mapping(prev_out_path, OUT_PATH)
|
||||
else:
|
||||
args.restore_step = 0
|
||||
|
||||
|
||||
+10
-9
@@ -35,17 +35,17 @@ def compute_style_mel(style_wav, ap, use_cuda):
|
||||
return style_mel
|
||||
|
||||
|
||||
def run_model(model, inputs, speaker_id, CONFIG, truncated, style_mel=None):
|
||||
def run_model(model, inputs, CONFIG, truncated, speaker_id=None, style_mel=None):
|
||||
if CONFIG.model == "TacotronGST" and style_mel is not None:
|
||||
decoder_output, postnet_output, alignments, stop_tokens = model.inference(
|
||||
inputs, style_mel, speaker_id)
|
||||
inputs, style_mel=style_mel, speaker_ids=speaker_id)
|
||||
else:
|
||||
if truncated:
|
||||
decoder_output, postnet_output, alignments, stop_tokens = model.inference_truncated(
|
||||
inputs, speaker_id)
|
||||
inputs, speaker_ids=speaker_id)
|
||||
else:
|
||||
decoder_output, postnet_output, alignments, stop_tokens = model.inference(
|
||||
inputs, speaker_id)
|
||||
inputs, speaker_ids=speaker_id)
|
||||
return decoder_output, postnet_output, alignments, stop_tokens
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ def inv_spectrogram(postnet_output, ap, CONFIG):
|
||||
|
||||
def synthesis(model,
|
||||
text,
|
||||
speaker_id,
|
||||
CONFIG,
|
||||
use_cuda,
|
||||
ap,
|
||||
speaker_id=None,
|
||||
style_wav=None,
|
||||
truncated=False,
|
||||
enable_eos_bos_chars=False,
|
||||
@@ -83,11 +83,11 @@ def synthesis(model,
|
||||
Args:
|
||||
model (TTS.models): model to synthesize.
|
||||
text (str): target text
|
||||
speaker_id (int): id of speaker
|
||||
CONFIG (dict): config dictionary to be loaded from config.json.
|
||||
use_cuda (bool): enable cuda.
|
||||
ap (TTS.utils.audio.AudioProcessor): audio processor to process
|
||||
model outputs.
|
||||
speaker_id (int): id of speaker
|
||||
style_wav (str): Uses for style embedding of GST.
|
||||
truncated (bool): keep model states after inference. It can be used
|
||||
for continuous inference at long texts.
|
||||
@@ -100,13 +100,14 @@ def synthesis(model,
|
||||
style_mel = compute_style_mel(style_wav, ap, use_cuda)
|
||||
# preprocess the given text
|
||||
inputs = text_to_seqvec(text, CONFIG, use_cuda)
|
||||
speaker_id = np.asarray(speaker_id)
|
||||
speaker_id = torch.from_numpy(speaker_id).unsqueeze(0)
|
||||
if speaker_id is not None:
|
||||
speaker_id = np.asarray(speaker_id)
|
||||
speaker_id = torch.from_numpy(speaker_id).unsqueeze(0)
|
||||
if use_cuda:
|
||||
speaker_id.cuda()
|
||||
# synthesize voice
|
||||
decoder_output, postnet_output, alignments, stop_tokens = run_model(
|
||||
model, inputs, speaker_id, CONFIG, truncated, style_mel)
|
||||
model, inputs, CONFIG, truncated, speaker_id, style_mel)
|
||||
# convert outputs to numpy
|
||||
postnet_output, decoder_output, alignment = parse_outputs(
|
||||
postnet_output, decoder_output, alignments)
|
||||
|
||||
Reference in new issue
Block a user