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

fix: fairseq unbound variable 'dataset' #3502

Closed
wants to merge 2 commits into from

Conversation

akgupta1337
Copy link

@akgupta1337 akgupta1337 commented Jan 7, 2024

Fix error on using fairseq model. Variables like dataset and model aren't defined.

So, this is the bug a user faced recently while using the model fairseq, as you can see the user encountered the error: unbound variable 'dataset' in the file manage.py in the method _set_model_item, on inspecting the code, I found that infact, in the condition when fairseq was in 'model_name' there was no declaration of variable dataset as well as the variable model, so I just added them in the first if condition and it solved the issue. I tested it and it worked like charm.

Code:

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")

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

fixes: #3142 #3361 #3501

Since this is my first PR, It would be really nice if it would get merged, or if there's anything else I can help with please let me know.
ThankYou.

@CLAassistant
Copy link

CLAassistant commented Jan 7, 2024

CLA assistant check
All committers have signed the CLA.

@akgupta1337 akgupta1337 changed the title fix fairseq model #3501 fix: fairseq unbound variable 'dataset' Jan 7, 2024
Copy link

stale bot commented Feb 7, 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 Feb 7, 2024
@stale stale bot closed this Feb 15, 2024
@rainloha
Copy link

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

@eginhard
Copy link
Contributor

eginhard commented Apr 8, 2024

I've merged this into our fork, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on but feel free to help.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fairseq voice cloning
4 participants