Merge branch 'master' of upstream into commit
This commit is contained in:
commit
abdc0a729f
67
README.md
67
README.md
|
@ -40,7 +40,7 @@ sudo apt-get install libsndfile1
|
||||||
|
|
||||||
### Install PaddlePaddle
|
### Install PaddlePaddle
|
||||||
|
|
||||||
See [install](https://www.paddlepaddle.org.cn/install/quick) for more details. This repo requires PaddlePaddle **1.8.0** or above.
|
See [install](https://www.paddlepaddle.org.cn/install/quick) for more details. This repo requires PaddlePaddle **1.8.2** or above.
|
||||||
|
|
||||||
### Install Parakeet
|
### Install Parakeet
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ Entries to the introduction, and the launch of training and synthsis for differe
|
||||||
|
|
||||||
## Pre-trained models and audio samples
|
## Pre-trained models and audio samples
|
||||||
|
|
||||||
Parakeet also releases some well-trained parameters for the example models, which can be accessed in the following tables. Each column of these tables lists resources for one model, including the url link to the pre-trained model, the dataset that the model is trained on, and synthesized audio samples based on the pre-trained model.
|
Parakeet also releases some well-trained parameters for the example models, which can be accessed in the following tables. Each column of these tables lists resources for one model, including the url link to the pre-trained model, the dataset that the model is trained on, and synthesized audio samples based on the pre-trained model. Click each model name to download, then you can get the compressed package which contains the pre-trained model and the `yaml` config describing how the model is trained.
|
||||||
|
|
||||||
#### Vocoders
|
#### Vocoders
|
||||||
|
|
||||||
|
@ -174,29 +174,77 @@ We provide the model checkpoints of WaveFlow with 64 and 128 residual channels,
|
||||||
|
|
||||||
#### TTS models
|
#### TTS models
|
||||||
|
|
||||||
|
We also provide checkpoints for different end-to-end TTS models, and present the synthesized audio examples for some randomly chosen famous quotes. The corresponding texts are displayed as follows.
|
||||||
|
|
||||||
|
||Text | From |
|
||||||
|
|:-:|:-- | :--: |
|
||||||
|
0|*Life was like a box of chocolates, you never know what you're gonna get.* | *Forrest Gump* |
|
||||||
|
1|*With great power there must come great responsibility.* | *Spider-Man*|
|
||||||
|
2|*To be or not to be, that’s a question.*|*Hamlet*|
|
||||||
|
3|*Death is just a part of life, something we're all destined to do.*| *Forrest Gump*|
|
||||||
|
4|*Don’t argue with the people of strong determination, because they may change the fact!*| *William Shakespeare* |
|
||||||
|
|
||||||
|
Users have the option to use different vocoders to convert the linear/mel spectrogam to the raw audio in TTS models. Taking this into account, we are going to release the checkpoints for TTS models adapted to different vocoders, including the [Griffin-Lim](https://ieeexplore.ieee.org/document/1164317) algorithm and some neural vocoders.
|
||||||
|
|
||||||
|
##### 1) Griffin-Lim
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 250px">
|
<th style="width: 250px">
|
||||||
Deep Voice 3
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/deepvoice3_ljspeech_griffin-lim_ckpt_1.0.zip">Deep Voice 3</a>
|
||||||
</th>
|
</th>
|
||||||
<th style="width: 250px">
|
<th style="width: 250px">
|
||||||
Transformer TTS
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/transformer_tts_ljspeech_griffin-lim_ckpt_1.0.zip">Transformer TTS</a>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
<th style="width: 250px">
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/fastspeech_ljspeech_griffin-lim_ckpt_1.0.zip">FastSpeech</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>LJSpeech </th>
|
<th>LJSpeech </th>
|
||||||
<th>LJSpeech </th>
|
<th>LJSpeech </th>
|
||||||
|
<th>LJSpeech </th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="height: 150px">
|
<th style="height: 150px">
|
||||||
To be added soon
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/deepvoice3_ljspeech_griffin-lim_samples_1.0/step_1560000_sentence_0.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/deepvoice3_ljspeech_griffin-lim_samples_1.0/step_1560000_sentence_1.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/deepvoice3_ljspeech_griffin-lim_samples_1.0/step_1560000_sentence_2.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/deepvoice3_ljspeech_griffin-lim_samples_1.0/step_1560000_sentence_3.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/deepvoice3_ljspeech_griffin-lim_samples_1.0/step_1560000_sentence_4.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a>
|
||||||
</th>
|
</th>
|
||||||
<th >
|
<th >
|
||||||
To be added soon
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/transformer_tts_ljspeech_griffin-lim_samples_1.0/step_120000_sentence_0.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/transformer_tts_ljspeech_griffin-lim_samples_1.0/step_120000_sentence_1.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/transformer_tts_ljspeech_griffin-lim_samples_1.0/step_120000_sentence_2.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/transformer_tts_ljspeech_griffin-lim_samples_1.0/step_120000_sentence_3.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/transformer_tts_ljspeech_griffin-lim_samples_1.0/step_120000_sentence_4.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a>
|
||||||
|
</th>
|
||||||
|
<th >
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/fastspeech_ljspeech_griffin-lim_samples_1.0/step_130000_sentence_0.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/fastspeech_ljspeech_griffin-lim_samples_1.0/step_130000_sentence_1.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/fastspeech_ljspeech_griffin-lim_samples_1.0/step_130000_sentence_2.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/fastspeech_ljspeech_griffin-lim_samples_1.0/step_130000_sentence_3.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a><br>
|
||||||
|
<a href="https://paddlespeech.bj.bcebos.com/Parakeet/fastspeech_ljspeech_griffin-lim_samples_1.0/step_130000_sentence_4.wav">
|
||||||
|
<img src="images/audio_icon.png" width=250 /></a>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -204,8 +252,9 @@ We provide the model checkpoints of WaveFlow with 64 and 128 residual channels,
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Click each link to download, then you can get the compressed package which contains the pre-trained model and the `yaml` config describing how to train the model.
|
##### 2) Neural vocoders
|
||||||
|
|
||||||
|
under preparation
|
||||||
|
|
||||||
## Copyright and License
|
## Copyright and License
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ Example script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python synthesis.py \
|
python synthesis.py \
|
||||||
--config=./configs/wavenet_single_gaussian.yaml \
|
--config=./configs/clarinet_ljspeech.yaml \
|
||||||
--data=./LJSpeech-1.1/ \
|
--data=./LJSpeech-1.1/ \
|
||||||
--device=0 \
|
--device=0 \
|
||||||
--iteration=500000 \
|
--iteration=500000 \
|
||||||
|
@ -140,7 +140,7 @@ or
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python synthesis.py \
|
python synthesis.py \
|
||||||
--config=./configs/wavenet_single_gaussian.yaml \
|
--config=./configs/clarinet_ljspeech.yaml \
|
||||||
--data=./LJSpeech-1.1/ \
|
--data=./LJSpeech-1.1/ \
|
||||||
--device=0 \
|
--device=0 \
|
||||||
--checkpoint="experiment/checkpoints/step-500000" \
|
--checkpoint="experiment/checkpoints/step-500000" \
|
||||||
|
|
|
@ -230,7 +230,7 @@ def make_data_loader(data_root, config):
|
||||||
ref_level_db=c["ref_level_db"],
|
ref_level_db=c["ref_level_db"],
|
||||||
max_norm=c["max_norm"],
|
max_norm=c["max_norm"],
|
||||||
clip_norm=c["clip_norm"])
|
clip_norm=c["clip_norm"])
|
||||||
ljspeech = CacheDataset(TransformDataset(meta, transform))
|
ljspeech = TransformDataset(meta, transform)
|
||||||
|
|
||||||
# use meta data's text length as a sort key for the sampler
|
# use meta data's text length as a sort key for the sampler
|
||||||
batch_size = config["train"]["batch_size"]
|
batch_size = config["train"]["batch_size"]
|
||||||
|
|
|
@ -60,7 +60,7 @@ def add_options(parser):
|
||||||
|
|
||||||
def make_evaluator(config, text_sequences, output_dir, writer=None):
|
def make_evaluator(config, text_sequences, output_dir, writer=None):
|
||||||
c = config["transform"]
|
c = config["transform"]
|
||||||
p_replace = c["replace_pronunciation_prob"]
|
p_replace = 0.0
|
||||||
sample_rate = c["sample_rate"]
|
sample_rate = c["sample_rate"]
|
||||||
preemphasis = c["preemphasis"]
|
preemphasis = c["preemphasis"]
|
||||||
win_length = c["win_length"]
|
win_length = c["win_length"]
|
||||||
|
@ -121,7 +121,7 @@ class Evaluator(object):
|
||||||
en.text_to_sequence(
|
en.text_to_sequence(
|
||||||
text, p=self.p_replace), dtype=np.int64)
|
text, p=self.p_replace), dtype=np.int64)
|
||||||
length = len(text)
|
length = len(text)
|
||||||
text_positions = np.arange(1, 1 + length)
|
text_positions = np.arange(1, 1 + length, dtype=np.int64)
|
||||||
text = np.expand_dims(text, 0)
|
text = np.expand_dims(text, 0)
|
||||||
text_positions = np.expand_dims(text_positions, 0)
|
text_positions = np.expand_dims(text_positions, 0)
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Conditioner(dg.Layer):
|
||||||
stride=(1, s),
|
stride=(1, s),
|
||||||
param_attr=param_attr,
|
param_attr=param_attr,
|
||||||
bias_attr=bias_attr,
|
bias_attr=bias_attr,
|
||||||
dtype="float32")
|
dtype=dtype)
|
||||||
self.upsample_conv2d.append(conv_trans2d)
|
self.upsample_conv2d.append(conv_trans2d)
|
||||||
|
|
||||||
for i, layer in enumerate(self.upsample_conv2d):
|
for i, layer in enumerate(self.upsample_conv2d):
|
||||||
|
@ -88,12 +88,7 @@ class Conditioner(dg.Layer):
|
||||||
def forward(self, x):
|
def forward(self, x):
|
||||||
x = fluid.layers.unsqueeze(x, 1)
|
x = fluid.layers.unsqueeze(x, 1)
|
||||||
for layer in self.upsample_conv2d:
|
for layer in self.upsample_conv2d:
|
||||||
in_dtype = x.dtype
|
|
||||||
if in_dtype == fluid.core.VarDesc.VarType.FP16:
|
|
||||||
x = fluid.layers.cast(x, "float32")
|
|
||||||
x = layer(x)
|
x = layer(x)
|
||||||
if in_dtype == fluid.core.VarDesc.VarType.FP16:
|
|
||||||
x = fluid.layers.cast(x, "float16")
|
|
||||||
x = fluid.layers.leaky_relu(x, alpha=0.4)
|
x = fluid.layers.leaky_relu(x, alpha=0.4)
|
||||||
|
|
||||||
return fluid.layers.squeeze(x, [1])
|
return fluid.layers.squeeze(x, [1])
|
||||||
|
@ -101,12 +96,7 @@ class Conditioner(dg.Layer):
|
||||||
def infer(self, x):
|
def infer(self, x):
|
||||||
x = fluid.layers.unsqueeze(x, 1)
|
x = fluid.layers.unsqueeze(x, 1)
|
||||||
for layer in self.upsample_conv2d:
|
for layer in self.upsample_conv2d:
|
||||||
in_dtype = x.dtype
|
|
||||||
if in_dtype == fluid.core.VarDesc.VarType.FP16:
|
|
||||||
x = fluid.layers.cast(x, "float32")
|
|
||||||
x = layer(x)
|
x = layer(x)
|
||||||
if in_dtype == fluid.core.VarDesc.VarType.FP16:
|
|
||||||
x = fluid.layers.cast(x, "float16")
|
|
||||||
# Trim conv artifacts.
|
# Trim conv artifacts.
|
||||||
time_cutoff = layer._filter_size[1] - layer._stride[1]
|
time_cutoff = layer._filter_size[1] - layer._stride[1]
|
||||||
x = fluid.layers.leaky_relu(x[:, :, :, :-time_cutoff], alpha=0.4)
|
x = fluid.layers.leaky_relu(x[:, :, :, :-time_cutoff], alpha=0.4)
|
||||||
|
@ -348,7 +338,7 @@ class WaveFlowModule(dg.Layer):
|
||||||
mel = self.conditioner(mel)
|
mel = self.conditioner(mel)
|
||||||
assert mel.shape[2] >= audio.shape[1]
|
assert mel.shape[2] >= audio.shape[1]
|
||||||
# Prune out the tail of audio/mel so that time/n_group == 0.
|
# Prune out the tail of audio/mel so that time/n_group == 0.
|
||||||
pruned_len = audio.shape[1] // self.n_group * self.n_group
|
pruned_len = int(audio.shape[1] // self.n_group * self.n_group)
|
||||||
|
|
||||||
if audio.shape[1] > pruned_len:
|
if audio.shape[1] > pruned_len:
|
||||||
audio = audio[:, :pruned_len]
|
audio = audio[:, :pruned_len]
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
from paddle import fluid
|
from paddle import fluid
|
||||||
import paddle.fluid.dygraph as dg
|
import paddle.fluid.dygraph as dg
|
||||||
import paddle.fluid.layers as F
|
import paddle.fluid.layers as F
|
||||||
|
@ -44,10 +43,10 @@ def norm_except(param, dim, power):
|
||||||
if dim is None:
|
if dim is None:
|
||||||
return norm(param, dim, power)
|
return norm(param, dim, power)
|
||||||
elif dim == 0:
|
elif dim == 0:
|
||||||
param_matrix = F.reshape(param, (shape[0], np.prod(shape[1:])))
|
param_matrix = F.reshape(param, (shape[0], -1))
|
||||||
return norm(param_matrix, dim=1, power=power)
|
return norm(param_matrix, dim=1, power=power)
|
||||||
elif dim == -1 or dim == ndim - 1:
|
elif dim == -1 or dim == ndim - 1:
|
||||||
param_matrix = F.reshape(param, (np.prod(shape[:-1]), shape[-1]))
|
param_matrix = F.reshape(param, (-1, shape[-1]))
|
||||||
return norm(param_matrix, dim=0, power=power)
|
return norm(param_matrix, dim=0, power=power)
|
||||||
else:
|
else:
|
||||||
perm = list(range(ndim))
|
perm = list(range(ndim))
|
||||||
|
@ -62,24 +61,26 @@ def compute_l2_normalized_weight(v, g, dim):
|
||||||
ndim = len(shape)
|
ndim = len(shape)
|
||||||
|
|
||||||
if dim is None:
|
if dim is None:
|
||||||
v_normalized = v / (F.reduce_sum(F.square(v)) + 1e-12)
|
v_normalized = v / (F.sqrt(F.reduce_sum(F.square(v))) + 1e-12)
|
||||||
elif dim == 0:
|
elif dim == 0:
|
||||||
param_matrix = F.reshape(v, (shape[0], np.prod(shape[1:])))
|
param_matrix = F.reshape(v, (shape[0], -1))
|
||||||
v_normalized = F.l2_normalize(param_matrix, axis=1)
|
v_normalized = F.l2_normalize(param_matrix, axis=1)
|
||||||
|
v_normalized = F.reshape(v_normalized, shape)
|
||||||
elif dim == -1 or dim == ndim - 1:
|
elif dim == -1 or dim == ndim - 1:
|
||||||
param_matrix = F.reshape(v, (np.prod(shape[:-1]), shape[-1]))
|
param_matrix = F.reshape(v, (-1, shape[-1]))
|
||||||
v_normalized = F.l2_normalize(param_matrix, axis=0)
|
v_normalized = F.l2_normalize(param_matrix, axis=0)
|
||||||
|
v_normalized = F.reshape(v_normalized, shape)
|
||||||
else:
|
else:
|
||||||
perm = list(range(ndim))
|
perm = list(range(ndim))
|
||||||
perm[0] = dim
|
perm[0] = dim
|
||||||
perm[dim] = 0
|
perm[dim] = 0
|
||||||
transposed_param = F.transpose(v, perm)
|
transposed_param = F.transpose(v, perm)
|
||||||
param_matrix = F.reshape(
|
transposed_shape = transposed_param.shape
|
||||||
transposed_param,
|
param_matrix = F.reshape(transposed_param,
|
||||||
(transposed_param.shape[0], np.prod(transposed_param.shape[1:])))
|
(transposed_param.shape[0], -1))
|
||||||
v_normalized = F.l2_normalize(param_matrix, axis=1)
|
v_normalized = F.l2_normalize(param_matrix, axis=1)
|
||||||
|
v_normalized = F.reshape(v_normalized, transposed_shape)
|
||||||
v_normalized = F.transpose(v_normalized, perm)
|
v_normalized = F.transpose(v_normalized, perm)
|
||||||
v_normalized = F.reshape(v_normalized, shape)
|
|
||||||
weight = F.elementwise_mul(v_normalized, g, axis=dim)
|
weight = F.elementwise_mul(v_normalized, g, axis=dim)
|
||||||
return weight
|
return weight
|
||||||
|
|
||||||
|
@ -87,7 +88,14 @@ def compute_l2_normalized_weight(v, g, dim):
|
||||||
def compute_weight(v, g, dim, power):
|
def compute_weight(v, g, dim, power):
|
||||||
assert len(g.shape) == 1, "magnitude should be a vector"
|
assert len(g.shape) == 1, "magnitude should be a vector"
|
||||||
if power == 2:
|
if power == 2:
|
||||||
return compute_l2_normalized_weight(v, g, dim)
|
in_dtype = v.dtype
|
||||||
|
if in_dtype == fluid.core.VarDesc.VarType.FP16:
|
||||||
|
v = F.cast(v, "float32")
|
||||||
|
g = F.cast(g, "float32")
|
||||||
|
weight = compute_l2_normalized_weight(v, g, dim)
|
||||||
|
if in_dtype == fluid.core.VarDesc.VarType.FP16:
|
||||||
|
weight = F.cast(weight, "float16")
|
||||||
|
return weight
|
||||||
else:
|
else:
|
||||||
v_normalized = F.elementwise_div(
|
v_normalized = F.elementwise_div(
|
||||||
v, (norm_except(v, dim, power) + 1e-12), axis=dim)
|
v, (norm_except(v, dim, power) + 1e-12), axis=dim)
|
||||||
|
|
7
setup.py
7
setup.py
|
@ -15,7 +15,6 @@
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
@ -55,8 +54,8 @@ setup_info = dict(
|
||||||
'inflect',
|
'inflect',
|
||||||
'librosa',
|
'librosa',
|
||||||
'unidecode',
|
'unidecode',
|
||||||
'numba',
|
'numba==0.47.0',
|
||||||
'tqdm',
|
'tqdm==4.19.8',
|
||||||
'matplotlib',
|
'matplotlib',
|
||||||
'tensorboardX',
|
'tensorboardX',
|
||||||
'tensorboard',
|
'tensorboard',
|
||||||
|
@ -65,7 +64,7 @@ setup_info = dict(
|
||||||
'pandas',
|
'pandas',
|
||||||
'sox',
|
'sox',
|
||||||
'soundfile',
|
'soundfile',
|
||||||
'llvmlite==0.31.0' if sys.version_info < (3, 6) else "llvmlite",
|
'llvmlite==0.31.0',
|
||||||
],
|
],
|
||||||
|
|
||||||
# Package info
|
# Package info
|
||||||
|
|
Loading…
Reference in New Issue