From 5f1018abee204dac4581d5469f0ad4e5e1a87b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Thu, 11 Feb 2021 13:04:47 +0000 Subject: [PATCH] fix spelling of a def argument and parse phonemes from config.json if use_phonemes is True --- TTS/server/server.py | 2 +- TTS/tts/utils/generic_utils.py | 2 +- TTS/tts/utils/text/symbols.py | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/TTS/server/server.py b/TTS/server/server.py index 425879cf..da9c8079 100644 --- a/TTS/server/server.py +++ b/TTS/server/server.py @@ -18,7 +18,7 @@ def create_argparser(): parser = argparse.ArgumentParser() parser.add_argument('--list_models', type=convert_boolean, nargs='?', const=True, default=False, help='list available pre-trained tts and vocoder models.') parser.add_argument('--model_name', type=str, default="tts_models/en/ljspeech/speedy-speech-wn", help='name of one of the released tts models.') - parser.add_argument('--vocoder_name', type=str, default="vocoder_models/en/ljspeech/mulitband-melgan", help='name of one of the released vocoder models.') + parser.add_argument('--vocoder_name', type=str, default="vocoder_models/en/ljspeech/multiband-melgan", help='name of one of the released vocoder models.') parser.add_argument('--tts_checkpoint', type=str, help='path to custom tts checkpoint file') parser.add_argument('--tts_config', type=str, help='path to custom tts config.json file') parser.add_argument('--tts_speakers', type=str, help='path to JSON file containing speaker ids, if speaker ids are used in the model') diff --git a/TTS/tts/utils/generic_utils.py b/TTS/tts/utils/generic_utils.py index 7a4c3a30..d898aebd 100644 --- a/TTS/tts/utils/generic_utils.py +++ b/TTS/tts/utils/generic_utils.py @@ -163,7 +163,7 @@ def check_config_tts(c): check_argument('eos', c['characters'] if 'characters' in c.keys() else {}, restricted='characters' in c.keys(), val_type=str) check_argument('bos', c['characters'] if 'characters' in c.keys() else {}, restricted='characters' in c.keys(), val_type=str) check_argument('characters', c['characters'] if 'characters' in c.keys() else {}, restricted='characters' in c.keys(), val_type=str) - check_argument('phonemes', c['characters'] if 'characters' in c.keys() else {}, restricted='characters' in c.keys(), val_type=str) + check_argument('phonemes', c['characters'] if 'characters' in c.keys() else {}, restricted='characters' in c.keys() and c['use_phonemes'], val_type=str) check_argument('punctuations', c['characters'] if 'characters' in c.keys() else {}, restricted='characters' in c.keys(), val_type=str) # normalization parameters diff --git a/TTS/tts/utils/text/symbols.py b/TTS/tts/utils/text/symbols.py index 68e74585..7a7e8844 100644 --- a/TTS/tts/utils/text/symbols.py +++ b/TTS/tts/utils/text/symbols.py @@ -5,19 +5,20 @@ Defines the set of symbols used in text input to the model. The default is a set of ASCII characters that works well for English or text that has been run through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details. ''' -def make_symbols(characters, phonemes, punctuations='!\'(),-.:;? ', pad='_', eos='~', bos='^'):# pylint: disable=redefined-outer-name +def make_symbols(characters, phonemes=None, punctuations='!\'(),-.:;? ', pad='_', eos='~', bos='^'):# pylint: disable=redefined-outer-name ''' Function to create symbols and phonemes ''' - _phonemes_sorted = sorted(list(phonemes)) - - # Prepend "@" to ARPAbet symbols to ensure uniqueness (some are the same as uppercase letters): - _arpabet = ['@' + s for s in _phonemes_sorted] - - # Export all symbols: - _symbols = [pad, eos, bos] + list(characters) + _arpabet - _phonemes = [pad, eos, bos] + list(_phonemes_sorted) + list(punctuations) - + _symbols = [pad, eos, bos] + list(characters) + _phonemes = None + if phonemes is not None: + _phonemes_sorted = sorted(list(phonemes)) + # Prepend "@" to ARPAbet symbols to ensure uniqueness (some are the same as uppercase letters): + _arpabet = ['@' + s for s in _phonemes_sorted] + # Export all symbols: + _phonemes = [pad, eos, bos] + list(_phonemes_sorted) + list(punctuations) + _symbols += _arpabet return _symbols, _phonemes + _pad = '_' _eos = '~' _bos = '^'