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] bark throws an error _pickle.UnpicklingError: invalid load key, '<'. #3567

Closed
chigkim opened this issue Feb 7, 2024 · 8 comments
Closed
Labels
bug Something isn't working wontfix This will not be worked on but feel free to help.

Comments

@chigkim
Copy link

chigkim commented Feb 7, 2024

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

@chigkim chigkim added the bug Something isn't working label Feb 7, 2024
@storuky
Copy link

storuky commented Feb 7, 2024

same here

@illtellyoulater
Copy link

illtellyoulater commented Feb 8, 2024

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
Copy link

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

@illtellyoulater
Copy link

illtellyoulater commented Feb 11, 2024

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
Copy link

piclez commented Feb 17, 2024

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.

Copy link

stale bot commented Apr 22, 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 Apr 22, 2024
@seancheung
Copy link

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

@stale stale bot removed the wontfix This will not be worked on but feel free to help. label May 7, 2024
Copy link

stale bot commented Jun 19, 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 Jun 19, 2024
@stale stale bot closed this as completed Jul 18, 2024
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
Development

No branches or pull requests

6 participants