ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

whisper onnx2ncnn

Open makaveli10 opened this issue 2 years ago • 2 comments

error log | 日志或报错信息 | ログ

model | 模型 | モデル

  1. openai/whisper encoder onnx model https://huggingface.co/optimum/whisper-tiny.en/tree/main

how to reproduce | 复现步骤 | 再現方法

onnx2ncnn encoder_model_sim.onnx encoder.param encoder.bin

I see that these are not supported

Shape not supported yet!
Unsupported unsqueeze axes !
Unknown data type 0

makaveli10 avatar Jun 12 '23 10:06 makaveli10

I suggest that you use https://github.com/k2-fsa/sherpa-onnx/blob/master/scripts/whisper/export-onnx.py to export the whisper model to onnx.

Or you can directly use pnnx with the above script.

csukuangfj avatar Sep 14 '23 08:09 csukuangfj

针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn

pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]

详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx

nihui avatar Aug 05 '24 09:08 nihui

@nihui 老师好,我用pnnx 转了whisper 最后有一层normalize,再用pnnx里面自带的ncnn py,总是这一层年报错[https://github.com/Tencent/ncnn/issues/6220 我只是猜

mathpopo avatar Jul 31 '25 11:07 mathpopo

https://github.com/Tencent/ncnn/pull/6359

nihui avatar Oct 15 '25 11:10 nihui

The whisper asr example appears. Please follow the model conversion steps starting with cpp, or you can directly use the model from https://github.com/nihui/ncnn-android-whisper/releases/tag/models

https://github.com/Tencent/ncnn/commit/021af96e707f6f16bfb05f028915e42076a91b7d

nihui avatar Oct 16 '25 07:10 nihui