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.29k stars 4.31k forks source link

[Bug] argument of type 'NoneType' is not iterable #2979

Closed violet17 closed 1 year ago

violet17 commented 1 year ago

Describe the bug

Run the below code and get error like:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/i/miniconda3/envs/llm/lib/python3.9/site-packages/TTS/api.py", line 384, in tts_to_file
    self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav, **kwargs)
  File "/home/i/miniconda3/envs/llm/lib/python3.9/site-packages/TTS/api.py", line 237, in _check_arguments
    if self.is_multi_lingual and language is None:
  File "/home/i/miniconda3/envs/llm/lib/python3.9/site-packages/TTS/api.py", line 109, in is_multi_lingual
    if "xtts" in self.model_name:
TypeError: argument of type 'NoneType' is not iterable

no error on TTS 0.16.3 version。 And in 0.16.3 version, when len(text) for one setence is large than 50, the rest of text can not convert to speech, which will be cut off. In the script below, I get no voice for "品尝美食,享受美味与旋转的乐趣".

TTS version :

$ python -m pip list | grep TTS
TTS                         0.17.4

To Reproduce

scripts:

from TTS.api import TTS
text = "游客可以登上观光球,欣赏上海全景和周边美景;或者在空中庭院中欣赏美景,感受大自然的气息;或者在旋转餐厅中品尝美食,享受美味与旋转的乐趣"
tts_model = TTS(model_path="./tacotron2-DDC-GST/model_file.pth", config_path="./tacotron2-DDC-GST/config.json", progress_bar=True, gpu=False)
tts_model.tts_to_file(text.replace("\n",",").replace(" ","")+"。", file_path="audio_out.wav")

Expected behavior

No response

Logs

No response

Environment

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": null
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.0.1a0+cxx11.abi",
        "TTS": "0.17.4",
        "numpy": "1.24.0"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            "ELF"
        ],
        "processor": "x86_64",
        "python": "3.9.17",
        "version": "#32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2"
    }
}

Additional context

No response

abbail commented 1 year ago

It worked for me if I added tts_model.model_name="xtts" before calling tts_to_file, just as a workaround. It seems like for me the constructor for TTS wasn't working like I expected.

erogol commented 1 year ago

can you try #2983 ?

braysonjohn148 commented 1 year ago

It worked for me if I added tts_model.model_name="xtts" before calling tts_to_file, just as a workaround. It seems like for me the constructor for TTS wasn't working like I expected.

Work for me.

erogol commented 1 year ago

duplicate #3019

Edresson commented 1 year ago

It is fixed on the latest :frog: TTS version. So, I will close this issue. Feel free to reopen it.