Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

[Bug]: ValueError: array is not C-contiguous When using feature_retrieval 使用特征检索时报错 #329

Closed
LancherM opened this issue Jul 22, 2023 · 1 comment · Fixed by #330
Labels
bug? The issue author think this is a bug

Comments

@LancherM
Copy link
Contributor

系统平台版本号

Ubuntu

GPU 型号

NVIDIA RTX A5000

Python版本

3.8.10

PyTorch版本

2.0.1

sovits分支

4.0(默认)

数据集来源(用于判断数据集质量)

galgame解包语音

出现问题的环节或执行的命令

推理

情况描述

实际上是4.1-stable分支。推理时启用了特征检索,然后出现了ValueError: array is not C-contiguous报错。
我的numpy版本是1.24.4

日志

!python inference_main.py -n "test_input.wav" -m "/root/autodl-tmp/so-vits-svc/logs/44k/" -s "rena" -t "0" -cr "0.5" -c "logs/44k/config.json" -sd "-40" -wf "wav" --f0_predictor="crepe" --feature_retrieval
 
/root/autodl-tmp/so-vits-svc
/root/autodl-tmp/so-vits-svc
load 
load model(s) from pretrain/checkpoint_best_legacy_500.pt
| Load HifiGAN:  pretrain/nsf_hifigan/model
Removing weight norm...
#=====segment start, 7.42s======
starting feature retrieval...
Traceback (most recent call last):
  File "inference_main.py", line 155, in <module>
    main()
  File "inference_main.py", line 140, in main
    audio = svc_model.slice_inference(**kwarg)
  File "/root/autodl-tmp/so-vits-svc/inference/infer_tool.py", line 461, in slice_inference
    out_audio, out_sr, out_frame = self.infer(spk, tran, raw_path,
  File "/root/autodl-tmp/so-vits-svc/inference/infer_tool.py", line 279, in infer
    c, f0, uv = self.get_unit_f0(wav, tran, cluster_infer_ratio, speaker, f0_filter,f0_predictor,cr_threshold=cr_threshold)
  File "/root/autodl-tmp/so-vits-svc/inference/infer_tool.py", line 237, in get_unit_f0
    score, ix = feature_index.search(feat_np, k=8)
  File "/root/miniconda3/lib/python3.8/site-packages/faiss/__init__.py", line 322, in replacement_search
    self.search_c(n, swig_ptr(x), k, swig_ptr(D), swig_ptr(I))
  File "/root/miniconda3/lib/python3.8/site-packages/faiss/swigfaiss.py", line 10348, in swig_ptr
    return _swigfaiss.swig_ptr(a)
ValueError: array is not C-contiguous

补充说明

No response

@LancherM LancherM added the bug? The issue author think this is a bug label Jul 22, 2023
@LancherM
Copy link
Contributor Author

LancherM commented Jul 22, 2023

手动修改so-vits-svc/inference/infer_tool.py, line 237后问题解决

# 改前
speaker_id = self.spk2id.get(speaker)
                if not speaker_id and type(speaker) is int:
                    if len(self.spk2id.__dict__) >= speaker:
                        speaker_id = speaker
                if speaker_id is None:
                    raise RuntimeError("The name you entered is not in the speaker list!")
                feature_index = self.cluster_model[speaker_id]
                feat_np = c.transpose(0,1).cpu().numpy()




# 改后
speaker_id = self.spk2id.get(speaker)
                if not speaker_id and type(speaker) is int:
                    if len(self.spk2id.__dict__) >= speaker:
                        speaker_id = speaker
                if speaker_id is None:
                    raise RuntimeError("The name you entered is not in the speaker list!")
                feature_index = self.cluster_model[speaker_id]
                feat_np = np.ascontiguousarray(transpose(0,1).cpu().numpy())

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug? The issue author think this is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant