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] Synthesis from monolingual local models fails #3449

Closed
eginhard opened this issue Dec 20, 2023 · 3 comments · Fixed by eginhard/coqui-tts#4
Closed

[Bug] Synthesis from monolingual local models fails #3449

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

Comments

@eginhard
Copy link
Contributor

Describe the bug

Synthesis from monolingual local models fails because of missing config attribute.

To Reproduce

from TTS.api import TTS

cloud = TTS(model_name="tts_models/de/thorsten/vits")  # just to download the model
cloud.tts("test")  # this works fine

from TTS.utils.generic_utils import get_user_data_dir
model = os.path.join(get_user_data_dir("tts"), "tts_models--de--thorsten--vits", "model_file.pth")
config = os.path.join(get_user_data_dir("tts"), "tts_models--de--thorsten--vits", "config.json")
local = TTS(model_path=model, config_path=config)
_ = local.tts("test")

The last line results in the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../TTS/api.py", line 357, in tts
    self._check_arguments(
  File ".../TTS/api.py", line 253, in _check_arguments
    if self.is_multi_lingual and language is None:
  File ".../torch/nn/modules/module.py", line 1695, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'TTS' object has no attribute 'is_multi_lingual'

Expected behavior

No response

Logs

No response

Environment

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": "12.1"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.1.1+cu121",
        "TTS": "0.21.3",
        "numpy": "1.22.0"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            "ELF"
        ],
        "processor": "x86_64",
        "python": "3.10.11",
        "version": "#38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2"
    }
}

Additional context

The error message is somewhat confusing because is_multi_lingual is defined, but one variable used in that property function is None in certain cases. More details: pytorch/pytorch#13981

Copy link

stale bot commented Jan 28, 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 28, 2024
@stale stale bot closed this as completed Feb 4, 2024
@chibiskuld
Copy link

chibiskuld commented Feb 29, 2024

This still happening. v0.22.0

self.config.languages is calling in a circular fashion
so len(self.config.languages) > 1 on line 102 fails.

the method should be:

    @property
    def is_multi_lingual(self):
        # Not sure what sets this to None, but applied a fix to prevent crashing.
        if hasattr(self.synthesizer.tts_model, "language_manager") and self.synthesizer.tts_model.language_manager:
            return self.synthesizer.tts_model.language_manager.num_languages > 1
        if (
            isinstance(self.model_name, str)
            and "xtts" in self.model_name
            or self.config
            and "xtts" in self.config.model
        ):
            return True
        return False

@eginhard
Copy link
Contributor Author

eginhard commented Apr 8, 2024

It's 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
2 participants