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
31.81k stars 3.81k forks source link

[Bug] bark throws an error _pickle.UnpicklingError: invalid load key, '<'. #3567

Open chigkim opened 4 months ago

chigkim commented 4 months ago

Describe the bug

When trying to use Bark, it throws an error after downloading it.

To Reproduce

from TTS.api import TTS tts = TTS('tts_models/multilingual/multi-dataset/bark')

Expected behavior

It should just download and initialize.

Logs

> Downloading model to C:\Users\chigo\AppData\Local\tts\tts_models--multilingual--multi-dataset--bark
100%|████████████████████████████████████████████████████████████████████████████| 3.93G/3.93G [01:37<00:00, 40.4MiB/s]
100%|████████████████████████████████████████████████████████████████████████████| 3.74G/3.74G [01:32<00:00, 40.5MiB/s]
 31%|████████████████████████▌                                                      | 9.00/29.0 [00:01<00:02, 7.87iB/s]
100%|████████████████████████████████████████████████████████████████████████████| 6.11k/6.11k [00:01<00:00, 4.24kiB/s]
100%|████████████████████████████████████████████████████████████████████████████| 1.14G/1.14G [00:29<00:00, 39.1MiB/s]
  0%|                                                                                      | 0.00/104M [00:00<?, ?iB/s] > Model's license - MIT█████████████████████████████████████████████████████████▋  | 101M/104M [00:02<00:00, 41.9MiB/s]
 > Check https://choosealicense.com/licenses/mit/ for more info.
 > Using model: bark
D:\code\python\VOLlama\.venv\Lib\site-packages\torch\nn\utils\weight_norm.py:28: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
  warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
found outdated text model, removing...
100%|████████████████████████████████████████████████████████████████████████████| 17.7k/17.7k [00:00<00:00, 4.41MiB/s]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\api.py", line 74, in __init__
    self.load_tts_model_by_name(model_name, gpu)
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\api.py", line 177, in load_tts_model_by_name
    self.synthesizer = Synthesizer(
                       ^^^^^^^^^^^^
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\utils\synthesizer.py", line 109, in __init__
    self._load_tts_from_dir(model_dir, use_cuda)
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\utils\synthesizer.py", line 164, in _load_tts_from_dir
    self.tts_model.load_checkpoint(config, checkpoint_dir=model_dir, eval=True)
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\tts\models\bark.py", line 281, in load_checkpoint
    self.load_bark_models()
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\tts\models\bark.py", line 50, in load_bark_models
    self.semantic_model, self.config = load_model(
                                       ^^^^^^^^^^^
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\TTS\tts\layers\bark\load_model.py", line 121, in load_model
    checkpoint = torch.load(ckpt_path, map_location=device)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\torch\serialization.py", line 1040, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\python\VOLlama\.venv\Lib\site-packages\torch\serialization.py", line 1258, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_pickle.UnpicklingError: invalid load key, '<'.
>>>

Environment

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": null
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.2.0+cpu",
        "TTS": "0.22.0",
        "numpy": "1.26.4"
    },
    "System": {
        "OS": "Windows",
        "architecture": [
            "64bit",
            "WindowsPE"
        ],
        "processor": "Intel64 Family 6 Model 94 Stepping 3, GenuineIntel",
        "python": "3.11.7",
        "version": "10.0.19045"
    }
}

Additional context

No response

storuky commented 4 months ago

same here

illtellyoulater commented 4 months ago

me too...

Ubuntu 22.04 
Python 3.11.7
TTS 0.22.0
torch==2.2.0

@chigkim may I ask you what's the command you used to print that nice env tree above?

aroslanov commented 4 months ago

I fixed it by downloading text_2.pt manually from here. You'll need to delete or overwrite the old, broken one.

illtellyoulater commented 4 months ago

You'll need to delete or overwrite the old, broken one.

I deleted the whole local Coqui repository and cloned Bark from its official repository. It's well maintained and works straight out of the box.

Same goes for with XTTSv2, for which I'm now using this greatly optimized implementation https://github.com/daswer123/xtts-webui which also comes with a great UI and additional features to improve even further the audio quality. This also worked out of the box.

UPDATE: as for XTTSv2, this seems even more advanced: https://github.com/erew123/alltalk_tts

piclez commented 4 months ago

Thanks @aroslanov - I downloaded all .pt files and got it working.

The invalid load key, '<' error means those files are HTML files for 404 not found page at Hugging Face and they all start with <. I cloned the repo and it seems it doesn't download the big .pt files so I had to manually download each one.

stale[bot] commented 2 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.

seancheung commented 2 months ago

Some files are corrupted. Download them manually from https://huggingface.co/suno/bark/tree/main

stale[bot] commented 2 weeks 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.