TTS icon indicating copy to clipboard operation
TTS copied to clipboard

'TTS' object has no attribute 'is_multi_speaker'

Open xxm1668 opened this issue 1 year ago β€’ 7 comments

Describe the bug

Traceback (most recent call last): File "/home/house365ai/xxm/TTS/demo.py", line 16, in wav = tts.tts(text="Hello world!", speaker_wav="/home/house365ai/xxm/TTS/output/audio.wav", language="en") File "/home/house365ai/xxm/TTS/TTS/api.py", line 334, in tts self._check_arguments( File "/home/house365ai/xxm/TTS/TTS/api.py", line 235, in _check_arguments if self.is_multi_speaker and (speaker is None and speaker_wav is None): File "/home/house365ai/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1695, in getattr raise AttributeError(f"'{type(self).name}' object has no attribute '{name}'") AttributeError: 'TTS' object has no attribute 'is_multi_speaker'

To Reproduce

'TTS' object has no attribute 'is_multi_speaker'

Expected behavior

No response

Logs

'TTS' object has no attribute 'is_multi_speaker'

Environment

'TTS' object has no attribute 'is_multi_speaker'

Additional context

'TTS' object has no attribute 'is_multi_speaker'

xxm1668 avatar Nov 15 '23 01:11 xxm1668

after finetune xtts2 also

insomnia777 avatar Nov 15 '23 03:11 insomnia777

It's missing proper context and steps to reproduce. Copy pasting 'TTS' object has no attribute 'is_multi_speaker' doesn't help.

WeberJulian avatar Nov 15 '23 08:11 WeberJulian

Traceback (most recent call last):
  File "/root/tutorials/demos/xtts_infer_demo.py", line 10, in <module>
    tts.tts_to_file(text="It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent.",
  File "/root/miniconda3/envs/tts/lib/python3.9/site-packages/TTS/api.py", line 391, in tts_to_file
    self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav, **kwargs)
  File "/root/miniconda3/envs/tts/lib/python3.9/site-packages/TTS/api.py", line 235, in _check_arguments
    if self.is_multi_speaker and (speaker is None and speaker_wav is None):
  File "/root/miniconda3/envs/tts/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1695, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'TTS' object has no attribute 'is_multi_speaker'

TTS==0.21.1 torch==2.1.1 torchaudio==2.1.1 numpy==1.22.0

jasonkylelol avatar Nov 28 '23 02:11 jasonkylelol

You still didn't share the inference code.

WeberJulian avatar Nov 29 '23 19:11 WeberJulian

@WeberJulian Can reproduce on M1 MacBook Pro (MacOS Sonoma 14.1.1 23B81) with Python 3.11.5, using a slight modification of the example code in the readme:

import torch
from TTS.TTS.api import TTS

OUTPUT_PATH = "tacotron2.wav"
device = "mps" #if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"

# Init TTS with the target model name
tts = TTS(model_name="TTS/TTS/tts/models/tacotron2.py", progress_bar=True).to(device)

# Run TTS
tts.tts_to_file(text="Hello!", file_path=OUTPUT_PATH)

The code outputs the following:

/Users/jtohahn/Documents/tts-test/.venv/bin/python /Users/jtohahn/Documents/tts-test/multispeaker.py
Traceback (most recent call last):
  File "/Users/jtohahn/Documents/tts-test/multispeaker.py", line 11, in <module>
    tts.tts_to_file(text="Hello!", file_path=OUTPUT_PATH)
  File "/Users/jtohahn/Documents/tts-test/TTS/TTS/api.py", line 391, in tts_to_file
    self._check_arguments(speaker=speaker, language=language, speaker_wav=speaker_wav, **kwargs)
  File "/Users/jtohahn/Documents/tts-test/TTS/TTS/api.py", line 235, in _check_arguments
    if self.is_multi_speaker and (speaker is None and speaker_wav is None):
       ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jtohahn/Documents/tts-test/.venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1695, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'TTS' object has no attribute 'is_multi_speaker'

The code also fails when using device = "cpu" instead of device = "mps".

TTS==0.21.1 torch==2.1.1 numpy==1.26.2 torchaudio==2.1.1

jacobtohahn avatar Nov 29 '23 22:11 jacobtohahn

@bigcash's solution on #3187 works for me.

I had model_name set as TTS/TTS/tts/models/tacotron2.py, while it should be tts_models/en/ljspeech/tacotron2-DDC.

You can find a list of model names by running tts --list_models in a shell.

jacobtohahn avatar Nov 29 '23 22:11 jacobtohahn

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[bot] avatar Jan 02 '24 09:01 stale[bot]