pytorch / android-demo-app

PyTorch android examples of usage in applications
1.45k stars 596 forks source link

please report a bug to PyTorch. Attempted to read a PyTorch file with version 10, but the maximum supported version for reading is 6. Your PyTorch installation may be too old. #272

Open BENSAFOUAN-Abdelhalim opened 1 year ago

BENSAFOUAN-Abdelhalim commented 1 year ago

I was installing the QuestionAnswering app, after downloading the qa360_quantized.ptl, and running the app in my Android Studio, i get this error :

E/AndroidRuntime: FATAL EXCEPTION: Thread-2 Process: org.pytorch.demo.questionanswering, PID: 27055 com.facebook.jni.CppException: version_ <= kMaxSupportedFileFormatVersionINTERNAL ASSERT FAILED at "../caffe2/serialize/inline_container.cc":147, please report a bug to PyTorch. Attempted to read a PyTorch file with version 10, but the maximum supported version for reading is 6. Your PyTorch installation may be too old. Exception raised from init at ../caffe2/serialize/inline_container.cc:147 (most recent call first): (no backtrace available) at org.pytorch.LiteNativePeer.initHybrid(Native Method) at org.pytorch.LiteNativePeer.(LiteNativePeer.java:28) at org.pytorch.LiteModuleLoader.load(LiteModuleLoader.java:30) at org.pytorch.demo.questionanswering.MainActivity.answer(MainActivity.kt:193) at org.pytorch.demo.questionanswering.MainActivity.run(MainActivity.kt:146) at java.lang.Thread.run(Thread.java:919)

dattay2711 commented 1 year ago

Same error with you. I think u should install the older version of pytorch (torch 1.9.0) . Make sure both Python version and Android version of PyTorch is the same.

jeb2112 commented 1 year ago

I got that same error with the suggested version of torch=1.10.0. Upgrading to 1.12.0 fixed it. NB as well, in build.gradle implementations, I had to specify implementation 'pytorch_android_lite:1.12.2, ie rather than 1.12.0. There is no 1.12.0 for python_android_lite it seems.