Open EricPaul03 opened 8 months ago
https://github.com/PlayVoice/Grad-SVC/blob/20230920-V2-96/hubert/hubert_model.py
def consume_prefix(state_dict, prefix: str) -> None:
keys = sorted(state_dict.keys())
for key in keys:
if key.startswith(prefix):
newkey = key[len(prefix):]
state_dict[newkey] = state_dict.pop(key)
def hubert_soft(
path: str,
) -> HubertSoft:
r"""HuBERT-Soft from `"A Comparison of Discrete and Soft Speech Units for Improved Voice Conversion"`.
Args:
path (str): path of a pretrained model
"""
hubert = HubertSoft()
checkpoint = torch.load(path)
consume_prefix(checkpoint, "module.")
hubert.load_state_dict(checkpoint)
hubert.eval()
return hubert
Thanks for helping me!!! but unfortunately, when I run the next command "python prepare/preprocess_speaker.py", I randomly get "Aborted (core dump)" and then I failed. Could you give me some suggestions?
do you have any dump logs?
Sorry, I don't have any output logs. Based on my observation, this error occurs at irregular times (and sometimes there may be segment fault errors). I think this may also be a problem with my device?
"frame #7:
terminate called after throwing an instance of 'c10::Error
what(): isTuple()INTERWAASSERT FAILED at "/pvtorch/aten/rc/ATen/core/ivalue inlh":136, olease report a bug to PVTorch,Exnecte
Tuple but got String
Exception raised from toluple at /pvtorch/aten/src/ATen/core/ivalue inl,:1306 most recent call finst):frame #0: C18:Enror::Error(c1::Sourcelocation, std::string) + 0x42 (0x7f099aed4a22 in /opt/miniconda3/envs/vc2/lib/python3.8/site-packages/torch/lib/libc10.so)
frame #1: c18::detail.:torchCheckFail(char const, char const, unsigned int, stdstring const&) + 0x5 (x7f09aed13db in /opt/minicorda3/envs/vc2/lib/pvthon3.8/site-packages/torch/lib/libc10.so)frame #2: c10::detail.:torchlntemnalAssertFail(char const%, char const, unsigned int, char const, std:string const&) + 0x3e (0x7f09:ed18ce in /opt/miniconda3/envs/vc2/lib/pvthon3,8/site-packages/torch/lib/libc10.so)Frame #3:
Traceback (most recent call last): File "prepare/preprocess_hubert.py", line 9, in
from hubert import hubert_model
File "/root/code/so-vits-svc-5.0/hubert/hubert_model.py", line 8, in
from torch.nn.modules.utils import consume_prefix_in_state_dict_if_present
ImportError: cannot import name 'consume_prefix_in_state_dict_if_present' from 'torch.nn.modules.utils' (/opt/miniconda3/envs/vc2/lib/python3.8/site-packages/torch/nn/modules/utils.py)
I use torch1.8.0+cu111, but I cannot find this function in the file. What should I do?