From fab19b7eff42941d22d1a805698396b6aae86605 Mon Sep 17 00:00:00 2001 From: kinghuin Date: Tue, 21 Jul 2020 10:20:57 +0800 Subject: [PATCH] optimize Parakeet (#762) --- hub_module/modules/audio/tts/deepvoice3_ljspeech/README.md | 3 ++- hub_module/modules/audio/tts/deepvoice3_ljspeech/module.py | 7 +++++++ hub_module/modules/audio/tts/fastspeech_ljspeech/README.md | 3 ++- .../modules/audio/tts/transformer_tts_ljspeech/README.md | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hub_module/modules/audio/tts/deepvoice3_ljspeech/README.md b/hub_module/modules/audio/tts/deepvoice3_ljspeech/README.md index fc7128b9..a1a659d2 100644 --- a/hub_module/modules/audio/tts/deepvoice3_ljspeech/README.md +++ b/hub_module/modules/audio/tts/deepvoice3_ljspeech/README.md @@ -11,7 +11,7 @@ Deep Voice 3是百度研究院2017年发布的端到端的TTS模型(论文录 ## 命令行预测 ```shell -$ hub run deepvoice3_ljspeech --input_text='Simple as this proposition is, it is necessary to be stated' +$ hub run deepvoice3_ljspeech --input_text='Simple as this proposition is, it is necessary to be stated' --use_gpu True --vocoder griffin-lim ``` ## API @@ -103,6 +103,7 @@ paddlepaddle >= 1.8.2 paddlehub >= 1.7.0 **NOTE:** 除了python依赖外还必须安装libsndfile库 + 对于Ubuntu用户,请执行: ``` sudo apt-get install libsndfile1 diff --git a/hub_module/modules/audio/tts/deepvoice3_ljspeech/module.py b/hub_module/modules/audio/tts/deepvoice3_ljspeech/module.py index 0847cc3c..ec76b972 100644 --- a/hub_module/modules/audio/tts/deepvoice3_ljspeech/module.py +++ b/hub_module/modules/audio/tts/deepvoice3_ljspeech/module.py @@ -60,6 +60,7 @@ if not lack_dependency: from parakeet.g2p import en from parakeet.models.deepvoice3 import Encoder, Decoder, PostNet, SpectraNet from parakeet.models.waveflow import WaveFlowModule + from parakeet.models.deepvoice3.weight_norm_hook import remove_weight_norm else: raise ImportError( "The module requires additional dependencies: %s. You can install parakeet via 'git clone https://github.com/PaddlePaddle/Parakeet && cd Parakeet && pip install -e .' and others via pip install" @@ -186,6 +187,12 @@ class DeepVoice3(hub.NLPPredictionModule): encoder, decoder, postnet) io.load_parameters( model=self.tts_model, checkpoint_path=self.tts_checkpoint_path) + for name, layer in self.tts_model.named_sublayers(): + try: + remove_weight_norm(layer) + except ValueError: + # this layer has not weight norm hook + pass self.waveflow = WaveflowVocoder( config_path=self.waveflow_config_path, diff --git a/hub_module/modules/audio/tts/fastspeech_ljspeech/README.md b/hub_module/modules/audio/tts/fastspeech_ljspeech/README.md index 5709ee17..a2be971d 100644 --- a/hub_module/modules/audio/tts/fastspeech_ljspeech/README.md +++ b/hub_module/modules/audio/tts/fastspeech_ljspeech/README.md @@ -11,7 +11,7 @@ FastSpeech是基于Transformer的前馈神经网络,作者从encoder-decoder ## 命令行预测 ```shell -$ hub run fastspeech_ljspeech --input_text='Simple as this proposition is, it is necessary to be stated' +$ hub run fastspeech_ljspeech --input_text='Simple as this proposition is, it is necessary to be stated' --use_gpu True --vocoder griffin-lim ``` ## API @@ -104,6 +104,7 @@ paddlepaddle >= 1.8.2 paddlehub >= 1.7.0 **NOTE:** 除了python依赖外还必须安装libsndfile库 + 对于Ubuntu用户,请执行: ``` sudo apt-get install libsndfile1 diff --git a/hub_module/modules/audio/tts/transformer_tts_ljspeech/README.md b/hub_module/modules/audio/tts/transformer_tts_ljspeech/README.md index 933e0274..2be5603e 100644 --- a/hub_module/modules/audio/tts/transformer_tts_ljspeech/README.md +++ b/hub_module/modules/audio/tts/transformer_tts_ljspeech/README.md @@ -102,6 +102,7 @@ paddlepaddle >= 1.8.2 paddlehub >= 1.7.0 **NOTE:** 除了python依赖外还必须安装libsndfile库 + 对于Ubuntu用户,请执行: ``` sudo apt-get install libsndfile1 -- GitLab