Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] AttributeError: 'TTS' object has no attribute 'is_multi_lingual' #3602

Closed
Niggling opened this issue Feb 23, 2024 · 8 comments · Fixed by eginhard/coqui-tts#4
Closed
Labels
bug Something isn't working wontfix This will not be worked on but feel free to help.

Comments

@Niggling
Copy link

Niggling commented Feb 23, 2024

Describe the bug

因为huggingface.co连接有问题所以下载的本地模型,最后出现了奇怪的错误
The local model downloaded because there is a problem with the connection in huggingface.co, and finally there is a strange error.

To Reproduce

import torch
from TTS.api import TTS

Get device

device = "cuda" if torch.cuda.is_available() else "cpu"

Init TTS with local model path

model_path = "C:/Code/Coqui/TTS/model/tts_models--zh-CN--baker--tacotron2-DDC-GST" # Update this path
tts = TTS(model_path=model_path + "/model_file.pth", config_path=model_path + "/config.json").to(device)

Run TTS

❗ Since this model is multi-lingual voice cloning model, we must set the target speaker_wav and language

Text to speech list of amplitude values as output

wav = tts.tts(text="你好世界!", speaker_wav="my/cloning/audio.wav", language="zh-cn")

Text to speech to a file

tts.tts_to_file(text="你好世界!", speaker_wav="my/cloning/audio.wav", language="zh-cn", file_path="output.wav")

model/tts_models--zh-CN--baker--tacotron2-DDC-GST中只有config.json model_file.pth scale_stats.npy

Expected behavior

No response

Logs

C:\Users\ning\AppData\Local\Programs\Python\Python39\python.exe C:/Code/Coqui/TTS/run.py
C:\Code\Coqui\TTS\TTS\utils\audio\processor.py:6: UserWarning: A NumPy version >=1.22.4 and <1.29.0 is required for this version of SciPy (detected version 1.22.0)
  import scipy.io.wavfile
 > Using model: tacotron2
 > Setting up Audio Processor...
 | > sample_rate:22050
 | > resample:False
 | > num_mels:80
 | > log_func:np.log10
 | > min_level_db:-100
 | > frame_shift_ms:None
 | > frame_length_ms:None
 | > ref_level_db:0
 | > fft_size:1024
 | > power:1.5
 | > preemphasis:0.0
 | > griffin_lim_iters:60
 | > signal_norm:True
 | > symmetric_norm:True
 | > mel_fmin:50.0
 | > mel_fmax:7600.0
 | > pitch_fmin:0.0
 | > pitch_fmax:640.0
 | > spec_gain:1.0
 | > stft_pad_mode:reflect
 | > max_norm:4.0
 | > clip_norm:True
 | > do_trim_silence:True
 | > trim_db:60
 | > do_sound_norm:False
 | > do_amp_to_db_linear:True
 | > do_amp_to_db_mel:True
 | > do_rms_norm:False
 | > db_level:None
 | > stats_path:C:\Users\ning\AppData\Local\tts\tts_models--zh-CN--baker--tacotron2-DDC-GST\scale_stats.npy
 | > base:10
 | > hop_length:256
 | > win_length:1024
Traceback (most recent call last):
  File "C:\Code\Coqui\TTS\run.py", line 14, in <module>
    wav = tts.tts(text="你好世界!", speaker_wav="my/cloning/audio.wav", language="zh-cn")
  File "C:\Code\Coqui\TTS\TTS\api.py", line 273, in tts
    self._check_arguments(
  File "C:\Code\Coqui\TTS\TTS\api.py", line 228, in _check_arguments
    if self.is_multi_lingual and language is None:
  File "C:\Users\ning\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\modules\module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'TTS' object has no attribute 'is_multi_lingual'
 > Model's reduction rate `r` is set to: 2

进程已结束,退出代码为 1

Environment

Win10

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": null
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.2.0+cpu",
        "TTS": "0.22.0",
        "numpy": "1.22.0"
    },
    "System": {
        "OS": "Windows",
        "architecture": [
            "64bit",
            "WindowsPE"
        ],
        "processor": "Intel64 Family 6 Model 165 Stepping 2, GenuineIntel",
        "python": "3.9.0",
        "version": "10.0.19041"
    }
}

Additional context

No response

@Niggling Niggling added the bug Something isn't working label Feb 23, 2024
@Niggling
Copy link
Author

coqui cut
新发现了这个

@weisiwu
Copy link

weisiwu commented Feb 26, 2024

同样的问题,参考这个人的解决方法
#3449
这是他的修改commit
9108720
修改 api.py 102 行的判断可解决。

@weisiwu
Copy link

weisiwu commented Feb 26, 2024

你也在弄转语音吗,我们可以加一波

@Niggling
Copy link
Author

你也在弄转语音吗,我们可以加一波

ok,但我只是用下这个来做毕设

@weisiwu
Copy link

weisiwu commented Feb 28, 2024

你也在弄转语音吗,我们可以加一波

ok,但我只是用下这个来做毕设

qq
2436887475

@eginhard
Copy link
Contributor

eginhard commented Apr 8, 2024

It's fixed in our fork: https://github.com/idiap/coqui-ai-TTS

@DeepanshCUHK
Copy link

DeepanshCUHK commented Apr 23, 2024

Go to /.venv/lib/python3.9/site-packages/TTS/api.py

inside init function, change self.config = load_config(config_path) if config_path else None to self.config = None

Copy link

stale bot commented Jun 5, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You might also look our discussion channels.

@stale stale bot added the wontfix This will not be worked on but feel free to help. label Jun 5, 2024
@stale stale bot closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on but feel free to help.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants