TTS
TTS copied to clipboard
[Bug] Fairseq models error: UnboundLocalError: cannot access local variable 'dataset' where it is not associated with a value
Describe the bug
from TTS.api import TTS
api = TTS("tts_models/rus/fairseq/vits")
To Reproduce
- Run code from the task description.
- 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
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.
@flurin-g maybe a PR?
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.
This is fixed in our fork: https://github.com/idiap/coqui-ai-TTS