DakeQQ / Native-LLM-for-Android

Demonstration of running a native LLM on Android device.
https://dakeqq.github.io/overview/
Apache License 2.0
52 stars 6 forks source link

App getting close automatically after few seconds with blank screen #1

Closed Ammar-Ishfaq closed 6 months ago

Ammar-Ishfaq commented 6 months ago

Hello, I've compiled the project and run it on Samsung s22 and Android 14 upon launching of app it's just black (or either white screen sometimes).

DakeQQ commented 6 months ago

I'm happy to see someone is starting a trial. Following the checklist below may help you solve the problems:

  1. Manually unzip the so.zip file, which is located in 'app/libs/arm64-v8a'. You will obtain the necessary .so and .h files. Place them directly into the arm64-v8a folder, without using any sub-folder paths. 屏幕截图 2024-03-07 123515
  2. Download the model from the provided link and place it directly into the assets folder, without using any sub-folder paths.
  3. The peak memory usage reaches approximately 4GB while loading the *.ort model. Please ensure there is sufficient system memory available to proceed with the launch.
  4. I have tried another Android phone, and it actually displayed a blank screen on the first launch after installed. However, it returned to normal upon relaunching it. To be honest, I have no idea what happened.

Please feel free to ask any other questions if they exist.

Ammar-Ishfaq commented 6 months ago

I've followed the instructions (attached the SS image ) Also, I download the .ort models in the assets directory. But it's not working on my Samsung s22, I've tried multiple times (relaunching). Could you please tell me some way like the way I can get this running?

DakeQQ commented 6 months ago

I have an Android Phone running Android 13, equipped with an 8Gen2 processor, and 12GB RAM, experiencing the same phenomena you encountered. It consistently crashes when creating the .ort model in project.cpp at line 391.

Here's what I've tried:

  1. Changed the ONNX *.so library version, but it still crashes.
  2. Disabled all the ONNX session options, but it still crashes.
  3. Disabled all the CMakeList optimize options, but it still crashes.
  4. Changed the NDK version, but it still crashes.
  5. Changed the JDK version, but it still crashes.
  6. Changed the Gradle version, but it still crashes.
  7. Ran another project that uses the same ONNX libraries & Java configuration with a small voice recognition model, and it worked!
DakeQQ commented 6 months ago

Strangely, after switching the phone to performance mode, clearing all background apps, and rebooting it, I cleaned and rebuilt the project again. Finally, it worked without any changes!

Ammar-Ishfaq commented 6 months ago

Sure, I'll try that and see if it works for me.