From 0d1aa58fcaa6cd28e0a04581d723068dfa2edaa2 Mon Sep 17 00:00:00 2001 From: Manju <1180369+hanasim@users.noreply.github.com> Date: Wed, 29 May 2024 21:46:42 +0100 Subject: [PATCH 1/2] Extract dataset and model for fairseq models When we use the model "tts_models/eng/fairseq/vits", got the following error. Error in text to speech: cannot access local variable 'dataset' where it is not associated with a value at line ..../.conda/envs/venv/lib/python3.11/site-packages/TTS/utils/manage.py", line 304, in _set_model_item model_full_name = f"{model_type}--{lang}--{dataset}--{model}" --- TTS/utils/manage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TTS/utils/manage.py b/TTS/utils/manage.py index 3a527f4609..35e8ae2a5b 100644 --- a/TTS/utils/manage.py +++ b/TTS/utils/manage.py @@ -262,6 +262,8 @@ def _set_model_item(self, model_name): if "fairseq" in model_name: model_type = "tts_models" lang = model_name.split("/")[1] + dataset = model_name.split("/")[2] + model = model_name.split("/")[3] model_item = { "model_type": "tts_models", "license": "CC BY-NC 4.0", From 635e9140029261730afa7e8d8f3b973ed3cfa27d Mon Sep 17 00:00:00 2001 From: Manju <1180369+hanasim@users.noreply.github.com> Date: Wed, 29 May 2024 21:56:58 +0100 Subject: [PATCH 2/2] Pass speaker_wav argument to tts_to_file in tts_with_vc method When `tts_with_vc_to_file` is invoked with only `speaker_wav` and not `speaker`, it was throwing the error. Error in text to speech: Model is multi-speaker but no `speaker` is provided. ``` File ".../.conda/envs/venv/lib/python3.11/site-packages/TTS/api.py", line 416, in tts_with_vc self.tts_to_file( File ".../.conda/envs/venv/lib/python3.11/site-packages/TTS/api.py", line 333, in tts_to_file self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav, **kwargs) File ".../.conda/envs/venv/lib/python3.11/site-packages/TTS/api.py", line 228, in _check_arguments raise ValueError("Model is multi-speaker but no `speaker` is provided.") ValueError: Model is multi-speaker but no `speaker` is provided. ERROR:app.std.app_logger:Error in text to speech: Model is multi-speaker but no `speaker` is provided. --- TTS/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TTS/api.py b/TTS/api.py index 7abc188e74..461f24c44e 100644 --- a/TTS/api.py +++ b/TTS/api.py @@ -413,7 +413,7 @@ def tts_with_vc( with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp: # Lazy code... save it to a temp file to resample it while reading it for VC self.tts_to_file( - text=text, speaker=speaker, language=language, file_path=fp.name, split_sentences=split_sentences + text=text, speaker=speaker, speaker_wav=speaker_wav, language=language, file_path=fp.name, split_sentences=split_sentences ) if self.voice_converter is None: self.load_vc_model_by_name("voice_conversion_models/multilingual/vctk/freevc24")