google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
26.95k stars 5.1k forks source link

Crash when running Android text classification sample with MobileBERT. #5459

Closed v-hogood closed 1 month ago

v-hogood commented 4 months ago

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

No

OS Platform and Distribution

Android 10 API 29

Mobile device if the issue happens on mobile device

Google Pixel (original)

Browser and version if the issue happens on browser

No response

Programming Language and version

Kotlin

MediaPipe version

0.10.14

Bazel version

No response

Solution

tasks-text

Android Studio, NDK, SDK versions (if issue is related to building in Android environment)

No response

Xcode & Tulsi version (if issue is related to building for iOS)

No response

Describe the actual behavior

Text Classification crashes when classifying with MobileBERT

Describe the expected behaviour

Text Classification works as with AverageWordVec

Standalone code/steps you may have used to try to get what you need

https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/text_classification/android

Other info / Complete Logs

https://github.com/google-ai-edge/mediapipe-samples/issues/403
kuaashish commented 3 months ago

Hi @v-hogood,

Could you please try using Android Studio Flamingo | 2022.2.1 Patch 2? I successfully ran the Text Classification demo with the MobileBERT model on a Pixel 6a without any crashes. Please find the screenshot for your reference here.

Thank you!!

v-hogood commented 3 months ago

Hi kuaasish,

I'm using Android Studio Jellyfish 2023.3.1 Patch 1 and don't want to go all the way back to Flamingo.

Could you make sure the Text Classification example is using mediapipe:tasks-text:0.10.14? If so can you try it on a Pixel (original, not 6a)? Maybe it only happens on older phones/APIs.

Thanks,

--Howard

kuaashish commented 3 months ago

Hi @v-hogood,

Currently, we do not have the original Pixel available. We will check if it can be reproduced on our older devices and will inform you of the status.

Thank you!!

v-hogood commented 3 months ago

Thanks! Make sure it's mediapipe:tasks-text:0.10.14 it works on 0.10.13 and earlier.

kuaashish commented 3 months ago

Hi @v-hogood,

This issue might be due to recent changes in the latest version. Your device is quite old, so we request you to try it on another device with the same Android API. We believe this could also be caused by a RAM shortage, which might prevent the device from handling the model's requirements. Please use newer devices with sufficient RAM.

Thank you!!

github-actions[bot] commented 3 months ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

v-hogood commented 3 months ago

I will try it on a Samsung Galaxy S9 and let you know.

v-hogood commented 3 months ago

0.10.14 also crashes on a Samsung Galaxy S9 (Android 10 API 29). 0.10.13 works.

--------- beginning of crash
2024-06-30 00:07:17.713  7596-9950  .textclassifie          com...apipe.examples.textclassifier  W  0xebadde09 skipped times: 0
2024-06-30 00:07:17.714  7596-9950  libc                    com...apipe.examples.textclassifier  A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 9950 (mediapipe/9950), pid 7596 (.textclassifier)
2024-06-30 00:07:17.894  9961-9961  DEBUG                   pid-9961                             A  pid: 7596, tid: 9950, name: mediapipe/9950  >>> com.google.mediapipe.examples.textclassifier <<<
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #01 pc 000000000047938c  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #02 pc 00000000004f3f4c  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #03 pc 000000000047b85c  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #04 pc 0000000000466914  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #05 pc 00000000002ae190  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #06 pc 0000000000512b38  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.895  9961-9961  DEBUG                   pid-9961                             A        #07 pc 00000000005124e8  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #08 pc 0000000000507a64  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #09 pc 00000000000c77d8  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #10 pc 00000000000c0968  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #11 pc 00000000000c3bc8  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #12 pc 00000000000c1210  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #13 pc 0000000000195e48  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #14 pc 000000000017ff44  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #15 pc 000000000017fc10  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #16 pc 00000000001920c8  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
2024-06-30 00:07:17.896  9961-9961  DEBUG                   pid-9961                             A        #17 pc 0000000000191ce4  /data/app/com.google.mediapipe.examples.textclassifier-WKOFGPu6l83HsuGyRTllsQ==/base.apk (offset 0x1964000)
---------------------------- PROCESS STARTED (9963) for package com.google.mediapipe.examples.textclassifier ----------------------------
2024-06-30 00:07:18.449  1431-1828  InputDispatcher         system_server                        E  channel '9a7501 com.google.mediapipe.examples.textclassifier/com.google.mediapipe.examples.textclassifier.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2024-06-30 00:07:18.464  1431-1558  WindowManager           system_server                        E  RemoteException occurs on reporting focusChanged, w=Window{9a7501 u0 com.google.mediapipe.examples.textclassifier/com.google.mediapipe.examples.textclassifier.MainActivity EXITING}
                                                                                                    android.os.DeadObjectException
                                                                                                        at android.os.BinderProxy.transactNative(Native Method)
                                                                                                        at android.os.BinderProxy.transact(BinderProxy.java:575)
                                                                                                        at android.view.IWindow$Stub$Proxy.windowFocusChanged(IWindow.java:829)
                                                                                                        at com.android.server.wm.WindowState.reportFocusChangedSerialized(WindowState.java:3800)
                                                                                                        at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:5438)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:107)
                                                                                                        at android.os.Looper.loop(Looper.java:237)
                                                                                                        at android.os.HandlerThread.run(HandlerThread.java:67)
                                                                                                        at com.android.server.ServiceThread.run(ServiceThread.java:44)
2024-06-30 00:07:18.474  1431-1884  WindowManager           system_server                        E  win=Window{9a7501 u0 com.google.mediapipe.examples.textclassifier/com.google.mediapipe.examples.textclassifier.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:1249 com.android.server.wm.AppWindowToken.destroySurfaces:1230 com.android.server.wm.WindowState.onExitAnimationDone:5189 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:3941 com.android.server.wm.AppWindowToken.commitVisibility:914 
---------------------------- PROCESS ENDED (9963) for package com.google.mediapipe.examples.textclassifier ----------------------------
kuaashish commented 2 months ago

Hi @PaulTR,

Do you know why this is happening? Version 0.10.13 runs the sample text classification with MobileBert fine, but there seems to be a problem with the latest version, 0.10.14.

Thank you!!

v-hogood commented 1 month ago

This works again on 0.10.15.

google-ml-butler[bot] commented 1 month ago

Are you satisfied with the resolution of your issue? Yes No