Tutorial provided torch model to android app failed

I have been following the tutorial (Image Segmentation DeepLabV3 on Android — PyTorch Tutorials 2.2.0+cu121 documentation) to use a torch model inside an android app, but in the “Module Load Period”, the app will crash.

Only one line of code in android:

Module module = Module.load(MainActivity.assetFilePath(getApplicationContext(), “deeeplabv3_scripted.pt”));

The crash message is

E/libc++abi: terminating with uncaught exception of type c10::Error: isTuple()INTERNAL ASSERT FAILED at “…/…/…/…/src/main/cpp/libtorch_include/arm64-v8a/ATen/core/ivalue_inl.h”:1400, please report a bug to PyTorch. Expected Tuple but got String
Exception raised from toTuple at …/…/…/…/src/main/cpp/libtorch_include/arm64-v8a/ATen/core/ivalue_inl.h:1400 (most recent call first):
(no backtrace available)

I hope anyone helps me. Thanks!

Hi, any idea on how to solve the issue?
I’m having the same error on the Obj. Detection demo app (android-demo-app/ObjectDetection at master · pytorch/android-demo-app · GitHub) when I train it on custom dataset with pytorch 1.12.1+cu116 and torchvision version 0.13.1+cu116.

May the error be due to the pytorch version?
I’m not sure where to look for an hint on the origin of the problem…
Thanks

I have went to use Tensorflow and it works. My app is in the google Playstore. Everything is fine:)

Hi, this problem still exists. Could someone look into this? Thanks.