Macoron / whisper.unity

Running speech to text model (whisper.cpp) in Unity3d on your local machine.
MIT License
398 stars 90 forks source link

Android x86_64 compatibility #54

Open JMBartelt opened 1 year ago

JMBartelt commented 1 year ago

Would it be possible for whisper.cpp to be compiled for Android x86_64 architecture and run using whisper.unity?

I've got a libwhisper.so file built for Android x86_64 and am wondering what my next steps would be to implement it with whisper.unity. Thanks!

Macoron commented 1 year ago

I personally never tested that, because I don't have x86 Android device. But you probably can:

  1. Compile whisper as a static library .a with x86_64 (see how it's done in CI pipeline here)
  2. Copy compiled library to package Plugins/Android and replace existing one
  3. Comment out this code which checks PlayerSettings. I added that just as a warning and it won't break anything.
  4. In PlayerSettings enable x86_64 architecture

Should probably work after that. Please write back if it does.

P.S. For what target do you compile x86_64? Is that some Chrome OS IoT stuff?

JMBartelt commented 1 year ago

Thanks for the directions, I'll give it a try! My target device is the Magic Leap 2

JMBartelt commented 1 year ago

The app builds and starts after replacing the libwhisper.a with one compiled for Android x86_64, but crashes immediately at runtime.

Babilinski commented 3 months ago

Heads-up to anyone who stubbles upon this, you may need to update the build.sh script that is in the root folder to respect the architecture specified in the build pipeline.

https://github.com/Macoron/whisper.unity/blob/master/build_cpp.sh#L78

Macoron commented 3 months ago

Heads-up to anyone who stubbles upon this, you may need to update the build.sh script that is in the root folder to respect the architecture specified in the build pipeline.

https://github.com/Macoron/whisper.unity/blob/master/build_cpp.sh#L78

Does the compiled library work on your target x86_64 device?

Babilinski commented 3 months ago

Yes, I just pushed up the changes and configured the project in my fork for android x86_64: https://github.com/Babilinski/whisper.unity