Skip to content

[Bug] Error while loading model from path and save tts to file. #4286

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

Open
kishcs opened this issue May 21, 2025 · 1 comment
Open

[Bug] Error while loading model from path and save tts to file. #4286

kishcs opened this issue May 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@kishcs
Copy link

kishcs commented May 21, 2025

Describe the bug

Error:

Traceback (most recent call last):
  File "/data/tts.py", line 42, in <module>
    tts.tts_to_file(text=text, file_path="sample.wav")
  File "/usr/local/lib/python3.10/dist-packages/TTS/api.py", line 332, in tts_to_file
    self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/TTS/api.py", line 228, in _check_arguments
    if self.is_multi_lingual and language is None:
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1940, in __getattr__
    raise AttributeError(
AttributeError: 'TTS' object has no attribute 'is_multi_lingual'

When I am trying to load model from model path and converting tts to file.

tts = TTS(
    model_path="/data/models/tts_models--en--ljspeech--tacotron2-DDC/model_file.pth",
    config_path="/data/models/tts_models--en--ljspeech--tacotron2-DDC/config.json",
    vocoder_path="/data/models/vocoder_models--en--ljspeech--hifigan_v2/model_file.pth",
    vocoder_config_path="/data/models/vocoder_models--en--ljspeech--hifigan_v2/config.json",
    # vocoder_name="vocoder_models/en/ljspeech/hifigan_v2",
    progress_bar=True,
    gpu=True  # Set to True if running on GPU
)

tts.tts_to_file(text="A long sample text to generate wav from text", file_path="sample.wav")

To Reproduce

from TTS.api import TTS
tts = TTS(
    model_path="/data/models/tts_models--en--ljspeech--tacotron2-DDC/model_file.pth",
    config_path="/data/models/tts_models--en--ljspeech--tacotron2-DDC/config.json",
    vocoder_path="/data/models/vocoder_models--en--ljspeech--hifigan_v2/model_file.pth",
    vocoder_config_path="/data/models/vocoder_models--en--ljspeech--hifigan_v2/config.json",
    # vocoder_name="vocoder_models/en/ljspeech/hifigan_v2",
    progress_bar=True,
    gpu=True  # Set to True if running on GPU
)

tts.tts_to_file(text="A long sample text to generate wav from text", file_path="sample.wav")

Expected behavior

It should run similar to when loading model from model_name.

Logs

Traceback (most recent call last):
  File "/data/tts.py", line 42, in <module>
    tts.tts_to_file(text=text, file_path="sample.wav")
  File "/usr/local/lib/python3.10/dist-packages/TTS/api.py", line 332, in tts_to_file
    self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/TTS/api.py", line 228, in _check_arguments
    if self.is_multi_lingual and language is None:
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1940, in __getattr__
    raise AttributeError(
AttributeError: 'TTS' object has no attribute 'is_multi_lingual'

Environment

TTS Version: 0.22.0
Torch Version: 2.7.0
Python: 3.10.12
OS: Ubuntu
CUDA: 12.8
GPU: H100
Pytorch installed via pip

Additional context

No response

@kishcs kishcs added the bug Something isn't working label May 21, 2025
@eginhard
Copy link
Contributor

It works fine in our fork (available via pip install coqui-tts). This repo is not maintained anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants