diff --git a/Dockerfile b/Dockerfile index a00a22f..7bacfa1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -170,10 +170,13 @@ RUN dpkg -i cuda-keyring_1.0-1_all.deb RUN apt-get update \ && apt-get install -y \ curl \ - python3-pip \ python3 \ + python3-pip \ wget +# ESpeak for new text pipeline +RUN apt-get install libespeak-ng1 + RUN python3 --version #RUN python3.7 -m venv python #RUN . python/bin/activate \ diff --git a/tts/requirements-tacotron-python36.txt b/tts/requirements-tacotron-python36.txt index 6d88fcd..ec53a6d 100644 --- a/tts/requirements-tacotron-python36.txt +++ b/tts/requirements-tacotron-python36.txt @@ -60,3 +60,8 @@ pycparser==2.20 # For unit tests and static type checking pyright==0.0.13.post0 pytest==7.0.1 + +# Text pipeline +num2words==0.5.10 +phonemizer==3.2.1 + diff --git a/tts/vocodes_common.py b/tts/vocodes_common.py index a7b4cc6..0762e11 100644 --- a/tts/vocodes_common.py +++ b/tts/vocodes_common.py @@ -31,6 +31,7 @@ import magic import os from text.pipeline.english_pipeline_v1 import EnglishPipelineV1 +from text.pipeline.espeak_pipeline import EspeakPipeline from text.pipeline.legacy_fakeyou_pipeline import LegacyFakeYouPipeline from text.pipeline_components.phonetization.cmudict import DEFAULT_CMUDICT_PATH, CMUDict from text.pipeline_components.phonetization.english_phonetization import EnglishPhonetization @@ -90,6 +91,11 @@ def load_hifigan_model(checkpoint_path, super_resolution = False): denoiser = HifiDenoiser(hifigan, mode="normal") return hifigan, h, denoiser +# Modern pipelines +SPANISH_ESPEAK_PIPELINE = EspeakPipeline(lang='es') +ENGLISH_ESPEAK_PIPELINE = EspeakPipeline(lang='en') + +# Legacy pipelines ENGLISH_PIPELINE_V1 = EnglishPipelineV1(EnglishPhonetization(CMUDict(DEFAULT_CMUDICT_PATH))) LEGACY_FAKEYOU_PIPELINE = LegacyFakeYouPipeline() @@ -100,6 +106,8 @@ def preprocess_text(raw_user_text: str, text_pipeline_type: str): integer_sequence = LEGACY_FAKEYOU_PIPELINE.user_input_to_sequence(raw_user_text) elif text_pipeline_type == 'english_v1': integer_sequence = ENGLISH_PIPELINE_V1.user_input_to_sequence(raw_user_text) + elif text_pipeline_type == 'spanish_v2': + integer_sequence = SPANISH_ESPEAK_PIPELINE.user_input_to_sequence(raw_user_text) else: # TODO: Fall back to the newest pipeline once server code has been deployed. integer_sequence = LEGACY_FAKEYOU_PIPELINE.user_input_to_sequence(raw_user_text)