coqui-ai / TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
http://coqui.ai
Mozilla Public License 2.0
35.09k stars 4.28k forks source link

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

Closed BrukArkady closed 9 months ago

BrukArkady commented 11 months ago

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

flurin-g commented 11 months ago

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 commented 10 months ago

@flurin-g maybe a PR?

stale[bot] commented 9 months ago

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.

eginhard commented 6 months ago

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

manuel-84 commented 1 month ago

waiting this fix to be implemented....

eginhard commented 1 month ago

@manuel-84 Please use our fork (available via pip install coqui-tts) where this is fixed. This repo is not updated anymore.