Skip to content

❓ Silero VAD C++ (without libtorch) Fails to Compile with ONNX Runtime 1.21.0 #620

@MohammadRaziei

Description

@MohammadRaziei

Silero VAD C++ (without libtorch) Fails to Compile with ONNX Runtime 1.21.0

I attempted to compile and run the Silero VAD C++ implementation (without libtorch) using the provided code, but I encountered compilation errors related to the Ort::Session constructor. The errors suggest a mismatch between the expected arguments for the Ort::Session constructor and the arguments being passed in the code. Below are the errors I encountered:

/mnt/windowsD/Projects/libspeech/examples/silero/silero-vad-onnx.cpp:136:49:   required from here
/usr/include/c++/11/ext/new_allocator.h:162:11: error: no matching function for call to ‘Ort::Session::Session(Ort::Env&, const wchar_t*, Ort::SessionOptions&)’
  162 |         { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
/mnt/windowsD/Projects/libspeech/src/third_party/onnxruntime/include/onnxruntime_cxx_inline.h:1128:58: note:   no known conversion for argument 2 from ‘const wchar_t*’ to ‘const char*
 1128 | inline Session::Session(const Env& env, const ORTCHAR_T* model_path, const SessionOptions& options) {
      |                                         ~~~~~~~~~~~~~~~~~^~~~~~~~~~

Key Observations:

  1. The Ort::Session constructor expects a const char* for the model path, but the code is passing a const wchar_t*.
  2. The error occurs when trying to initialize the Ort::Session object in the init_onnx_model function:
    session = std::make_shared<Ort::Session>(env, model_path.c_str(), session_options);

Environment Details:

  • ONNX Runtime Version: 1.21.0 (downloaded and built locally)
  • Compiler: GCC 11
  • Operating System: Linux
  • Code Source: Silero VAD C++ implementation without libtorch.

Questions:

  1. What version of ONNX Runtime was this code tested with?
    • I used ONNX Runtime 1.21.0, but it seems there might be a compatibility issue.
  2. Is there a specific version of ONNX Runtime that this code is designed to work with?
    • If so, could you please specify the exact version?
  3. Should the code be updated to support newer versions of ONNX Runtime?
    • It appears that the API for Ort::Session has changed, and the current implementation may need adjustments to align with the latest ONNX Runtime APIs.

Thank you for your assistance! I look forward to your feedback on resolving these issues.

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions