k2-fsa / sherpa-onnx

Speech-to-text, text-to-speech, speaker recognition, and VAD using next-gen Kaldi with onnxruntime without Internet connection. Support embedded systems, Android, iOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust
https://k2-fsa.github.io/sherpa/onnx/index.html
Apache License 2.0
3.38k stars 398 forks source link

Segfault on Windows when using whisper c api example #1217

Closed thewh1teagle closed 2 months ago

thewh1teagle commented 2 months ago

Built it with:

git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
cmake -B build . -DCMAKE_BUILD_TYPE=Release -DSHERPA_ONNX_ENABLE_BINARY=ON
cmake --build build -j8

Prepare Whisper

winget install -e --id JernejSimoncic.Wget
winget install -e --id GnuWin32.Tar
wget.exe https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.tar.bz2
tar.exe xvf sherpa-onnx-whisper-tiny.tar.bz2

Run with

.\build\bin\Debug\whisper-c-api.exe

Log

./build/bin/Debug/whisper-c-api.exe 
The given version [17] is not supported, only version 1 to 10 is supported in this build.
D:\sherpa-onnx\sherpa-onnx\c-api\c-api.cc:convertConfig:434 OfflineRecognizerConfig(feat_config=FeatureExtractorConfig(sampling_rate=16000, feature_dim=80, low_freq=20, high_freq=-400, dither=0), model_config=OfflineModelConfig(transducer=OfflineTransducerModelConfig(encoder_filename="", decoder_filename="", joiner_filename=""), paraformer=OfflineParaformerModelConfig(model=""), nemo_ctc=OfflineNemoEncDecCtcModelConfig(model=""), whisper=OfflineWhisperModelConfig(encoder="sherpa-onnx-whisper-tiny/tiny-encoder.onnx", decoder="sherpa-onnx-whisper-tiny/tiny-decoder.onnx", language="en", task="transcribe", tail_paddings=-1), tdnn=OfflineTdnnModelConfig(model=""), zipformer_ctc=OfflineZipformerCtcModelConfig(model=""), wenet_ctc=OfflineWenetCtcModelConfig(model=""), sense_voice=OfflineSenseVoiceModelConfig(model="", language="", use_itn=False), telespeech_ctc="", tokens="sherpa-onnx-whisper-tiny/tiny-tokens.txt", num_threads=1, debug=True, provider="cpu", model_type="", modeling_unit="cjkchar", bpe_vocab=""), lm_config=OfflineLMConfig(model="", scale=1), ctc_fst_decoder_config=OfflineCtcFstDecoderConfig(graph="", max_active=3000), decoding_method="greedy_search", max_active_paths=4, hotwords_file="", hotwords_score=1.5, blank_penalty=0, rule_fsts="", rule_fars="")
Segmentation fault
csukuangfj commented 2 months ago

It is not caused by sherpa-onnx.

Please check your own environment.

There are at least two onnxruntime.dll on your system and the program is not using the one used to build sherpa-onnx. Instead, it is using onnxruntime 1.10 on your system at runtime.

csukuangfj commented 2 months ago

By the way, in order to use CUDA, you have to ensure the correct version of cudatoolkit has be installed.

Please refer to the doc of onnxruntime to check which version of cudatoolkit should be installed for onnxruntime 1.17.1

thewh1teagle commented 2 months ago

Please check your own environment.

You right. the issue was that in the build command --config Release was missing.