TTS icon indicating copy to clipboard operation
TTS copied to clipboard

got error when using fairseq

Open uyplayer opened this issue 1 year ago β€’ 1 comments

Describe the bug



from TTS.api import TTS


tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True)
tts.tts_to_file("This is a test.", file_path="output.wav")

To Reproduce

got following error

D:\Software\anaconda3\envs\freqtrade310\python.exe C:\Users\uyplayer\Downloads\uig-script_arabic\model.py 
D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py:70: UserWarning: `gpu` will be deprecated. Please use `tts.to(device)` instead.
  warnings.warn("`gpu` will be deprecated. Please use `tts.to(device)` instead.")
Traceback (most recent call last):
  File "C:\Users\uyplayer\Downloads\uig-script_arabic\model.py", line 5, in <module>
    tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py", line 74, in __init__
    self.load_tts_model_by_name(model_name, gpu)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py", line 171, in load_tts_model_by_name
    model_path, config_path, vocoder_path, vocoder_config_path, model_dir = self.download_model_by_name(
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py", line 129, in download_model_by_name
    model_path, config_path, model_item = self.manager.download_model(model_name)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\utils\manage.py", line 385, in download_model
    model_item, model_full_name, model, md5sum = self._set_model_item(model_name)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\utils\manage.py", line 304, in _set_model_item
    model_full_name = f"{model_type}--{lang}--{dataset}--{model}"
UnboundLocalError: local variable 'dataset' referenced before assignment

Process finished with exit code 1

Expected behavior

No response

Logs

No response

Environment

Sys: Windows11
Python : 3.10
TTS : 0.22.0
Torch : 2.1.2

Additional context

i saw other issues and said this was fixed , but i still got this error

uyplayer avatar Jan 07 '24 08:01 uyplayer

Describe the bug



from TTS.api import TTS


tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True)
tts.tts_to_file("This is a test.", file_path="output.wav")

To Reproduce

got following error

D:\Software\anaconda3\envs\freqtrade310\python.exe C:\Users\uyplayer\Downloads\uig-script_arabic\model.py 
D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py:70: UserWarning: `gpu` will be deprecated. Please use `tts.to(device)` instead.
  warnings.warn("`gpu` will be deprecated. Please use `tts.to(device)` instead.")
Traceback (most recent call last):
  File "C:\Users\uyplayer\Downloads\uig-script_arabic\model.py", line 5, in <module>
    tts = TTS(model_name="tts_models/eng/fairseq/vits", progress_bar=False, gpu=True)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py", line 74, in __init__
    self.load_tts_model_by_name(model_name, gpu)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py", line 171, in load_tts_model_by_name
    model_path, config_path, vocoder_path, vocoder_config_path, model_dir = self.download_model_by_name(
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\api.py", line 129, in download_model_by_name
    model_path, config_path, model_item = self.manager.download_model(model_name)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\utils\manage.py", line 385, in download_model
    model_item, model_full_name, model, md5sum = self._set_model_item(model_name)
  File "D:\Software\anaconda3\envs\freqtrade310\lib\site-packages\TTS\utils\manage.py", line 304, in _set_model_item
    model_full_name = f"{model_type}--{lang}--{dataset}--{model}"
UnboundLocalError: local variable 'dataset' referenced before assignment

Process finished with exit code 1

Expected behavior

No response

Logs

No response

Environment

Sys: Windows11
Python : 3.10
TTS : 0.22.0
Torch : 2.1.2

Additional context

i saw other issues and said this was fixed , but i still got this error

Hi @uyplayer. I encountered a similar issue recently, and I guess you are referring to the fix as mentioned here. If you have used the command pip install TTS, prior to using this model, this change has not been reflected yet for some reason. Instead, you can modify the manage.py file at the location where you installed the TTS package. Simply add the line model_type, lang, dataset, model = model_name.split("/") as mentioned in the following snippet. For instance, in my local environment, I performed the updates at env/lib/site-packages/TTS/utils/manage.py, and it solved the problem for me.

Dhruv16S avatar Jan 24 '24 13:01 Dhruv16S

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 Feb 24 '24 10:02 stale[bot]

Please make those change to this file TTS/utils/manage.py

ligne 263

    #model_type = "tts_models"
    #lang = model_name.split("/")[1]
    model_type, lang, dataset, model = model_name.split("/")

regards

rainloha avatar Mar 30 '24 12:03 rainloha

This is fixed in our fork: https://github.com/idiap/coqui-ai-TTS

eginhard avatar Apr 08 '24 15:04 eginhard