coqui-ai / TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
http://coqui.ai
Mozilla Public License 2.0
35.08k stars 4.27k forks source link

[Bug] yourTTS Python API French not working any more (KeyError: 'fr') #2456

Closed SiaH319 closed 1 year ago

SiaH319 commented 1 year ago

Describe the bug

Python API for yourTTS is no longer working for French (working well for English). I used the exactly same example as the given one on readme.md. This was working on Feb 18, 2023.

It gives me a "KeyError: 'fr'" Here is the colab link: https://colab.research.google.com/drive/1YuiWxDCbLsw5dvEd9YQpHwDBMo7Ngtvx#scrollTo=Xqy_I3zNbbEG

To Reproduce

from TTS.api import TTS tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts") tts.tts_to_file("C'est le clonage de la voix.", speaker_wav="clone.wav", language="fr", file_path="output_fr.wav")

Here is the colab link: https://colab.research.google.com/drive/1YuiWxDCbLsw5dvEd9YQpHwDBMo7Ngtvx#scrollTo=Xqy_I3zNbbEG

Expected behavior

"output_fr.wav" created

Logs

> Text splitted to sentences.
["C'est le clonage de la voix."]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-7-bb0038b4fd2c> in <module>
----> 1 tts.tts_to_file("C'est le clonage de la voix.", speaker_wav="clone.wav", language="fr", file_path="output_fr.wav")

2 frames
/usr/local/lib/python3.9/dist-packages/TTS/api.py in tts_to_file(self, text, speaker, language, speaker_wav, file_path)
    218                 Output file path. Defaults to "output.wav".
    219         """
--> 220         wav = self.tts(text=text, speaker=speaker, language=language, speaker_wav=speaker_wav)
    221         self.synthesizer.save_wav(wav=wav, path=file_path)

/usr/local/lib/python3.9/dist-packages/TTS/api.py in tts(self, text, speaker, language, speaker_wav)
    181         self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav)
    182 
--> 183         wav = self.synthesizer.tts(
    184             text=text,
    185             speaker_name=speaker,

/usr/local/lib/python3.9/dist-packages/TTS/utils/synthesizer.py in tts(self, text, speaker_name, language_name, speaker_wav, style_wav, style_text, reference_wav, reference_speaker_name)
    251 
    252             elif language_name and isinstance(language_name, str):
--> 253                 language_id = self.tts_model.language_manager.name_to_id[language_name]
    254 
    255             elif not language_name:

KeyError: 'fr'

Environment

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": "11.7"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.0.0+cu117",
        "TTS": "0.12.0",
        "numpy": "1.21.6"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            ""
        ],
        "processor": "x86_64",
        "python": "3.8.0",
        "version": "#36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2"
    }
}

Additional context

No response

elhombrejd commented 1 year ago

The bug is still going. I also had the same issue with "PT".

elhombrejd commented 1 year ago

Did you manage to fix it, @SiaH319 ?

elhombrejd commented 1 year ago

I created a BUG at https://github.com/coqui-ai/TTS/issues/2458

erogol commented 1 year ago

the language code id 'fr-fr'