mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-11-05 00:27:30 +00:00
[GH-ISSUE #415] onnx_inference_demo how do I get the vec-256-layer-9? #212
Labels
No labels
AMD/Intel
bug
bug
bug
colab
dependencies
documentation
duplicate
enhancement
following up
good first issue
help wanted
invalid
question
stale
stale
stale
todo list
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
RVC-Project/Retrieval-based-Voice-Conversion-WebUI#212
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mathigatti on GitHub (Jun 2, 2023).
Original GitHub issue: https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/issues/415
Hi! I'm trying to test the onnx_inference_demo.py script, I created a model.onnx using the export_onnx.py script and set that as model_path. But now it looks like I'm missing that "vec_name" thing, not sure how should I generate that file.
These are lines I'm talking about at onnx_inference_demo.py
@mathigatti commented on GitHub (Jun 2, 2023):
okay it looks like it's contentVec ported to onnx, I just found it here.
@SirHumphreyforreal commented on GitHub (Mar 1, 2024):
sorry to interrupt,I encounter the same thing as you did,I follow your link to download this"vec-256-layer-9" thing ,but it keeps telling me
"Load model from pretrained/vec-256-layer-9.onnx failed:Load model pretrained/vec-256-layer-9.onnx failed. File doesn't exist"
wherever I store it, even I use absolute path.
I really dont know what goes wrong,pls help me
@mathigatti commented on GitHub (Mar 1, 2024):
share your code
@SirHumphreyforreal commented on GitHub (Mar 2, 2024):
Here is the code:
import soundfile
from ..infer.lib.infer_pack.onnx_inference import OnnxRVC
hop_size = 512
sampling_rate = 40000 # 采样率
f0_up_key = 0 # 升降调
sid = 0 # 角色ID
f0_method = "dio" # F0提取算法
model_path = "test.onnx" # 模型的完整路径
vec_name = (
"vec-256-layer-9.onnx" # 内部自动补齐为 f"pretrained/{vec_name}.onnx" 需要onnx的vec模型
)
wav_path = "sunflower.wav" # 输入路径或ByteIO实例
out_path = "out.wav" # 输出路径或ByteIO实例
model = OnnxRVC(
model_path, vec_path=vec_name, sr=sampling_rate, hop_size=hop_size, device="cuda"
)
audio = model.inference(wav_path, sid, f0_method=f0_method, f0_up_key=f0_up_key)
soundfile.write(out_path, audio, sampling_rate)
and output in terminal as follows:
Traceback (most recent call last):
File "D:\QT\test.py", line 17, in
model = OnnxRVC(
File "D:\QT\onnx.py", line 74, in init
self.vec_model = ContentVec(vec_path, device)
File "D:\QT\onnx.py", line 22, in init
self.model = onnxruntime.InferenceSession(vec_path, providers=providers)
File "C:\Python38\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "C:\Python38\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 472, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.NoSuchFile: [ONNXRuntimeError] : 3 : NO_SUCHFILE : Load model from pretrained/vec-256-layer-9.onnx failed:Load model pretrained/vec-256-layer-9.onnx failed. File doesn't exist
@mathigatti commented on GitHub (Mar 2, 2024):
How are you running it and where is the pretrained folder located? I think you should run it from the source folder (python tools/onnx_inference_demo.py) of the project and place the pretrained folder there in the root directory too
@ZzAR0 commented on GitHub (Mar 3, 2024):
Hi, I have a similar problem, I have vec-256-layer-9.onnx under the same file as vec-768-layer-12.onnx.
But there was an error:onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: phone for the following indices
index: 2 Got: 256 Expected: 768 Please fix either the inputs/outputs or the model.
@ZzAR0 commented on GitHub (Mar 3, 2024):
Also ask why the onnx model for inference works so poorly and whether onnx can now use the rmvpe algorithm Thanks.