From 925c08cf95386c936e7e7f979f6b536b2440ec5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Fri, 21 May 2021 00:30:39 +0200 Subject: [PATCH] replace unidecode with anyascii --- TTS/tts/utils/text/cleaners.py | 16 ++-------------- requirements.txt | 2 +- tests/tts_tests/test_glow_tts_train.py | 2 +- tests/tts_tests/test_speedy_speech_train.py | 2 +- tests/vocoder_tests/test_melgan_train.py | 1 + 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/TTS/tts/utils/text/cleaners.py b/TTS/tts/utils/text/cleaners.py index 2eddcdb8..3d2caa97 100644 --- a/TTS/tts/utils/text/cleaners.py +++ b/TTS/tts/utils/text/cleaners.py @@ -1,18 +1,6 @@ -""" -Cleaners are transformations that run over the input text at both training and eval time. - -Cleaners can be selected by passing a comma-delimited list of cleaner names as the "cleaners" -hyperparameter. Some cleaners are English-specific. You'll typically want to use: - 1. "english_cleaners" for English text - 2. "transliteration_cleaners" for non-English text that can be transliterated to ASCII using - the Unidecode library (https://pypi.python.org/pypi/Unidecode) - 3. "basic_cleaners" if you do not want to transliterate (in this case, you should also update - the symbols in symbols.py to match your data). -""" - import re -from unidecode import unidecode +from anyascii import anyascii from TTS.tts.utils.text.chinese_mandarin.numbers import replace_numbers_to_characters_in_text @@ -47,7 +35,7 @@ def collapse_whitespace(text): def convert_to_ascii(text): - return unidecode(text) + return anyascii(text) def remove_aux_symbols(text): diff --git a/requirements.txt b/requirements.txt index c6ce7672..b376eb1b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ torch>=1.7 tqdm numba==0.52 umap-learn==0.4.6 -unidecode==0.4.20 +anyascii coqpit diff --git a/tests/tts_tests/test_glow_tts_train.py b/tests/tts_tests/test_glow_tts_train.py index 00c7e852..2e675d13 100644 --- a/tests/tts_tests/test_glow_tts_train.py +++ b/tests/tts_tests/test_glow_tts_train.py @@ -17,7 +17,7 @@ config = GlowTTSConfig( text_cleaner="english_cleaners", use_phonemes=True, phoneme_language="zh-CN", - phoneme_cache_path='tests/data/ljspeech/phoneme_cache/', + phoneme_cache_path="tests/data/ljspeech/phoneme_cache/", run_eval=True, test_delay_epochs=-1, epochs=1, diff --git a/tests/tts_tests/test_speedy_speech_train.py b/tests/tts_tests/test_speedy_speech_train.py index cc2845c2..3f508117 100644 --- a/tests/tts_tests/test_speedy_speech_train.py +++ b/tests/tts_tests/test_speedy_speech_train.py @@ -17,7 +17,7 @@ config = SpeedySpeechConfig( text_cleaner="english_cleaners", use_phonemes=True, phoneme_language="zh-CN", - phoneme_cache_path='tests/data/ljspeech/phoneme_cache/', + phoneme_cache_path="tests/data/ljspeech/phoneme_cache/", run_eval=True, test_delay_epochs=-1, epochs=1, diff --git a/tests/vocoder_tests/test_melgan_train.py b/tests/vocoder_tests/test_melgan_train.py index de48ca24..3ff65b5a 100644 --- a/tests/vocoder_tests/test_melgan_train.py +++ b/tests/vocoder_tests/test_melgan_train.py @@ -19,6 +19,7 @@ config = MelganConfig( seq_len=2048, eval_split_size=1, print_step=1, + discriminator_model_params={"base_channels": 16, "max_channels": 256, "downsample_factors": [4, 4, 4]}, print_eval=True, data_path="tests/data/ljspeech", output_path=output_path,