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

[Bug] Fairseq models error: UnboundLocalError: cannot access local variable 'dataset' where it is not associated with a value #3361

Closed
BrukArkady opened this issue Dec 4, 2023 · 4 comments · Fixed by eginhard/coqui-tts#11
Labels
bug Something isn't working wontfix This will not be worked on but feel free to help.

Comments

@BrukArkady
Copy link

Describe the bug

from TTS.api import TTS
api = TTS("tts_models/rus/fairseq/vits")

To Reproduce

  1. Run code from the task description.
  2. See UnboundLocalError.

Expected behavior

No exceptions.

Logs

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/arkady/.local/lib/python3.11/site-packages/TTS/api.py", line 81, in __init__
    self.load_tts_model_by_name(model_name, gpu)
  File "/home/arkady/.local/lib/python3.11/site-packages/TTS/api.py", line 195, in load_tts_model_by_name
    model_path, config_path, vocoder_path, vocoder_config_path, model_dir = self.download_model_by_name(
                                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arkady/.local/lib/python3.11/site-packages/TTS/api.py", line 149, in download_model_by_name
    model_path, config_path, model_item = self.manager.download_model(model_name)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arkady/.local/lib/python3.11/site-packages/TTS/utils/manage.py", line 407, in download_model
    model_item, model_full_name, model, md5sum = self._set_model_item(model_name)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arkady/.local/lib/python3.11/site-packages/TTS/utils/manage.py", line 326, in _set_model_item
    model_full_name = f"{model_type}--{lang}--{dataset}--{model}"
                                               ^^^^^^^
UnboundLocalError: cannot access local variable 'dataset' where it is not associated with a value

Environment

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": "12.1"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.1.1+cu121",
        "TTS": "0.21.3",
        "numpy": "1.26.2"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            "ELF"
        ],
        "processor": "x86_64",
        "python": "3.11.5",
        "version": "#99~20.04.1-Ubuntu SMP Thu Nov 2 15:16:47 UTC 2023"
    }
}

Additional context

No response

@BrukArkady BrukArkady added the bug Something isn't working label Dec 4, 2023
@flurin-g
Copy link

flurin-g commented Dec 6, 2023

The error seems to stem from changes made in _set_model_item in manage.py introduced in version 0.21.3. namely line 128 was moved down, so when fairseq is used, the variable dataset is undefined.

@erogol
Copy link
Member

erogol commented Dec 7, 2023

@flurin-g maybe a PR?

Copy link

stale bot commented Jan 6, 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 Jan 6, 2024
@stale stale bot closed this as completed Jan 14, 2024
@eginhard
Copy link
Contributor

eginhard commented Apr 8, 2024

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

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

Successfully merging a pull request may close this issue.

4 participants