usefulsensors / openai-whisper

Robust Speech Recognition via Large-Scale Weak Supervision
MIT License
62 stars 24 forks source link

Amazing work, was wondering if you can create a demo android app using tflite models as well, that would be super awesome!!! #1

Closed milsun closed 1 year ago

nyadla-sys commented 1 year ago

As we are having some difficulties running the inference with the tflite file. @milsun will provide an update.

DillonHHH commented 1 year ago

Sorry to be impatient, but any updates on this? I really need to run this model on mobile for my app, and I can't find any way to do it...

nyadla-sys commented 1 year ago

@DillonHHH As I am not an expert in writing  Android apps.The tflite model that must be included in an Android APP is available here: https://github.com/usefulsensors/openai-whisper/blob/main/models/whisper.tflite

See the colab below, which uses python to run inference on the whisper.tflite file. https://colab.research.google.com/github/usefulsensors/openai-whisper/blob/main/tflite from huggingface whisper.ipynb#scrollTo=a8VJQuHJKzl4

nyadla-sys commented 1 year ago

Updated input shapes using input signature to create a new hybrid whisper.tflite 40MB model (activations are in float32, weights are in int8). I was then able to execute inference with dummy input on whisper.tflite using minimal example from TFLite C++ API on a Linux PC. Follow the below instructions to build minimal bianry on Linux https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/examples/minimal

run the below command to run inference on whisper.tflite ./minimal ~/Desktop/whisper.tflite

here is the colab link to generate whisper.tflite file https://colab.research.google.com/github/usefulsensors/openai-whisper/blob/main/tflite_from_huggingface_whisper.ipynb

nyadla-sys commented 1 year ago

@DillonHHH @milsun end to end application is running ,pls follow the steps mentioned in README. https://github.com/usefulsensors/openai-whisper

nyadla-sys commented 1 year ago

@DillonHHH @milsun I developed Android APP based on tiny whisper.tflite (quantized ~40MB tflite model) Ran inference in ~2 seconds for 30 seconds audio clip on Pixel-7 mobile phone https://github.com/usefulsensors/openai-whisper/blob/main/android_app/release/app-release.apk Use the below command to push on to android phone adb install -r -t ~/android_app/release/app-release.apk

milsun commented 1 year ago

Awesome, can you also update repo with android app code as well. Thanks!!!

nyadla-sys commented 1 year ago

I released Whisper Android App based on Whisper.tflite ~40MB quantized model to the Android App Store for testing; if anyone is interested, please let me know. Here is my email id to request the access: yadlaniranjan@gmail.com

Link to Android app store and it is available for restricted users. https://play.google.com/apps/internaltest/4701716010574041025

nyadla-sys commented 1 year ago

This is only a proof-of-concept project to create an Android app based on Whisper TFLite, which leverages the stock Android UI to show off its features. Whisper-TFLIte-Android-Example