Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal Sentence Encoder crashes on initialisation - Android #4762

Closed
tobrun opened this issue Sep 6, 2023 · 7 comments
Closed

Universal Sentence Encoder crashes on initialisation - Android #4762

tobrun opened this issue Sep 6, 2023 · 7 comments
Assignees
Labels
platform:android Issues with Android as Platform task:text embedding Issues related to Text Embedding: Embed texts into feature vectors type:bug Bug in the Source Code of MediaPipe Solution type:build/install For Build and Installation issues

Comments

@tobrun
Copy link

tobrun commented Sep 6, 2023

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

No

OS Platform and Distribution

Android 13

Mobile device if the issue happens on mobile device

Samsung Galaxy Tab S8 Ultra 5G

Browser and version if the issue happens on browser

NA

Programming Language and version

Kotlin/Java

MediaPipe version

v0.10.3

Bazel version

NA

Solution

Text Embeddings

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

NA

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

NA

Describe the actual behavior

When trying to load Universal Sentence Encoder on this specific device, I'm facing a native crash. This code however works on an emulator (Nexus 4, API 25).

Describe the expected behaviour

Can load tensfor flow lite without a native crash.

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

Setup is conform to the sample code from the website:
 - TextEmbedderHelper 
 - hosting of model in assets

Other info / Complete Logs

2023-09-06 09:39:35.777 15693-15693 libc                    com.tobrun.rag.example               A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x46a873d98750f8 in tid 15693 (run.rag.example), pid 15693 (run.rag.example)
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A  Cmdline: com.tobrun.rag.example
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A  pid: 15693, tid: 15693, name: run.rag.example  >>> com.tobrun.rag.example <<<
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A        #00 pc 00000000004faf48  /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A        #01 pc 00000000004fc35c  /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A        #02 pc 000000000025abe8  /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A        #22 pc 00000000000cf1b0  [anon:dalvik-classes5.dex extracted in memory from /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk!classes5.dex] (com.google.mediapipe.tasks.text.textembedder.TextEmbedder.<clinit>+84)
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A        #29 pc 0000000000001e94  [anon:dalvik-classes2.dex extracted in memory from /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk!classes2.dex] (com.tobrun.rag.TextEmbedderHelper.setupTextEmbedder+144)
2023-09-06 09:39:35.986 15736-15736 DEBUG                   pid-15736                            A        #31 pc 0000000000001d42  [anon:dalvik-classes2.dex extracted in memory from /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk!classes2.dex] (com.tobrun.rag.TextEmbedderHelper.<init>+34)
2023-09-06 09:39:35.987 15736-15736 DEBUG                   pid-15736                            A        #33 pc 00000000000015dc  [anon:dalvik-classes2.dex extracted in memory from /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk!classes2.dex] (com.tobrun.rag.RagService.<init>+48)
2023-09-06 09:39:35.987 15736-15736 DEBUG                   pid-15736                            A        #35 pc 0000000000000a80  [anon:dalvik-classes4.dex extracted in memory from /data/app/~~2m_sCPziM3PJJAsR9QtDwA==/com.tobrun.rag.example-TPLfMv5XX5gw83f-J9kjXQ==/base.apk!classes4.dex] (com.tobrun.rag.example.MainActivity.onCreate+32)
---------------------------- PROCESS ENDED (15693) for package com.tobrun.rag.example ----------------------------
2023-09-06 09:39:36.093  2281-2355  WindowManager           system_server                        E  win=Window{76fb0f7 u0 Splash Screen com.tobrun.rag.example EXITING} destroySurfaces: appStopped=false cleanupOnResume=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.WindowState.onExitAnimationDone:5983 com.android.server.wm.ActivityRecord$$ExternalSyntheticLambda10.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.ActivityRecord.onAnimationFinished:8601 com.android.server.wm.ActivityRecord.postApplyAnimation:6246 com.android.server.wm.ActivityRecord.commitVisibility:6218 com.android.server.wm.ActivityRecord.commitVisibility:6222
@tobrun tobrun added the type:bug Bug in the Source Code of MediaPipe Solution label Sep 6, 2023
@kuaashish kuaashish added platform:android Issues with Android as Platform task:text embedding Issues related to Text Embedding: Embed texts into feature vectors type:build/install For Build and Installation issues labels Sep 6, 2023
@tobrun
Copy link
Author

tobrun commented Sep 6, 2023

validated that older versions face the same issue

@kuaashish
Copy link
Collaborator

@tobrun,

We rigorously test all of our Android Task APIs on physical mobile Android devices, primarily the Pixel, rather than on tablet devices. We strongly recommend conducting your testing on a physical mobile Android device. In cases where tasks do not necessitate the use of a device camera or microphone, an Android device emulator can be a suitable alternative to a physical device. For a more detailed guide on setting up an Android device, we encourage you to refer to our Android device setup documentation for enhanced clarity and comprehension.

Additionally, kindly inform us if you encounter similar behaviour on the recommended device. Thank you

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Sep 6, 2023
@tobrun
Copy link
Author

tobrun commented Sep 7, 2023

considering another report on a Samsung s22, it seems to be a culprint that Samsung devices are not properly being supported at this time.

I don't fully understand your comment. You make it seem it's my mistake of not using the correct device but it's on you the library developer to ensure compatibility within the Android ecosystem. For now, will switch to another text embedding implementation. Looking forward seeing this library becoming more stable in the future.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Sep 7, 2023
@kuaashish kuaashish added the stat:awaiting googler Waiting for Google Engineer's Response label Sep 7, 2023
@tobrun
Copy link
Author

tobrun commented Sep 15, 2023

Samsung z-flip 5 same crash.
was able to purchase a pixel 7a and it works for that device.

@kuaashish kuaashish removed the stat:awaiting googler Waiting for Google Engineer's Response label Sep 22, 2023
@kuaashish
Copy link
Collaborator

@tobrun,

Thank you for reporting this. We have received confirmation of the crash report on the same device, and we are actively working on a solution for it. Meanwhile, we suggest that you please consider using an older version for these devices instead.

@tobrun
Copy link
Author

tobrun commented Sep 22, 2023

Can't give a reason why this is happening but when adding:

project.ext.ASSET_DIR = projectDir.toString() + '/src/main/assets'

conform to
https://github.com/googlesamples/mediapipe/blob/main/examples/text_embedder/android/app/build.gradle#L40

the issue goes away, eventhough without it, it works on pixel and emulator.

@tobrun tobrun closed this as completed Sep 22, 2023
@google-ml-butler
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:android Issues with Android as Platform task:text embedding Issues related to Text Embedding: Embed texts into feature vectors type:bug Bug in the Source Code of MediaPipe Solution type:build/install For Build and Installation issues
Projects
None yet
Development

No branches or pull requests

3 participants