From 4b94af98e5dcd364936c996f9e3dd661b6c481e9 Mon Sep 17 00:00:00 2001 From: TianYuan Date: Tue, 12 Oct 2021 10:39:21 +0000 Subject: [PATCH] add __init__ for models --- .../baker/synthesize_from_wav.py | 4 ++-- .../GANVocoder/parallelwave_gan/synthesize.py | 2 +- examples/GANVocoder/parallelwave_gan/train.py | 8 ++++---- examples/fastspeech2/aishell3/synthesize_e2e.py | 8 ++++---- examples/fastspeech2/baker/synthesize_e2e.py | 8 ++++---- examples/fastspeech2/ljspeech/synthesize_e2e.py | 8 ++++---- examples/fastspeech2/synthesize.py | 8 ++++---- examples/fastspeech2/train.py | 9 +++++---- examples/speedyspeech/baker/synthesize_e2e.py | 8 ++++---- examples/speedyspeech/synthesize.py | 8 ++++---- examples/speedyspeech/train.py | 6 +++--- .../transformer_tts/ljspeech/synthesize_e2e.py | 4 ++-- examples/transformer_tts/synthesize.py | 4 ++-- examples/transformer_tts/train.py | 6 +++--- parakeet/models/fastspeech2/__init__.py | 16 ++++++++++++++++ .../models/fastspeech2/fastspeech2_updater.py | 2 +- parakeet/models/parallel_wavegan/__init__.py | 16 ++++++++++++++++ parakeet/models/speedyspeech/__init__.py | 16 ++++++++++++++++ .../models/speedyspeech/speedyspeech_updater.py | 3 ++- parakeet/models/transformer_tts/__init__.py | 16 ++++++++++++++++ .../transformer_tts/transformer_tts_updater.py | 4 ++-- 21 files changed, 115 insertions(+), 49 deletions(-) create mode 100644 parakeet/models/fastspeech2/__init__.py create mode 100644 parakeet/models/parallel_wavegan/__init__.py create mode 100644 parakeet/models/speedyspeech/__init__.py create mode 100644 parakeet/models/transformer_tts/__init__.py diff --git a/examples/GANVocoder/parallelwave_gan/baker/synthesize_from_wav.py b/examples/GANVocoder/parallelwave_gan/baker/synthesize_from_wav.py index 5435422c..16db38b4 100644 --- a/examples/GANVocoder/parallelwave_gan/baker/synthesize_from_wav.py +++ b/examples/GANVocoder/parallelwave_gan/baker/synthesize_from_wav.py @@ -23,8 +23,8 @@ import soundfile as sf import yaml from parakeet.data.get_feats import LogMelFBank -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore from yacs.config import CfgNode as Configuration diff --git a/examples/GANVocoder/parallelwave_gan/synthesize.py b/examples/GANVocoder/parallelwave_gan/synthesize.py index 1ee52dbc..7c37e340 100644 --- a/examples/GANVocoder/parallelwave_gan/synthesize.py +++ b/examples/GANVocoder/parallelwave_gan/synthesize.py @@ -24,7 +24,7 @@ import yaml from paddle import distributed as dist from parakeet.datasets.data_table import DataTable -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGGenerator from yacs.config import CfgNode diff --git a/examples/GANVocoder/parallelwave_gan/train.py b/examples/GANVocoder/parallelwave_gan/train.py index ec357a30..7e6aa9a6 100644 --- a/examples/GANVocoder/parallelwave_gan/train.py +++ b/examples/GANVocoder/parallelwave_gan/train.py @@ -30,10 +30,10 @@ from paddle.optimizer.lr import StepDecay from parakeet.datasets.data_table import DataTable from parakeet.datasets.vocoder_batch_fn import Clip -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGDiscriminator -from parakeet.models.parallel_wavegan.parallel_wavegan_updater import PWGUpdater -from parakeet.models.parallel_wavegan.parallel_wavegan_updater import PWGEvaluator +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGDiscriminator +from parakeet.models.parallel_wavegan import PWGUpdater +from parakeet.models.parallel_wavegan import PWGEvaluator from parakeet.modules.stft_loss import MultiResolutionSTFTLoss from parakeet.training.extensions.snapshot import Snapshot from parakeet.training.extensions.visualizer import VisualDL diff --git a/examples/fastspeech2/aishell3/synthesize_e2e.py b/examples/fastspeech2/aishell3/synthesize_e2e.py index b4be5db7..bc7c2f24 100644 --- a/examples/fastspeech2/aishell3/synthesize_e2e.py +++ b/examples/fastspeech2/aishell3/synthesize_e2e.py @@ -21,10 +21,10 @@ import soundfile as sf import yaml from parakeet.frontend.zh_frontend import Frontend -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2 -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2Inference -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.fastspeech2 import FastSpeech2 +from parakeet.models.fastspeech2 import FastSpeech2Inference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore from yacs.config import CfgNode diff --git a/examples/fastspeech2/baker/synthesize_e2e.py b/examples/fastspeech2/baker/synthesize_e2e.py index 0321bda4..7b39ab6a 100644 --- a/examples/fastspeech2/baker/synthesize_e2e.py +++ b/examples/fastspeech2/baker/synthesize_e2e.py @@ -21,10 +21,10 @@ import soundfile as sf import yaml from parakeet.frontend.zh_frontend import Frontend -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2 -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2Inference -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.fastspeech2 import FastSpeech2 +from parakeet.models.fastspeech2 import FastSpeech2Inference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore from yacs.config import CfgNode diff --git a/examples/fastspeech2/ljspeech/synthesize_e2e.py b/examples/fastspeech2/ljspeech/synthesize_e2e.py index 16890658..93ed91c0 100644 --- a/examples/fastspeech2/ljspeech/synthesize_e2e.py +++ b/examples/fastspeech2/ljspeech/synthesize_e2e.py @@ -22,10 +22,10 @@ import yaml from yacs.config import CfgNode from parakeet.frontend import English -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2 -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2Inference -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.fastspeech2 import FastSpeech2 +from parakeet.models.fastspeech2 import FastSpeech2Inference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore diff --git a/examples/fastspeech2/synthesize.py b/examples/fastspeech2/synthesize.py index af427ab6..aee7bcee 100644 --- a/examples/fastspeech2/synthesize.py +++ b/examples/fastspeech2/synthesize.py @@ -23,10 +23,10 @@ import yaml from yacs.config import CfgNode from parakeet.datasets.data_table import DataTable -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2 -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2Inference -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.fastspeech2 import FastSpeech2 +from parakeet.models.fastspeech2 import FastSpeech2Inference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore diff --git a/examples/fastspeech2/train.py b/examples/fastspeech2/train.py index 99c5c7b9..1ea2c561 100644 --- a/examples/fastspeech2/train.py +++ b/examples/fastspeech2/train.py @@ -23,13 +23,14 @@ import yaml from paddle import DataParallel from paddle import distributed as dist -from paddle.io import DataLoader, DistributedBatchSampler +from paddle.io import DataLoader +from paddle.io import DistributedBatchSampler from parakeet.datasets.data_table import DataTable from parakeet.datasets.am_batch_fn import fastspeech2_single_spk_batch_fn from parakeet.datasets.am_batch_fn import fastspeech2_multi_spk_batch_fn -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2 -from parakeet.models.fastspeech2.fastspeech2_updater import FastSpeech2Evaluator -from parakeet.models.fastspeech2.fastspeech2_updater import FastSpeech2Updater +from parakeet.models.fastspeech2 import FastSpeech2 +from parakeet.models.fastspeech2 import FastSpeech2Evaluator +from parakeet.models.fastspeech2 import FastSpeech2Updater from parakeet.training.extensions.snapshot import Snapshot from parakeet.training.extensions.visualizer import VisualDL from parakeet.training.optimizer import build_optimizers diff --git a/examples/speedyspeech/baker/synthesize_e2e.py b/examples/speedyspeech/baker/synthesize_e2e.py index 80330f29..f633aeab 100644 --- a/examples/speedyspeech/baker/synthesize_e2e.py +++ b/examples/speedyspeech/baker/synthesize_e2e.py @@ -24,10 +24,10 @@ from paddle import jit from paddle.static import InputSpec from parakeet.frontend.zh_frontend import Frontend -from parakeet.models.speedyspeech.speedyspeech import SpeedySpeech -from parakeet.models.speedyspeech.speedyspeech import SpeedySpeechInference -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.speedyspeech import SpeedySpeech +from parakeet.models.speedyspeech import SpeedySpeechInference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore from yacs.config import CfgNode diff --git a/examples/speedyspeech/synthesize.py b/examples/speedyspeech/synthesize.py index 82d5e6fa..550f9405 100644 --- a/examples/speedyspeech/synthesize.py +++ b/examples/speedyspeech/synthesize.py @@ -26,10 +26,10 @@ from yacs.config import CfgNode from parakeet.datasets.data_table import DataTable -from parakeet.models.speedyspeech.speedyspeech import SpeedySpeech -from parakeet.models.speedyspeech.speedyspeech import SpeedySpeechInference -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGGenerator -from parakeet.models.parallel_wavegan.parallel_wavegan import PWGInference +from parakeet.models.speedyspeech import SpeedySpeech +from parakeet.models.speedyspeech import SpeedySpeechInference +from parakeet.models.parallel_wavegan import PWGGenerator +from parakeet.models.parallel_wavegan import PWGInference from parakeet.modules.normalizer import ZScore diff --git a/examples/speedyspeech/train.py b/examples/speedyspeech/train.py index f9436e57..f7a4e301 100644 --- a/examples/speedyspeech/train.py +++ b/examples/speedyspeech/train.py @@ -27,9 +27,9 @@ from paddle.io import DistributedBatchSampler from parakeet.datasets.data_table import DataTable from parakeet.datasets.am_batch_fn import speedyspeech_batch_fn -from parakeet.models.speedyspeech.speedyspeech import SpeedySpeech -from parakeet.models.speedyspeech.speedyspeech_updater import SpeedySpeechEvaluator -from parakeet.models.speedyspeech.speedyspeech_updater import SpeedySpeechUpdater +from parakeet.models.speedyspeech import SpeedySpeech +from parakeet.models.speedyspeech import SpeedySpeechEvaluator +from parakeet.models.speedyspeech import SpeedySpeechUpdater from parakeet.training.extensions.snapshot import Snapshot from parakeet.training.extensions.visualizer import VisualDL from parakeet.training.optimizer import build_optimizers diff --git a/examples/transformer_tts/ljspeech/synthesize_e2e.py b/examples/transformer_tts/ljspeech/synthesize_e2e.py index d3680b05..534b6aa0 100644 --- a/examples/transformer_tts/ljspeech/synthesize_e2e.py +++ b/examples/transformer_tts/ljspeech/synthesize_e2e.py @@ -22,8 +22,8 @@ import yaml from yacs.config import CfgNode from parakeet.frontend import English -from parakeet.models.transformer_tts.transformer_tts import TransformerTTS -from parakeet.models.transformer_tts.transformer_tts import TransformerTTSInference +from parakeet.models.transformer_tts import TransformerTTS +from parakeet.models.transformer_tts import TransformerTTSInference from parakeet.models.waveflow import ConditionalWaveFlow from parakeet.modules.normalizer import ZScore from parakeet.utils import layer_tools diff --git a/examples/transformer_tts/synthesize.py b/examples/transformer_tts/synthesize.py index 2af508bf..c71b4065 100644 --- a/examples/transformer_tts/synthesize.py +++ b/examples/transformer_tts/synthesize.py @@ -23,8 +23,8 @@ import yaml from yacs.config import CfgNode from parakeet.datasets.data_table import DataTable -from parakeet.models.transformer_tts.transformer_tts import TransformerTTS -from parakeet.models.transformer_tts.transformer_tts import TransformerTTSInference +from parakeet.models.transformer_tts import TransformerTTS +from parakeet.models.transformer_tts import TransformerTTSInference from parakeet.models.waveflow import ConditionalWaveFlow from parakeet.modules.normalizer import ZScore from parakeet.utils import layer_tools diff --git a/examples/transformer_tts/train.py b/examples/transformer_tts/train.py index 2899a44e..b1263bcc 100644 --- a/examples/transformer_tts/train.py +++ b/examples/transformer_tts/train.py @@ -28,9 +28,9 @@ from paddle.io import DistributedBatchSampler from parakeet.datasets.data_table import DataTable from parakeet.datasets.am_batch_fn import transformer_single_spk_batch_fn -from parakeet.models.transformer_tts.transformer_tts import TransformerTTS -from parakeet.models.transformer_tts.transformer_tts_updater import TransformerTTSUpdater -from parakeet.models.transformer_tts.transformer_tts_updater import TransformerTTSEvaluator +from parakeet.models.transformer_tts import TransformerTTS +from parakeet.models.transformer_tts import TransformerTTSUpdater +from parakeet.models.transformer_tts import TransformerTTSEvaluator from parakeet.training.extensions.snapshot import Snapshot from parakeet.training.extensions.visualizer import VisualDL from parakeet.training.optimizer import build_optimizers diff --git a/parakeet/models/fastspeech2/__init__.py b/parakeet/models/fastspeech2/__init__.py new file mode 100644 index 00000000..83479d6f --- /dev/null +++ b/parakeet/models/fastspeech2/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .fastspeech2 import * +from .fastspeech2_updater import * diff --git a/parakeet/models/fastspeech2/fastspeech2_updater.py b/parakeet/models/fastspeech2/fastspeech2_updater.py index b579fc27..789965f4 100644 --- a/parakeet/models/fastspeech2/fastspeech2_updater.py +++ b/parakeet/models/fastspeech2/fastspeech2_updater.py @@ -14,7 +14,7 @@ import logging from paddle import distributed as dist -from parakeet.models.fastspeech2.fastspeech2 import FastSpeech2Loss +from parakeet.models.fastspeech2 import FastSpeech2Loss from parakeet.training.extensions.evaluator import StandardEvaluator from parakeet.training.reporter import report from parakeet.training.updaters.standard_updater import StandardUpdater diff --git a/parakeet/models/parallel_wavegan/__init__.py b/parakeet/models/parallel_wavegan/__init__.py new file mode 100644 index 00000000..89403c0e --- /dev/null +++ b/parakeet/models/parallel_wavegan/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .parallel_wavegan import * +from .parallel_wavegan_updater import * diff --git a/parakeet/models/speedyspeech/__init__.py b/parakeet/models/speedyspeech/__init__.py new file mode 100644 index 00000000..6d9b7088 --- /dev/null +++ b/parakeet/models/speedyspeech/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .speedyspeech import * +from .speedyspeech_updater import * diff --git a/parakeet/models/speedyspeech/speedyspeech_updater.py b/parakeet/models/speedyspeech/speedyspeech_updater.py index e897fdf3..3135d342 100644 --- a/parakeet/models/speedyspeech/speedyspeech_updater.py +++ b/parakeet/models/speedyspeech/speedyspeech_updater.py @@ -17,7 +17,8 @@ from paddle import distributed as dist from paddle.fluid.layers import huber_loss from paddle.nn import functional as F -from parakeet.modules.losses import masked_l1_loss, weighted_mean +from parakeet.modules.losses import masked_l1_loss +from parakeet.modules.losses import weighted_mean from parakeet.modules.ssim import ssim from parakeet.training.extensions.evaluator import StandardEvaluator from parakeet.training.reporter import report diff --git a/parakeet/models/transformer_tts/__init__.py b/parakeet/models/transformer_tts/__init__.py new file mode 100644 index 00000000..0456c300 --- /dev/null +++ b/parakeet/models/transformer_tts/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from .transformer_tts import * +from .transformer_tts_updater import * diff --git a/parakeet/models/transformer_tts/transformer_tts_updater.py b/parakeet/models/transformer_tts/transformer_tts_updater.py index a9ae48ad..7e75a860 100644 --- a/parakeet/models/transformer_tts/transformer_tts_updater.py +++ b/parakeet/models/transformer_tts/transformer_tts_updater.py @@ -16,8 +16,8 @@ import paddle from paddle import distributed as dist -from parakeet.models.transformer_tts.transformer_tts import GuidedMultiHeadAttentionLoss -from parakeet.models.transformer_tts.transformer_tts import TransformerTTSLoss +from parakeet.models.transformer_tts import GuidedMultiHeadAttentionLoss +from parakeet.models.transformer_tts import TransformerTTSLoss from parakeet.training.extensions.evaluator import StandardEvaluator from parakeet.training.reporter import report from parakeet.training.updaters.standard_updater import StandardUpdater