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

UnpicklingError during Bark Voice Cloning #456

Open
sitzbrau opened this issue Mar 5, 2025 · 3 comments
Open

UnpicklingError during Bark Voice Cloning #456

sitzbrau opened this issue Mar 5, 2025 · 3 comments

Comments

@sitzbrau
Copy link

sitzbrau commented Mar 5, 2025

Description:
I've encountered an error while using the Bark voice cloning feature. The error occurs when I try to generate the voice after loading a voice sample.

Steps to Reproduce:

  • Start the WebUI.
  • Go to the "Bark Voice Clone" tab.
  • Load a voice sample.
  • Click on "Generate Voice".

Actual Result:
The following error is displayed:

Traceback (most recent call last):
  File "/home/silviodpe/.local/lib/python3.10/site-packages/gradio/queueing.py", line 624, in process_events
    response = await route_utils.call_process_api(
  File "/home/silviodpe/.local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/home/silviodpe/.local/lib/python3.10/site-packages/gradio/blocks.py", line 2015, in process_api
    result = await self.call_function(
  File "/home/silviodpe/.local/lib/python3.10/site-packages/gradio/blocks.py", line 1562, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "/home/silviodpe/.local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/home/silviodpe/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
    return await future
  File "/home/silviodpe/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 962, in run
    result = context.run(func, *args)
  File "/home/silviodpe/.local/lib/python3.10/site-packages/gradio/utils.py", line 865, in wrapper
    response = f(*args, **kwargs)
  File "/home/silviodpe/tts-generation-webui/tts_webui/bark/clone/tab_voice_clone.py", line 253, in generate_voice
    full_generation = get_prompts(wav_file, use_gpu)
  File "/home/silviodpe/tts-generation-webui/tts_webui/bark/clone/tab_voice_clone.py", line 97, in get_prompts
    semantic_prompt = get_semantic_prompt(wav_file, use_gpu)
  File "/home/silviodpe/tts-generation-webui/tts_webui/bark/clone/tab_voice_clone.py", line 91, in get_semantic_vectors
    semantic_vectors = get_semantic_vectors(path_to_wav, device)
  File "/home/silviodpe/tts-generation-webui/tts_webui/bark/clone/tab_voice_clone.py", line 53, in get_semantic_vectors
    hubert_model = _load_hubert_model(device)
  File "/home/silviodpe/tts-generation-webui/tts_webui/bark/clone/tab_voice_clone.py", line 33, in _load_hubert_model
    hubert_model = CustomHubert(
  File "/home/silviodpe/.local/lib/python3.10/site-packages/bark_hubert_quantizer/pre_kmeans_hubert.py", line 60, in __init__
    checkpoint = torch.load(checkpoint_path, map_location=device)
  File "/home/silviodpe/.local/lib/python3.10/site-packages/torch/serialization.py", line 1470, in load
    raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint. 
        (1) In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
        (2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
        WeightsUnpickler error: Unsupported global: GLOBAL argparse.Namespace was not an allowed global by default. Please use `torch.serialization.add_safe_globals([Namespace])` or the `torch.serialization.safe_globals([Namespace])` context manager to allowlist this global if you trust this class/function.


Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.

Expected Result:
The voice cloning process should complete successfully without errors.

Environment:

Operating System: [Ubuntu 22.04]

Python Version: [Python 3.10.12]

Additional Information:
If you need any further details or logs, please let me know.

@rsxdalv
Copy link
Owner

rsxdalv commented Mar 5, 2025 via email

@sitzbrau
Copy link
Author

sitzbrau commented Mar 5, 2025

Not all functionality supports Torch 2.6 yet

what do you recomend to clone a voice?

@rsxdalv
Copy link
Owner

rsxdalv commented Mar 5, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants