lyledean1 / flutter_whisper.cpp

Flutter App That Can Transcribe Audio Offline/On Device with Whisper C++ Bindings via Rust
MIT License
102 stars 10 forks source link

whisper_init_from_file_no_state #14

Closed JarrenPoh closed 10 months ago

JarrenPoh commented 10 months ago

Sorry for bothering again. The APP terminated when I pressed the "Transcribe Text Button". I'm not sure if I've done something wrong that's causing this error.

whisper_init_from_file_no_state: loading model from '/private/var/containers/Bundle/Application/6B41EFA9-DEDD-4D7B-9F56-051F9B30C0A6/Runner.app/ggml-medium.bin' whisper_model_load: loading model whisper_model_load: n_vocab = 51865 whisper_model_load: n_audio_ctx = 1500 whisper_model_load: n_audio_state = 1024 whisper_model_load: n_audio_head = 16 whisper_model_load: n_audio_layer = 24 whisper_model_load: n_text_ctx = 448 whisper_model_load: n_text_state = 1024 whisper_model_load: n_text_head = 16 whisper_model_load: n_text_layer = 24 whisper_model_load: n_mels = 80 whisper_model_load: ftype = 1 whisper_model_load: qntvr = 0 whisper_model_load: type = 4 whisper_model_load: mem required = 1899.00 MB (+ 43.00 MB per decoder) whisper_model_load: adding 1608 extra tokens whisper_model_load: model ctx = 1462.58 MB whisper_model_load: model size = 1462.12 MB whisper_init_state: kv self size = 42.00 MB whisper_init_state: kv cross size = 140.62 MB interruptionHandler is called. -[FontServicesDaemonManager connection]_block_invoke
lyledean1 commented 10 months ago

No problem, happy to help - feel free to give the repo a Github ⭐

Its probably an issue loading the model. Can you give me some more details. I.e what Platform, where have you put the ggml-base (or whatever your model file is called). Is it located in the rs_whisper_gpt folder as -> rs_whisper_gpt/ggml-base.en

JarrenPoh commented 10 months ago

Thank you very much!

  1. I downloaded the folder on https://github.com/ggerganov/whisper.cpp.
  2. ran "$bash ./models/download-ggml-model.sh medium" to download a ggml-medium.bin.
  3. put ggml-medium.bin under the rs_whisper_gpt folder.
  4. add the ggml-medium.bin reference in runner/runner in Xcode.
  5. update the 93 line in api.rs file to " let base_model = get_resources_dir().join("ggml-medium.bin"); ".
  6. ran "flutter_rust_bridge_codegen --rust-input rs_whisper_gpt/src/api.rs --dart-output lib/bridge_generated.dart -c ios/Runner/bridge_generated.h -e macos/Runner/".

I ran APP on iPhone12(17.0.3) ,Xcode(15.0) and Flutter(3.13.7)

lyledean1 commented 10 months ago

Ah I see you've added ggml-medium.bin to XCode so it should be available. Have you tried running the base model to make sure that works (the filename provided with the app)? Might be an issue with the model

JarrenPoh commented 10 months ago

It's ok for me running the large-model now!Thank you very much! Maybe medium model isn't support or I did something wrong.

Another question, I try to set language and it always display in English , but the meaning is correct. Like I'm saying "Goodmornig"in Chinese and Japanese, but it always display "Goodmornig" not "早安".

Ialso want to know if it is possible to add response format parameters like verbose_json ?check the response format here! (https://platform.openai.com/docs/api-reference/audio/createTranscription)

lyledean1 commented 10 months ago

It's ok for me running the large-model now!Thank you very much! Maybe medium model isn't support or I did something wrong.

Another question, I try to set language and it always display in English , but the meaning is correct. Like I'm saying "Goodmornig"in Chinese and Japanese, but it always display "Goodmornig" not "早安".

Ialso want to know if it is possible to add response format parameters like verbose_json ?check the response format here! (https://platform.openai.com/docs/api-reference/audio/createTranscription)

No problem - glad its working now! On the other two questions, I'm not sure as I haven't really explored the Whisper library outside of the functionality of the demo app. I'd recommend looking at the main repo Whisper.cpp to find answers to those questions then update the Rust code accordingly.