diff --git a/examples/aishell/asr1/conf/conformer.yaml b/examples/aishell/asr1/conf/conformer.yaml index 154f44a2..67a96e69 100644 --- a/examples/aishell/asr1/conf/conformer.yaml +++ b/examples/aishell/asr1/conf/conformer.yaml @@ -3,14 +3,7 @@ data: train_manifest: data/manifest.train dev_manifest: data/manifest.dev test_manifest: data/manifest.test - min_input_len: 0.5 - max_input_len: 20.0 # second - min_output_len: 0.0 - max_output_len: 400.0 - min_output_input_ratio: 0.05 - max_output_input_ratio: 10.0 - - + collator: vocab_filepath: data/lang_char/vocab.txt unit_type: 'char' diff --git a/examples/aishell/asr1/conf/preprocess.yaml b/examples/aishell/asr1/conf/preprocess.yaml index dd4cfd27..f7f4c58d 100644 --- a/examples/aishell/asr1/conf/preprocess.yaml +++ b/examples/aishell/asr1/conf/preprocess.yaml @@ -5,7 +5,7 @@ process: n_mels: 80 n_shift: 160 win_length: 400 - dither: true + dither: 0.1 - type: cmvn_json cmvn_path: data/mean_std.json # these three processes are a.k.a. SpecAugument diff --git a/examples/aishell/asr1/conf/transformer.yaml b/examples/aishell/asr1/conf/transformer.yaml index 60ec0180..e1006309 100644 --- a/examples/aishell/asr1/conf/transformer.yaml +++ b/examples/aishell/asr1/conf/transformer.yaml @@ -73,7 +73,7 @@ model: training: - n_epoch: 120 + n_epoch: 240 accum_grad: 2 global_grad_clip: 5.0 optim: adam diff --git a/examples/callcenter/asr1/conf/preprocess.yaml b/examples/callcenter/asr1/conf/preprocess.yaml index dd4cfd27..f7f4c58d 100644 --- a/examples/callcenter/asr1/conf/preprocess.yaml +++ b/examples/callcenter/asr1/conf/preprocess.yaml @@ -5,7 +5,7 @@ process: n_mels: 80 n_shift: 160 win_length: 400 - dither: true + dither: 0.1 - type: cmvn_json cmvn_path: data/mean_std.json # these three processes are a.k.a. SpecAugument diff --git a/examples/librispeech/asr1/conf/preprocess.yaml b/examples/librispeech/asr1/conf/preprocess.yaml index 021ca4c5..d3992cb9 100644 --- a/examples/librispeech/asr1/conf/preprocess.yaml +++ b/examples/librispeech/asr1/conf/preprocess.yaml @@ -5,7 +5,7 @@ process: n_mels: 80 n_shift: 160 win_length: 400 - dither: true + dither: 0.1 - type: cmvn_json cmvn_path: data/mean_std.json # these three processes are a.k.a. SpecAugument diff --git a/examples/other/g2p/get_g2p_data.py b/examples/other/g2p/get_g2p_data.py index 9b43ca62..8fa3e53c 100644 --- a/examples/other/g2p/get_g2p_data.py +++ b/examples/other/g2p/get_g2p_data.py @@ -28,7 +28,8 @@ def get_baker_data(root_dir): alignment_files = [f for f in alignment_files if f.stem not in exclude] data_dict = defaultdict(dict) for alignment_fp in alignment_files: - alignment = textgrid.openTextgrid(alignment_fp, includeEmptyIntervals=True) + alignment = textgrid.openTextgrid( + alignment_fp, includeEmptyIntervals=True) # only with baker's annotation utt_id = alignment.tierNameList[0].split(".")[0] intervals = alignment.tierDict[alignment.tierNameList[0]].entryList diff --git a/examples/timit/asr1/conf/preprocess.yaml b/examples/timit/asr1/conf/preprocess.yaml index dd4cfd27..f7f4c58d 100644 --- a/examples/timit/asr1/conf/preprocess.yaml +++ b/examples/timit/asr1/conf/preprocess.yaml @@ -5,7 +5,7 @@ process: n_mels: 80 n_shift: 160 win_length: 400 - dither: true + dither: 0.1 - type: cmvn_json cmvn_path: data/mean_std.json # these three processes are a.k.a. SpecAugument diff --git a/examples/tiny/asr1/conf/preprocess.yaml b/examples/tiny/asr1/conf/preprocess.yaml index dd4cfd27..f7f4c58d 100644 --- a/examples/tiny/asr1/conf/preprocess.yaml +++ b/examples/tiny/asr1/conf/preprocess.yaml @@ -5,7 +5,7 @@ process: n_mels: 80 n_shift: 160 win_length: 400 - dither: true + dither: 0.1 - type: cmvn_json cmvn_path: data/mean_std.json # these three processes are a.k.a. SpecAugument diff --git a/examples/wenetspeech/asr1/conf/preprocess.yaml b/examples/wenetspeech/asr1/conf/preprocess.yaml index dd4cfd27..f7f4c58d 100644 --- a/examples/wenetspeech/asr1/conf/preprocess.yaml +++ b/examples/wenetspeech/asr1/conf/preprocess.yaml @@ -5,7 +5,7 @@ process: n_mels: 80 n_shift: 160 win_length: 400 - dither: true + dither: 0.1 - type: cmvn_json cmvn_path: data/mean_std.json # these three processes are a.k.a. SpecAugument diff --git a/paddlespeech/s2t/models/u2/u2.py b/paddlespeech/s2t/models/u2/u2.py index 2d6fb218..83eff467 100644 --- a/paddlespeech/s2t/models/u2/u2.py +++ b/paddlespeech/s2t/models/u2/u2.py @@ -584,8 +584,9 @@ class U2BaseModel(ASRInterface, nn.Layer): hyp_content = hyp[0] # Prevent the hyp is empty if len(hyp_content) == 0: - hyp_content = (self.ctc.blank_id,) - hyp_content = paddle.to_tensor(hyp_content, place=device, dtype=paddle.long) + hyp_content = (self.ctc.blank_id, ) + hyp_content = paddle.to_tensor( + hyp_content, place=device, dtype=paddle.long) hyp_list.append(hyp_content) hyps_pad = pad_sequence(hyp_list, True, self.ignore_id) hyps_lens = paddle.to_tensor( diff --git a/paddlespeech/s2t/transform/spectrogram.py b/paddlespeech/s2t/transform/spectrogram.py index f35adef0..a6346c34 100644 --- a/paddlespeech/s2t/transform/spectrogram.py +++ b/paddlespeech/s2t/transform/spectrogram.py @@ -319,7 +319,7 @@ class LogMelSpectrogramKaldi(): fmin=20, fmax=None, eps=1e-10, - dither=False): + dither=1.0): self.fs = fs self.n_mels = n_mels self.n_fft = n_fft @@ -374,7 +374,7 @@ class LogMelSpectrogramKaldi(): Returns: np.ndarray: (T, D) """ - dither = self.dither if train else False + dither = self.dither if train else 0.0 if x.ndim != 1: raise ValueError("Not support x: [Time, Channel]") diff --git a/paddlespeech/t2s/exps/gan_vocoder/hifigan/train.py b/paddlespeech/t2s/exps/gan_vocoder/hifigan/train.py index f0e7708f..3bc11a60 100644 --- a/paddlespeech/t2s/exps/gan_vocoder/hifigan/train.py +++ b/paddlespeech/t2s/exps/gan_vocoder/hifigan/train.py @@ -242,8 +242,7 @@ def train_sp(args, config): def main(): # parse args and config and redirect to train_sp - parser = argparse.ArgumentParser( - description="Train a HiFiGAN model.") + parser = argparse.ArgumentParser(description="Train a HiFiGAN model.") parser.add_argument( "--config", type=str, help="config file to overwrite default config.") parser.add_argument("--train-metadata", type=str, help="training data.") diff --git a/tools/release_note.py b/tools/release_note.py index 07a05769..2016c1a9 100755 --- a/tools/release_note.py +++ b/tools/release_note.py @@ -14,191 +14,180 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== - """ Create release notes with the issues from a milestone. python3 release_notes.py -c didi delta v.xxxxx """ - -import sys -import json import argparse -import urllib.request import collections +import json +import sys +import urllib.request github_url = 'https://api.github.com/repos' if __name__ == '__main__': - # usage: - # 1. close milestone on github - # 2. python3 tools/release_notes.py -c didi delta v0.3.3 - - # Parse arguments - parser = argparse.ArgumentParser( - description='Create a draft release with the issues from a milestone.', - ) - - parser.add_argument( - 'user', - metavar='user', - type=str, - default='paddlepaddle', - help='github user: paddlepaddle' - ) - - parser.add_argument( - 'repository', - metavar='repository', - type=str, - default='paddlespeech', - help='github repository: paddlespeech' - ) - - parser.add_argument( - 'milestone', - metavar='milestone', - type=str, - help='name of used milestone: v0.3.3' - ) - - parser.add_argument( - '-c', '--closed', - help='Fetch closed milestones/issues', - action='store_true' - ) - - parser.print_help() - args = parser.parse_args() - - # Fetch milestone infos - url = "%s/%s/%s/milestones" % ( - github_url, - args.user, - args.repository - ) - - headers = { - 'Origin': 'https://github.com', - 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) ' - 'AppleWebKit/537.11 (KHTML, like Gecko) ' - 'Chrome/23.0.1271.64 Safari/537.11', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', - 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', - 'Accept-Encoding': 'none', - 'Accept-Language': 'en-US,en;q=0.8', - 'Connection': 'keep-alive'} - - if args.closed: - url += "?state=closed" - - req = urllib.request.Request(url, headers=headers) - github_request = urllib.request.urlopen(req) - if not github_request: - parser.error('Cannot read milestone list.') - - decoder = json.JSONDecoder() - milestones = decoder.decode(github_request.read().decode('utf-8')) - github_request.close() - - print('parse milestones', file=sys.stderr) - milestone_id = None - for milestone in milestones: - if milestone['title'] == args.milestone: - milestone_id = milestone['number'] - if not milestone_id: - parser.error('Cannot find milestone') - - - # Get milestone related issue info - url = '%s/%s/%s/issues?milestone=%d' % ( - github_url, - args.user, - args.repository, - milestone_id - ) - if args.closed: - url += "&state=closed" - - req = urllib.request.Request(url, headers=headers) - github_request = urllib.request.urlopen(req) - if not github_request: - parser.error('Cannot read issue list.') - - issues = decoder.decode(github_request.read().decode('utf-8')) - github_request.close() - - #print('parse issues', file=sys.stderr) - #final_data = [] - #labels = [] - #thanks_to = [] - #for issue in issues: - - # for label in issue['labels']: - # labels.append(label['name']) - - # thanks_to.append('@%s' % (issue['user']['login'])) - # final_data.append(' * **[%s]** - %s #%d by **@%s**\n' % ( - # label['name'], - # issue['title'], - # issue['number'], - # issue['user']['login'] - # )) - - #dic = collections.defaultdict(set) - #for l_release in list(set(labels)): - - # for f_data in final_data: - # if '[%s]' % l_release in f_data: - # dic[l_release].add(f_data) - - #with open(f"release_note_issues_{args.milestone}.md", 'w') as f: - # for key, value in dic.items(): - # print('# %s\n%s' % (key, ''.join(value)), file=f) - # print('# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % (' '.join(list(set(thanks_to))))), file=f) - - - # Get milestone related PR info - url = '%s/%s/%s/pulls?milestone=%d' % ( - github_url, - args.user, - args.repository, - milestone_id - ) - if args.closed: - url += "&state=closed" - - req = urllib.request.Request(url, headers=headers) - github_request = urllib.request.urlopen(req) - if not github_request: - parser.error('Cannot read issue list.') - - issues = decoder.decode(github_request.read().decode('utf-8')) - github_request.close() - - print('parse pulls', file=sys.stderr) - final_data = [] - labels = [] - thanks_to = [] - for issue in issues: - - for label in issue['labels']: - labels.append(label['name']) - - thanks_to.append('@%s' % (issue['user']['login'])) - final_data.append(' * **[%s]** - %s #%d by **@%s**\n' % ( - label['name'], - issue['title'], - issue['number'], - issue['user']['login'] - )) - - dic = collections.defaultdict(set) - for l_release in list(set(labels)): - - for f_data in final_data: - if '[%s]' % l_release in f_data: - dic[l_release].add(f_data) - - with open(f"release_note_pulls_{args.milestone}.md", 'w') as f: - for key, value in dic.items(): - print('# %s\n%s' % (key, ''.join(value)), file=f) - print('# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % (' '.join(list(set(thanks_to))))), file=f) + # usage: + # 1. close milestone on github + # 2. python3 tools/release_notes.py -c didi delta v0.3.3 + + # Parse arguments + parser = argparse.ArgumentParser( + description='Create a draft release with the issues from a milestone.', + ) + + parser.add_argument( + 'user', + metavar='user', + type=str, + default='paddlepaddle', + help='github user: paddlepaddle') + + parser.add_argument( + 'repository', + metavar='repository', + type=str, + default='paddlespeech', + help='github repository: paddlespeech') + + parser.add_argument( + 'milestone', + metavar='milestone', + type=str, + help='name of used milestone: v0.3.3') + + parser.add_argument( + '-c', + '--closed', + help='Fetch closed milestones/issues', + action='store_true') + + parser.print_help() + args = parser.parse_args() + + # Fetch milestone infos + url = "%s/%s/%s/milestones" % (github_url, args.user, args.repository) + + headers = { + 'Origin': + 'https://github.com', + 'User-Agent': + 'Mozilla/5.0 (X11; Linux x86_64) ' + 'AppleWebKit/537.11 (KHTML, like Gecko) ' + 'Chrome/23.0.1271.64 Safari/537.11', + 'Accept': + 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Accept-Charset': + 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', + 'Accept-Encoding': + 'none', + 'Accept-Language': + 'en-US,en;q=0.8', + 'Connection': + 'keep-alive' + } + + if args.closed: + url += "?state=closed" + + req = urllib.request.Request(url, headers=headers) + github_request = urllib.request.urlopen(req) + if not github_request: + parser.error('Cannot read milestone list.') + + decoder = json.JSONDecoder() + milestones = decoder.decode(github_request.read().decode('utf-8')) + github_request.close() + + print('parse milestones', file=sys.stderr) + milestone_id = None + for milestone in milestones: + if milestone['title'] == args.milestone: + milestone_id = milestone['number'] + if not milestone_id: + parser.error('Cannot find milestone') + + # Get milestone related issue info + url = '%s/%s/%s/issues?milestone=%d' % (github_url, args.user, + args.repository, milestone_id) + if args.closed: + url += "&state=closed" + + req = urllib.request.Request(url, headers=headers) + github_request = urllib.request.urlopen(req) + if not github_request: + parser.error('Cannot read issue list.') + + issues = decoder.decode(github_request.read().decode('utf-8')) + github_request.close() + + #print('parse issues', file=sys.stderr) + #final_data = [] + #labels = [] + #thanks_to = [] + #for issue in issues: + + # for label in issue['labels']: + # labels.append(label['name']) + + # thanks_to.append('@%s' % (issue['user']['login'])) + # final_data.append(' * **[%s]** - %s #%d by **@%s**\n' % ( + # label['name'], + # issue['title'], + # issue['number'], + # issue['user']['login'] + # )) + + #dic = collections.defaultdict(set) + #for l_release in list(set(labels)): + + # for f_data in final_data: + # if '[%s]' % l_release in f_data: + # dic[l_release].add(f_data) + + #with open(f"release_note_issues_{args.milestone}.md", 'w') as f: + # for key, value in dic.items(): + # print('# %s\n%s' % (key, ''.join(value)), file=f) + # print('# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % (' '.join(list(set(thanks_to))))), file=f) + + # Get milestone related PR info + url = '%s/%s/%s/pulls?milestone=%d' % (github_url, args.user, + args.repository, milestone_id) + if args.closed: + url += "&state=closed" + + req = urllib.request.Request(url, headers=headers) + github_request = urllib.request.urlopen(req) + if not github_request: + parser.error('Cannot read issue list.') + + issues = decoder.decode(github_request.read().decode('utf-8')) + github_request.close() + + print('parse pulls', file=sys.stderr) + final_data = [] + labels = [] + thanks_to = [] + for issue in issues: + + for label in issue['labels']: + labels.append(label['name']) + + thanks_to.append('@%s' % (issue['user']['login'])) + final_data.append(' * **[%s]** - %s #%d by **@%s**\n' % + (label['name'], issue['title'], issue['number'], + issue['user']['login'])) + + dic = collections.defaultdict(set) + for l_release in list(set(labels)): + + for f_data in final_data: + if '[%s]' % l_release in f_data: + dic[l_release].add(f_data) + + with open(f"release_note_pulls_{args.milestone}.md", 'w') as f: + for key, value in dic.items(): + print('# %s\n%s' % (key, ''.join(value)), file=f) + print( + '# %s\n%s' % ('Acknowledgements', 'Special thanks to %s ' % + (' '.join(list(set(thanks_to))))), + file=f)