Merge branch 'master' into 'master'

fix for compatability of python2 and lower versions of numpy

See merge request !42
This commit is contained in:
liuyibing01 2020-03-10 16:21:49 +08:00
commit 384d093d47
26 changed files with 47 additions and 5 deletions

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import sys import sys
import argparse import argparse

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import sys import sys
import argparse import argparse

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import soundfile as sf import soundfile as sf
from tensorboardX import SummaryWriter from tensorboardX import SummaryWriter

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import csv import csv
from pathlib import Path from pathlib import Path
@ -19,6 +20,7 @@ import numpy as np
import pandas as pd import pandas as pd
import librosa import librosa
from scipy import signal, io from scipy import signal, io
import six
from parakeet.data import DatasetMixin, TransformDataset, FilterDataset from parakeet.data import DatasetMixin, TransformDataset, FilterDataset
from parakeet.g2p.en import text_to_sequence, sequence_to_text from parakeet.g2p.en import text_to_sequence, sequence_to_text
@ -32,6 +34,7 @@ class LJSpeechMetaData(DatasetMixin):
self._table = pd.read_csv( self._table = pd.read_csv(
csv_path, csv_path,
sep="|", sep="|",
encoding="utf-8",
header=None, header=None,
quoting=csv.QUOTE_NONE, quoting=csv.QUOTE_NONE,
names=["fname", "raw_text", "normalized_text"]) names=["fname", "raw_text", "normalized_text"])
@ -122,7 +125,6 @@ class Transform(object):
# num_frames # num_frames
n_frames = S_mel_norm.shape[-1] # CAUTION: original number of frames n_frames = S_mel_norm.shape[-1] # CAUTION: original number of frames
return (mix_grapheme_phonemes, text_length, speaker_id, S_norm, return (mix_grapheme_phonemes, text_length, speaker_id, S_norm,
S_mel_norm, n_frames) S_mel_norm, n_frames)
@ -161,17 +163,21 @@ class DataCollector(object):
S_mel_norm, num_frames) = example S_mel_norm, num_frames) = example
text_sequences.append( text_sequences.append(
np.pad(mix_grapheme_phonemes, (0, max_text_length - text_length np.pad(mix_grapheme_phonemes, (0, max_text_length - text_length
))) ),
mode="constant"))
lin_specs.append( lin_specs.append(
np.pad(S_norm, ((0, 0), (self._pad_begin, max_frames - np.pad(S_norm, ((0, 0), (self._pad_begin, max_frames -
self._pad_begin - num_frames)))) self._pad_begin - num_frames)),
mode="constant"))
mel_specs.append( mel_specs.append(
np.pad(S_mel_norm, ((0, 0), (self._pad_begin, max_frames - np.pad(S_mel_norm, ((0, 0), (self._pad_begin, max_frames -
self._pad_begin - num_frames)))) self._pad_begin - num_frames)),
mode="constant"))
done_flags.append( done_flags.append(
np.pad(np.zeros((int(np.ceil(num_frames // self._factor)), )), np.pad(np.zeros((int(np.ceil(num_frames // self._factor)), )),
(0, max_decoder_length - int( (0, max_decoder_length - int(
np.ceil(num_frames // self._factor))), np.ceil(num_frames // self._factor))),
mode="constant",
constant_values=1)) constant_values=1))
text_sequences = np.array(text_sequences).astype(np.int64) text_sequences = np.array(text_sequences).astype(np.int64)
lin_specs = np.transpose(np.array(lin_specs), lin_specs = np.transpose(np.array(lin_specs),

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import argparse import argparse
import ruamel.yaml import ruamel.yaml

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import argparse import argparse
import ruamel.yaml import ruamel.yaml

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import numpy as np import numpy as np
from matplotlib import cm from matplotlib import cm

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import csv import csv
import numpy as np import numpy as np
import librosa import librosa

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import ruamel.yaml import ruamel.yaml
import argparse import argparse

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import ruamel.yaml import ruamel.yaml
import argparse import argparse

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import os import os
import numpy as np import numpy as np
import soundfile as sf import soundfile as sf

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import itertools import itertools
import numpy as np import numpy as np
from scipy import signal from scipy import signal

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import math import math
import time import time
import itertools import itertools

View File

@ -12,6 +12,8 @@
# 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.
from __future__ import division
from paddle import fluid from paddle import fluid
from paddle.fluid.core import ops from paddle.fluid.core import ops

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
from collections import namedtuple from collections import namedtuple
from paddle import fluid from paddle import fluid

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
from paddle import fluid from paddle import fluid

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
from itertools import chain from itertools import chain

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
import paddle.fluid.layers as F import paddle.fluid.layers as F
import paddle.fluid.initializer as I import paddle.fluid.initializer as I

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
from collections import namedtuple from collections import namedtuple

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
from numba import jit from numba import jit

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
import paddle.fluid.layers as F import paddle.fluid.layers as F

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import numpy as np import numpy as np
from paddle import fluid from paddle import fluid
import paddle.fluid.layers as F import paddle.fluid.layers as F

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import itertools import itertools
import numpy as np import numpy as np
from scipy import signal from scipy import signal

View File

@ -12,6 +12,7 @@
# 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.
from __future__ import division
import math import math
import time import time
import itertools import itertools

View File

@ -0,0 +1,13 @@
# 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.

View File

@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import numpy as np import numpy as np
from torch import nn
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg