axinc-ai / ailia-models-tflite

Quantized version of model library
21 stars 1 forks source link

ADD whisper #53

Open kyakuno opened 1 year ago

kyakuno commented 1 year ago

https://github.com/usefulsensors/openai-whisper

kyakuno commented 3 months ago

tflite version https://github.com/nyadla-sys/whisper.tflite?tab=readme-ov-file

kyakuno commented 3 months ago

medium model https://github.com/nyadla-sys/whisper.tflite/issues/11

kyakuno commented 3 months ago

入力は80x3000のmelspectrogram、出力は1x448のtoken_id。

スクリーンショット 2024-04-24 10 30 01

スクリーンショット 2024-04-24 10 30 19

kyakuno commented 3 months ago

MatmulはFCになっている。Geluが追加されている。

kyakuno commented 3 months ago

このモデルはweightはint8だが、tensorはfloatのweight quantizationになっている。

kyakuno commented 3 months ago

generateでラップしない場合のtfliteファイル。こちらは素直なencoder/decoder統合モデル。

スクリーンショット 2024-04-24 12 21 19

kyakuno commented 3 months ago

kv_cacheはoutputsにつながっているが、inputsにはつながっていないので、Stateを保存しておく仕組みがありそう。

kyakuno commented 3 months ago

量子化の話 https://github.com/tensorflow/tensorflow/issues/58451

kyakuno commented 3 months ago

whisperはint8では精度不足という話。

It might not be possible to get expected results from int8 models ( because of model architecture itself). So, Work around might be to use hybrid models as you suggested.
kyakuno commented 3 months ago

下記もmixed precisionとdynamic quantizationで実装されている。 https://github.com/microsoft/Olive/tree/main/examples/whisper