whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Core ML integration sample

Open 07JP27 opened this issue 2 years ago • 4 comments

Firstly, I would like to express my gratitude to the individuals who have contributed to this fantastic package.

I am currently attempting to create an application using Core ML, but I am facing some challenges. I followed the instructions mentioned in the README and generated the mlmodelc and mlpackage. Afterwards, I successfully built and executed the CLI application using cpp.

Now, I want to integrate this model into an actual SwiftUI app, but I am unsure about the usage. Specifically, I am unsure which methods to call in the automatically generated class when I drop the mlpackage into Xcode, and how to prepare the input to be provided there. I have also checked #566 , but it doesn't seem to provide the information I want.

Do you have any sample code or additional advice to assist me? I appreciate your help.

07JP27 avatar May 08 '23 00:05 07JP27

i face the same issues. how to use mlpackage on iOS devices?

andforce avatar May 08 '23 07:05 andforce

https://github.com/drasticactions/whisper.cpp/tree/coreml-demo/examples/whisper.swiftui

I have tried to update the sample to show how you can enable CoreML. In short, you need to:

  • Include the CoreML classes and headers
  • Add your mlmodelc to the same file hierarchy as your model.
  • Enable the WHISPER_USE_COREML preprocessor definition in your Clang settings.

Having this in the docs would be nice if you're doing source builds, which seems to be how most people not using bindings consume Whisper.cpp.

スクリーンショット 2023-05-13 22 39 19

If it's working, you should see this in your output window.

drasticactions avatar May 13 '23 14:05 drasticactions

@drasticactions Could you explain the "Include the CoreML classes and headers" part more simply (sorry still a beginner!). I looked at your README and did everything else, but that I'm not sure what to do. Is there a file hierarchy I need to match? Below is how I have them included currently. whisper.cpp.swiftui coreml

barkb avatar May 16 '23 23:05 barkb

Hi @barkb did you figure out eventually, Im also strugging with it now. I follow the instruction in the page @drasticactions, I got no luck. Im not sure what does the Include the CoreML classes and headers mean ?

gavin1818 avatar Jul 24 '24 21:07 gavin1818

Excuse me, I have a question : How to I can change value of WHISPER_USE_COREML when building application ? I want to add an option to choice CoreML or not. Thanks

iVoGia avatar Oct 11 '24 04:10 iVoGia