onnxruntime / Whisper-HybridLoop-Onnx-Demo

MIT License
13 stars 2 forks source link

'[ErrorCode:InvalidArgument] Input name: 'audio_stream' is not in the metadata' #1

Closed sergiosolorzano closed 1 year ago

sergiosolorzano commented 1 year ago

Hi, I've created whisper-tiny following microsoft's repo https://github.com/microsoft/Olive/tree/main/examples/whisper which work in linux following the repo explanations.

Model created: python prepare_whisper_configs.py --model_name openai/whisper-tiny.en --no_audio_decoder python -m olive.workflows.run --config whisper_cpu_int8.json --setup python -m olive.workflows.run --config whisper_cpu_int8.json

The model works in linux: python test_transcription.py --config whisper_cpu_int8.json

I then export model.onnx (from examples/whisper/models/whisper_cpu_int8.zip.zip generated in the olive repo above), place it in the Whisper-HybridLoop-Onnx-Demo, run it for ExecutionProvider Cpu, and I get this error:

'[ErrorCode:InvalidArgument] Input name: 'audio_stream' is not in the metadata'

It throws when it reaches var result = session.Run(input, outputs, run_options); in Inference.cs

image

OnnxRuntime.Extensions is reference in csproj (also tested v 0.8.0) `

    <PackageReference Include="Microsoft.ML.OnnxRuntime.Extensions" Version="0.8.1-alpha" />
    <PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.15.0-rc" />
    <PackageReference Include="NReco.VideoConverter" Version="1.2.0" />
</ItemGroup>`
image
sergiosolorzano commented 1 year ago

in case it helps anyone, whisper-tiny model expects audio_pcm input not audio_stream as shown in netron. so I changed Inference.cs input: var input = new List { //NamedOnnxValue.CreateFromTensor("audio_stream", config.audio), NamedOnnxValue.CreateFromTensor("audio_pcm", config.audio), and WhisperConfig.cs //public DenseTensor audio; public DenseTensor audio;