Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

couldn't find "libpytorch_jni.so" #159

Open
zaeemasvatisazi opened this issue Jun 21, 2021 · 2 comments
Open

couldn't find "libpytorch_jni.so" #159

zaeemasvatisazi opened this issue Jun 21, 2021 · 2 comments

Comments

@zaeemasvatisazi
Copy link

zaeemasvatisazi commented Jun 21, 2021

Hi

I'm trying to run an object detection model using PyTorch Mobile in Android Studio, but I'm getting this error: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/ai.isazi.android.brandi.distribution-d262fPg6Kfh8SoY_fVmG7w==/base.apk"],nativeLibraryDirectories=[/data/app/ai.isazi.android.brandi.distribution-d262fPg6Kfh8SoY_fVmG7w==/lib/arm64, /data/app/ai.isazi.android.brandi.distribution-d262fPg6Kfh8SoY_fVmG7w==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]] couldn't find "libpytorch_jni.so"

when loading the model file as follows:
val objectDetector: Module = Module.load(assetFilePath(this, "model.pt")

This is how the dependencies in my build.grade file looks:
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'org.pytorch:pytorch_android_lite:1.9.0'
implementation 'org.pytorch:pytorch_android_torchvision:1.9.0

Any help or suggestions would be greatly appreciated

@sadCloud6
Copy link

Hi.
Maybe you can try to use org.pytorch.LiteModuleLoader to load your model.
More information is in pytorch/pytorch#58913.

@jeffxtang
Copy link
Contributor

Yes if you use implementation 'org.pytorch:pytorch_android_lite:1.9.0' in the build.gradle, you need to use LiteModuleLoader.load - here's an example

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants