RVC-Project / RVC-Project/Retrieval-based-Voice-Conversion-WebUI

mac m4 中进行推理出现错误AttributeError: 'NoneType' object has no attribute 'tobytes'

Open
#2,546 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38.4k
Forks
5.3k
PR merge metrics
No merged PRs in 30d

Description

2025-04-12 01:07:51 | WARNING | infer.modules.vc.modules | Traceback (most recent call last):
File "/Users/lvxiaodong/Desktop/RVC/Retrieval-based-Voice-Conversion-WebUI/infer/modules/vc/modules.py", line 172, in vc_single
self.hubert_model = load_hubert(self.config)
File "/Users/lvxiaodong/Desktop/RVC/Retrieval-based-Voice-Conversion-WebUI/infer/modules/vc/utils.py", line 23, in load_hubert
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
File "/opt/miniconda3/lib/python3.9/site-packages/fairseq/checkpoint_utils.py", line 425, in load_model_ensemble_and_task
state = load_checkpoint_to_cpu(filename, arg_overrides)
File "/opt/miniconda3/lib/python3.9/site-packages/fairseq/checkpoint_utils.py", line 315, in load_checkpoint_to_cpu
state = torch.load(f, map_location=torch.device("cpu"))
File "/opt/miniconda3/lib/python3.9/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 fairseq.data.dictionary.Dictionary was not an allowed global by default. Please use torch.serialization.add_safe_globals([Dictionary]) or the torch.serialization.safe_globals([Dictionary]) 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.

Traceback (most recent call last):
File "/opt/miniconda3/lib/python3.9/site-packages/gradio/queueing.py", line 407, in call_prediction
output = await route_utils.call_process_api(
File "/opt/miniconda3/lib/python3.9/site-packages/gradio/route_utils.py", line 226, in call_process_api
output = await app.get_blocks().process_api(
File "/opt/miniconda3/lib/python3.9/site-packages/gradio/blocks.py", line 1559, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "/opt/miniconda3/lib/python3.9/site-packages/gradio/blocks.py", line 1447, in postprocess_data
prediction_value = block.postprocess(prediction_value)
File "/opt/miniconda3/lib/python3.9/site-packages/gradio/components/audio.py", line 341, in postprocess
file_path = self.audio_to_temp_file(
File "/opt/miniconda3/lib/python3.9/site-packages/gradio/components/base.py", line 336, in audio_to_temp_file
temp_dir = Path(self.DEFAULT_TEMP_DIR) / self.hash_bytes(data.tobytes())
AttributeError: 'NoneType' object has no attribute 'tobytes'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The traceback points to infer/modules/vc/utils.py:23 during load_hubert and infer/modules/vc/modules.py:172 in vc_single; start by reproducing the Mac M4 inference failure and checking the checkpoint-loading path. Confirm the load error is handled and that a valid audio result reaches Gradio instead of None, then verify the same inference path completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python, pytorch
Domain
audio-video-rtc, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.