From 4e19792ea2bcd2761fd378aeb6fa0099a4c2983d Mon Sep 17 00:00:00 2001 From: TianYuan Date: Wed, 25 Aug 2021 12:55:24 +0000 Subject: [PATCH 1/2] fix import bug in transformer tts --- examples/transformer_tts/preprocess.py | 8 ++++---- examples/transformer_tts/train.py | 2 +- parakeet/frontend/phonectic.py | 2 +- parakeet/models/transformer_tts.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/transformer_tts/preprocess.py b/examples/transformer_tts/preprocess.py index 670227e..af6360d 100644 --- a/examples/transformer_tts/preprocess.py +++ b/examples/transformer_tts/preprocess.py @@ -19,10 +19,10 @@ from pathlib import Path import tqdm import numpy as np - -from parakeet.datasets import LJSpeechMetaData -from parakeet.audio import AudioProcessor, LogMagnitude -from parakeet.frontend import English +from parakeet.audio.audio import AudioProcessor +from parakeet.audio.spec_normalizer import LogMagnitude +from parakeet.datasets.ljspeech import LJSpeechMetaData +from parakeet.frontend.phonectic import English from config import get_cfg_defaults diff --git a/examples/transformer_tts/train.py b/examples/transformer_tts/train.py index e2da676..50a1eb1 100644 --- a/examples/transformer_tts/train.py +++ b/examples/transformer_tts/train.py @@ -21,7 +21,7 @@ from paddle import distributed as dist from paddle.io import DataLoader, DistributedBatchSampler from parakeet.data import dataset -from parakeet.frontend import English +from parakeet.frontend.phonectic import English from parakeet.models.transformer_tts import TransformerTTS, TransformerTTSLoss from parakeet.utils import scheduler, mp_tools, display from parakeet.training.cli import default_argument_parser diff --git a/parakeet/frontend/phonectic.py b/parakeet/frontend/phonectic.py index 81674bf..2366225 100644 --- a/parakeet/frontend/phonectic.py +++ b/parakeet/frontend/phonectic.py @@ -17,7 +17,7 @@ from abc import abstractmethod from g2p_en import G2p from g2pM import G2pM -from parakeet.frontend import Vocab +from parakeet.frontend.vocab import Vocab from parakeet.frontend.normalizer.normalizer import normalize from parakeet.frontend.punctuation import get_punctuations diff --git a/parakeet/models/transformer_tts.py b/parakeet/models/transformer_tts.py index 4ec943a..77ddec8 100644 --- a/parakeet/models/transformer_tts.py +++ b/parakeet/models/transformer_tts.py @@ -370,7 +370,7 @@ class CNNPostNet(nn.Layer): class TransformerTTS(nn.Layer): def __init__(self, - frontend: parakeet.frontend.Phonetics, + frontend: parakeet.frontend.phonectic.Phonetics, d_encoder: int, d_decoder: int, d_mel: int, From 360567ca2085ff8cd905f46d221ac66b04db2a8c Mon Sep 17 00:00:00 2001 From: TianYuan Date: Thu, 26 Aug 2021 03:14:24 +0000 Subject: [PATCH 2/2] fix init import bug --- .flake8 | 4 ++++ examples/transformer_tts/preprocess.py | 8 ++++---- examples/transformer_tts/train.py | 2 +- parakeet/__init__.py | 8 ++++++++ parakeet/audio/__init__.py | 4 ++++ parakeet/data/__init__.py | 3 +++ parakeet/datasets/__init__.py | 3 +++ parakeet/frontend/__init__.py | 8 ++++++++ parakeet/frontend/cn_normalization/__init__.py | 2 ++ parakeet/frontend/normalizer/__init__.py | 3 +++ parakeet/models/__init__.py | 5 +++++ parakeet/models/transformer_tts.py | 2 +- parakeet/modules/__init__.py | 8 ++++++++ parakeet/training/__init__.py | 3 +++ parakeet/utils/__init__.py | 6 ++++++ 15 files changed, 63 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index 3723df5..d119eab 100644 --- a/.flake8 +++ b/.flake8 @@ -42,6 +42,10 @@ ignore = # these ignores are from flake8-comprehensions; please fix! C400,C401,C402,C403,C404,C405,C407,C411,C413,C414,C415 + +per-file-ignores = + */__init__.py: F401 + # Specify the list of error codes you wish Flake8 to report. select = E, diff --git a/examples/transformer_tts/preprocess.py b/examples/transformer_tts/preprocess.py index af6360d..9f381b3 100644 --- a/examples/transformer_tts/preprocess.py +++ b/examples/transformer_tts/preprocess.py @@ -19,10 +19,10 @@ from pathlib import Path import tqdm import numpy as np -from parakeet.audio.audio import AudioProcessor -from parakeet.audio.spec_normalizer import LogMagnitude -from parakeet.datasets.ljspeech import LJSpeechMetaData -from parakeet.frontend.phonectic import English +from parakeet.audio import AudioProcessor +from parakeet.audio import LogMagnitude +from parakeet.datasets import LJSpeechMetaData +from parakeet.frontend import English from config import get_cfg_defaults diff --git a/examples/transformer_tts/train.py b/examples/transformer_tts/train.py index 50a1eb1..e2da676 100644 --- a/examples/transformer_tts/train.py +++ b/examples/transformer_tts/train.py @@ -21,7 +21,7 @@ from paddle import distributed as dist from paddle.io import DataLoader, DistributedBatchSampler from parakeet.data import dataset -from parakeet.frontend.phonectic import English +from parakeet.frontend import English from parakeet.models.transformer_tts import TransformerTTS, TransformerTTSLoss from parakeet.utils import scheduler, mp_tools, display from parakeet.training.cli import default_argument_parser diff --git a/parakeet/__init__.py b/parakeet/__init__.py index 67be25b..8b99260 100644 --- a/parakeet/__init__.py +++ b/parakeet/__init__.py @@ -13,3 +13,11 @@ # limitations under the License. __version__ = "0.0.0" +import logging +from . import data +from . import datasets +from . import frontend +from . import models +from . import modules +from . import training +from . import utils diff --git a/parakeet/audio/__init__.py b/parakeet/audio/__init__.py index abf198b..23e378f 100644 --- a/parakeet/audio/__init__.py +++ b/parakeet/audio/__init__.py @@ -11,3 +11,7 @@ # 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 .audio import AudioProcessor +from .spec_normalizer import LogMagnitude +from .spec_normalizer import NormalizerBase diff --git a/parakeet/data/__init__.py b/parakeet/data/__init__.py index 2fed920..6f15dbb 100644 --- a/parakeet/data/__init__.py +++ b/parakeet/data/__init__.py @@ -13,3 +13,6 @@ # limitations under the License. """Parakeet's infrastructure for data processing. """ + +from .dataset import * +from .batch import * diff --git a/parakeet/datasets/__init__.py b/parakeet/datasets/__init__.py index abf198b..cbdcdfa 100644 --- a/parakeet/datasets/__init__.py +++ b/parakeet/datasets/__init__.py @@ -11,3 +11,6 @@ # 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 .common import * +from .ljspeech import * diff --git a/parakeet/frontend/__init__.py b/parakeet/frontend/__init__.py index abf198b..51d36f9 100644 --- a/parakeet/frontend/__init__.py +++ b/parakeet/frontend/__init__.py @@ -11,3 +11,11 @@ # 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 .cn_normalization import * +from .generate_lexicon import * +from .normalizer import * +from .phonectic import * +from .punctuation import * +from .tone_sandhi import * +from .vocab import * diff --git a/parakeet/frontend/cn_normalization/__init__.py b/parakeet/frontend/cn_normalization/__init__.py index abf198b..ea32290 100644 --- a/parakeet/frontend/cn_normalization/__init__.py +++ b/parakeet/frontend/cn_normalization/__init__.py @@ -11,3 +11,5 @@ # 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 parakeet.frontend.cn_normalization.text_normlization import * diff --git a/parakeet/frontend/normalizer/__init__.py b/parakeet/frontend/normalizer/__init__.py index abf198b..37fd580 100644 --- a/parakeet/frontend/normalizer/__init__.py +++ b/parakeet/frontend/normalizer/__init__.py @@ -11,3 +11,6 @@ # 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 parakeet.frontend.normalizer.normalizer import * +from parakeet.frontend.normalizer.numbers import * diff --git a/parakeet/models/__init__.py b/parakeet/models/__init__.py index abf198b..e943def 100644 --- a/parakeet/models/__init__.py +++ b/parakeet/models/__init__.py @@ -11,3 +11,8 @@ # 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 .tacotron2 import * +from .transformer_tts import * +from .waveflow import * diff --git a/parakeet/models/transformer_tts.py b/parakeet/models/transformer_tts.py index 77ddec8..4ec943a 100644 --- a/parakeet/models/transformer_tts.py +++ b/parakeet/models/transformer_tts.py @@ -370,7 +370,7 @@ class CNNPostNet(nn.Layer): class TransformerTTS(nn.Layer): def __init__(self, - frontend: parakeet.frontend.phonectic.Phonetics, + frontend: parakeet.frontend.Phonetics, d_encoder: int, d_decoder: int, d_mel: int, diff --git a/parakeet/modules/__init__.py b/parakeet/modules/__init__.py index abf198b..fd38c0c 100644 --- a/parakeet/modules/__init__.py +++ b/parakeet/modules/__init__.py @@ -11,3 +11,11 @@ # 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 .attention import * +from .conv import * +from .geometry import * +from .losses import * +from .masking import * +from .positional_encoding import * +from .transformer import * diff --git a/parakeet/training/__init__.py b/parakeet/training/__init__.py index abf198b..277171d 100644 --- a/parakeet/training/__init__.py +++ b/parakeet/training/__init__.py @@ -11,3 +11,6 @@ # 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 .cli import * +from .experiment import * diff --git a/parakeet/utils/__init__.py b/parakeet/utils/__init__.py index abf198b..9811f20 100644 --- a/parakeet/utils/__init__.py +++ b/parakeet/utils/__init__.py @@ -11,3 +11,9 @@ # 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 . import checkpoint +from . import display +from . import layer_tools +from . import mp_tools +from . import scheduler