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

HellowWorld app immediately crashes on launch #79

Open
phildow opened this issue Aug 14, 2020 · 3 comments
Open

HellowWorld app immediately crashes on launch #79

phildow opened this issue Aug 14, 2020 · 3 comments

Comments

@phildow
Copy link

phildow commented Aug 14, 2020

With a clone of the repo as of Aug 14, 2020, no modifications, the HelloWorld app crashes at launch trying to read the model.pt asset:

/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.pytorch.helloworld, PID: 6473
    java.lang.RuntimeException: Unable to start activity ComponentInfo{org.pytorch.helloworld/org.pytorch.helloworld.MainActivity}: com.facebook.jni.CppException: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at ../caffe2/serialize/inline_container.cc:132, please report a bug to PyTorch. Attempted to read a PyTorch file with version 3, but the maximum supported version for reading is 2. Your PyTorch installation may be too old. (init at ../caffe2/serialize/inline_container.cc:132)
    (no backtrace available)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: com.facebook.jni.CppException: version_ <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at ../caffe2/serialize/inline_container.cc:132, please report a bug to PyTorch. Attempted to read a PyTorch file with version 3, but the maximum supported version for reading is 2. Your PyTorch installation may be too old. (init at ../caffe2/serialize/inline_container.cc:132)

The crash is consistent even if I recreate the model with the trace_model script using a couple different versions of torch and torchvision:

With torch==1.6.0 torchvision==0.7.0, Run python trace_model.py, clean and launch, app crashes with same error.

With torch==1.4.0 torchvision==0.5.0, Run python trace_model.py, clean and launch, app crashes with same error.

It may be worth noting that I have multiple versions of the Android NDK installed and specify ndkVersion "21.1.6352462"

@suyashcjoshi
Copy link

suyashcjoshi commented Oct 25, 2020

I got the same error and was able to fix the problem by updating the dependencies. See my repo (https://github.com/suyashjoshi/android-demo-app) for this fixed version. I've also submitted a Pull Request to the main Android PyTorch repo with the fix : #87

@Siddhijain16
Copy link

Hello @SuyashJoshi
Can you help me , I am trying to load my custom model (xyz.pth) using the script
trace_model.py but getting this error
Is my model loading is correct ?
what should I do please help ............
image

@jasoriya
Copy link

I'm facing this error as well. This is really off-putting when a Hello World for a noob :(

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

4 participants