mozilla / TTS

:robot: :speech_balloon: Deep learning for Text to Speech (Discussion forum: https://discourse.mozilla.org/c/tts)
Mozilla Public License 2.0
9.22k stars 1.24k forks source link

error in --list_speaker_idxs #760

Open ghost opened 1 year ago

ghost commented 1 year ago

Hello. I've installed tts via pip

tts --list_speaker_idxs generates the following error:

 > Available speaker ids: (Set --speaker_idx flag to one of these values to use the multi-speaker model.
Traceback (most recent call last):
  File "/home/user/.local/bin/tts", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.10/site-packages/TTS/bin/synthesize.py", line 333, in main
    print(synthesizer.tts_model.speaker_manager.name_to_id)
AttributeError: 'NoneType' object has no attribute 'name_to_id'
shivammehta25 commented 1 year ago

If you are using a single-speaker model, a single-speaker model doesn't support speaker indexes, if you switch to any multispeaker model the command should work just fine! example: tts --model_name tts_models/multilingual/multi-dataset/your_tts --list_speaker_idxs Also when you install it via pip you get the https://github.com/coqui-ai/TTS maintained by the Coqui team and has more recent updates.

Muhammad-Ali-Saqib commented 1 year ago

I was doing

script  = 'hello this is the test audio.'
wav, alignment, _, _ = synthesis(model, script, C, "cuda" in str(next(model.parameters()).device), speaker_id=None, d_vector=target_emb, language_id=0).values()

and the error was

AttributeError: 'NoneType' object has no attribute 'name_to_id'

I have resolved that by setting language_id=None the final command will be

wav, alignment, _, _ = synthesis(model, script, C, "cuda" in str(next(model.parameters()).device), speaker_id=None, d_vector=target_emb, language_id=None).values()