rmvpe_onnx.weights

Model weight management utilities for RMVPE.

This module provides helper functions to locate and download the RMVPE ONNX model used for inference.

  • default_model_path() returns the default location inside the package.

  • ensure_model() ensures the model exists locally, downloading it if needed.

Notes

  • The model is downloaded from Hugging Face: https://huggingface.co/lj1995/VoiceConversionWebUI

  • Downloads occur only if the target file does not already exist.

  • The downloaded file is verified against a known SHA-256 checksum; a warning is emitted if the checksum does not match.

References

Functions

default_model_path

Return the default path to rmvpe.onnx.

ensure_model

Ensure the RMVPE ONNX model exists locally.

rmvpe_onnx.weights.default_model_path()

Return the default path to rmvpe.onnx.

Returns:

Absolute path to the model file inside the package data directory.

Return type:

Path

Notes

This function does not check whether the file exists. Use ensure_model() to guarantee availability.

rmvpe_onnx.weights.ensure_model(model_path=None)

Ensure the RMVPE ONNX model exists locally.

If the model file does not exist at the specified location, it will be downloaded from Hugging Face and saved to that path. After download the file is verified against a known SHA-256 checksum; a warning is emitted if the digest does not match. If the file already exists, only the checksum check is performed (no re-download).

Parameters:

model_path (str or Path or None, optional) –

Target path for the model file.

  • None: use the default path from default_model_path()

  • If the file does not exist, it will be downloaded

  • Custom filenames are supported

Returns:

Absolute path to the model file.

Return type:

str

Notes

  • Parent directories are created automatically

  • If the file already exists its SHA-256 is checked; a warning is logged on mismatch but the path is still returned so inference can proceed

  • No re-download is attempted if the file exists but fails the checksum

Examples

Use the default location:

>>> from rmvpe_onnx import ensure_model
>>> path = ensure_model()  

Use a custom path:

>>> path = ensure_model("/tmp/rmvpe.onnx")  

Use a custom filename:

>>> path = ensure_model("/opt/models/pitch_detector.onnx")