[Python] onnxruntime pakage missing when using silero-vad

Discussão em 'Python' iniciado por Stack, Abril 28, 2025.

  1. Stack

    Stack Membro Participativo

    when i using silero-vad to reduce noise for my faster-whisper model,it reports error as blow:

    ---------------------------------------------------------------------------
    ImportError Traceback (most recent call last)
    File d:\anaconda3\envs\whisper_env\Lib\site-packages\faster_whisper\vad.py:258, in SileroVADModel.__init__(self, encoder_path, decoder_path)
    257 try:
    --> 258 import onnxruntime
    259 except ImportError as e:

    File d:\anaconda3\envs\whisper_env\Lib\site-packages\onnxruntime\__init__.py:61
    60 if import_capi_exception:
    ---> 61 raise import_capi_exception
    63 from onnxruntime.capi.onnxruntime_inference_collection import (
    64 AdapterFormat, # noqa: F401
    65 InferenceSession, # noqa: F401
    (...)
    69 SparseTensor, # noqa: F401
    70 )

    File d:\anaconda3\envs\whisper_env\Lib\site-packages\onnxruntime\__init__.py:24
    23 try:
    ---> 24 from onnxruntime.capi._pybind_state import (
    25 ExecutionMode, # noqa: F401
    26 ExecutionOrder, # noqa: F401
    27 GraphOptimizationLevel, # noqa: F401
    28 LoraAdapter, # noqa: F401
    29 ModelMetadata, # noqa: F401
    ...
    262 ) from e
    264 opts = onnxruntime.SessionOptions()
    265 opts.inter_op_num_threads = 1

    RuntimeError: Applying the VAD filter requires the onnxruntime package
    Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...


    my codes are as below:

    from faster_whisper import WhisperModel
    model = WhisperModel("../ctranslate2_models/faster-whisper-medium", device="cuda")
    segments, info = model.transcribe(
    "source.wav",
    language="zh",
    vad_filter=True,
    vad_parameters=dict(min_silence_duration_ms=500),
    )
    for segment in segments:
    print(f"[{segment.start:.2f}s -> {segment.end:.2f}s] {segment.text}")


    i checked my conda env and found my pakages:

    (whisper_env) C:\Users\xxx>conda list onnx
    # packages in environment at D:\anaconda3\envs\whisper_env:
    #
    # Name Version Build Channel
    onnx 1.17.0 pypi_0 pypi
    onnxruntime 1.21.0 pypi_0 pypi
    onnxruntime-gpu 1.21.1 pypi_0 pypi


    it seems that i already download onnx pakages,and i also installed Microsoft Visual C++ Redistributable Latest Supported as chatgpt suggests. so why my code still report error?

    Continue reading...

Compartilhe esta Página