-
Notifications
You must be signed in to change notification settings - Fork 611
PytorchStreamReader failed locating file bytecode.pkl: file not found () #282
Comments
I don't have knowledge of this, but I've found on https://pytorch.org/tutorials/recipes/mobile_interpreter.html
|
I am facing the same issue |
@kit1980 @jeffxtang @IvanKobzarev @nairbv The PytorchStreamReader issue is fixed, but I am facing now with other error com.facebook.jni.CppException: Lite Interpreter version number does not match. The model version must be between 3 and 7 but the model version is 8 () Any ideas how to fix the Lite Interpreter version issue to be able to launch the app successfully? Thanks a lot in advance! |
@HripsimeS looks like your new issue is a duplicate of: #202. Maybe try increasing PyTorch lib versions to implementation 'org.pytorch:pytorch_android_lite:1.12.2'
implementation 'org.pytorch:pytorch_android_torchvision_lite:1.12.2' |
@fahim44 Hello. Indeed changing PyTorch lib versions to 1.12.2 helped to launch app successfully, but real time live detection is making strange predictions. It works fine with pictures, but live detection of objects does not show good reaults. So I don't know it is because of converted model or because I still need to do some more modifications in object detection scripts https://github.com/pytorch/android-demo-app/tree/master/ObjectDetection |
@HripsimeS may be some issue with camerax... not fully sure though |
@fahim44 I tried the initial model yolov5s.torchscript.ptl mentioned in Prepare the model part It works perfect with PyTorch lib versions 1.10.0, but with 1.12.2 does not work good. With 1.12.2 versions the app is launching, but I don't get good predictions for my cutom model. So I am a bit confused, don't know what is the reason and which PyTorch lib versions I should use for my custom model to get good predictions. |
@HripsimeS https://github.com/pytorch/android-demo-app/tree/master/ObjectDetection mentioned yolov5 repo commitId: |
@fahim44 thanks for your reply! I removed and imported ObjectDetection project on Android studio, now initial model yolov5s.torchscript.ptl works good on both PyTorch lib versions 1.10.0, but with 1.12.2. But the same issues with my custom model, with 1.10.0 version getting Lite Interpreter version error and with 1.12.2 version app is launching but can't get good predictions. So I hope the issue is not in converted torchscript.ptl model... And you also recommend to use this command? I use Windows OS, in that case where I need to write that command? Thank you in advance :) |
@HripsimeS I assume you have git installed on your machine. Go to your |
@fahim44 thank you, it was helpful. I wrote in git bash here git reset --hard cd35a009ba964331abccd30f6fa0614224105d39 When I run this command to check git checkout cd35a009ba964331abccd30f6fa0614224105d39 Seems that reference is not acctual anymore and maybe there is a new number ? |
@HripsimeS can you try to follow the steps on https://github.com/pytorch/android-demo-app/tree/master/ObjectDetection#1-prepare-the-model? I think you need to clone https://github.com/ultralytics/yolov5 |
@fahim44 I did following all steps git clone, then I modify https://github.com/ultralytics/yolov5/blob/master/export.py file to convert my model to .torchscript.ptl format. On pictures it works more or less okay, but it does not work with LIVE real time detection. I don't think the issue in my converted model, maybe PyTorch lib version or need to change other parameters in scripts to oprimize better for my model. So yeah, I am stuck on this because it is not clear why LIVE detection is bad on android. |
You may check model size, above 200MB, I have memory crash error, it work wrong. |
Also, I think this solution may help to build real-time your app. https://pytorchvideo.org/docs/tutorial_accelerator_build_your_model |
@NeighborhoodCoding thanks for your reply! My model.torchscript.ptl is just 27MB, so I don't think it is so big to cause a memory crash error. And thanks for the link about build an accelerator for the model, I will check it 🥇 |
Traceback (most recent call last): |
@romovpa @kostmo @smacke @kit1980 Hello. I use the following export file to convert pt to torchscript.ptl https://github.com/ultralytics/yolov5/blob/master/export.py
python export.py --weights yolov5s.pt --include torchscript
And while I am launch the object detection app with converted model, I got these errors
E/AwareLog: AtomicFileUtils: readFileLines file not exist: android.util.AtomicFile@78c7be1
E/MemoryLeakMonitorManager: MemoryLeakMonitor.jar is not exist!
E/: [ZeroHung]zrhung_get_config: Get config failed for wp[0x0102]
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.pytorch.demo.objectdetection, PID: 14590
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.pytorch.demo.objectdetection/org.pytorch.demo.objectdetection.MainActivity}: com.facebook.jni.CppException: PytorchStreamReader failed locating file bytecode.pkl: file not found () Exception raised from valid at ../caffe2/serialize/inline_container.cc:158 (most recent call first):
Can you please help to understand what is the issue. Maybe I am using a wrong export file or wrong command to convert ?
The text was updated successfully, but these errors were encountered: