Spaces:
Runtime error
XTTS V2 no longer works :*(((
Hello. Can someone fix this? Because XTTS Coqui no longer works on Huggingface, and that’s extremely unfortunate, as we loved using it, and in my opinion, it’s one of the best voice clones out there. Other voice clones available on Huggingface still can’t compare to XTTS; to this day, XTTS remains one of the best voice clones.
Because it seems that Huggingface has been updated to the latest version of PyTorch. Starting from PyTorch 2.6, XTTS V2 would only work again if you adjust something in the code. Alternatively, you need to configure it so that the older version of PyTorch is installed before starting XTTS in order for it to launch. And if Huggingface has indeed recently updated to PyTorch 2.6, this error is not surprising, as you need to set something like weights_only=True instead of using torch.load(). When I sent the error message to ChatGPT, it replied to me with this:
The issue isn’t directly with Coqui XTTS V2 itself, but rather with the fact that PyTorch has changed the default checkpoint loading behavior since version 2.6. As a result, many older models that previously ran flawlessly on Hugging Face Spaces are now failing.
Here are the main reasons:
PyTorch 2.6 change (weights_only=True by default)
- Previously,
torch.load()loaded entire objects, including classes and configurations. - As of PyTorch 2.6, only the raw weight tensors are loaded by default to minimize security risks.
- XTTS V2, however, uses a configuration object (
TTS.tts.configs.xtts_config.XttsConfig), which is now blocked.
Hugging Face Spaces switched to a newer PyTorch version
- Many Spaces automatically run with the latest versions.
- This interrupts the loading process of the XTTS checkpoint unless it is updated accordingly.
Detailed cause of the error
torch.load(..., weights_only=True)prevents loading of custom classes.- XTTS V2 saves its model including a Python class (
XttsConfig). - Without a whitelist (
torch.serialization.add_safe_globals), the loading process is blocked.
Hopefully this will be fixed soon, because XTTS is something I can’t do without.
I had the same problem and downgrading tansformers<4.5 solved it :)