snakers4 / silero-vad

Silero VAD: pre-trained enterprise-grade Voice Activity Detector
MIT License
4.1k stars 402 forks source link

Help / Load model from silero_vad.onnx failed:Protobuf parsing failed. #453

Closed NathanJHLee closed 3 months ago

NathanJHLee commented 4 months ago

❓ Questions and Help

We have a wiki available for our users. Please make sure you have checked it out first.

Hi, My name is Nathan and I am follwing your instruction to build testfile for "Stream example in C++" I got some error.

My env is Centos7 and I installed gcc 12.2.0 myself. I faced few error cause mismatch between window and linux. So finally I compiled test binary and run. But error occurred as below.

test wav file is my own thing.

numchannel :1 samplerate :16000 bits_persample:16 num_samples :403840 num_data_size :807680 terminate called after throwing an instance of 'Ort::Exception' what(): Load model from silero_vad.onnx failed:Protobuf parsing failed.

I downloaded onnx model from here 'https://github.com/ricky0123/vad/blob/master/silero_vad.onnx'

please help me to fix it. Thank you.

p.s

I tested model loading about 'silero_vad.onnx ' souce as below. I got same error "Failed to load the model: Load model from silero_vad.onnx failed:Protobuf parsing failed."

include

include "onnxruntime_cxx_api.h"

include "cpu_provider_factory.h"

int main() { // Initialize the ONNX Runtime environment Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "test");

// Initialize session options
Ort::SessionOptions session_options;
session_options.SetIntraOpNumThreads(1);

// Set the optimization level to basic
session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_BASIC);

// Load the ONNX model
const char* model_path = "silero_vad.onnx";
try {
    Ort::Session session(env, model_path, session_options);
    std::cout << "Model loaded successfully." << std::endl;

    // Further processing with the model...

} catch (const Ort::Exception& e) {
    std::cerr << "Failed to load the model: " << e.what() << std::endl;
}

return 0;

}

gongouveia commented 4 months ago

@NathanJHLee I get same error in Java implementation example. ONNX models is not laodable :/

snakers4 commented 3 months ago

The new VAD version was released just now - https://github.com/snakers4/silero-vad/issues/2#issuecomment-2195433115. If the issue persists with the new version, can you please open a new issue referring to this one. Many thanks!

NathanJHLee commented 2 months ago

Hi snakers4. I tried your new VAD version to run. But it seem same error as bleow.

terminate called after throwing an instance of 'Ort::Exception' what(): Load model from silero_vad.onnx failed:Protobuf parsing failed. Aborted (core dumped)

My env is

docker gcc:12.2.0-bullseye

and I modified some line //std::wstring path = L"silero_vad.onnx"; std::string path = "silero_vad.onnx";

std::wstring -> std::string

$du -hs silero_vad.onnx 260K silero_vad.onnx

please check my problem. Thank you.