android-demo-app
android-demo-app copied to clipboard
NoneType return loadModuleFromAsset(getAssets(), "d2go.pt");
Caused by: com.facebook.jni.CppException:
Unknown type name 'NoneType':
Serialized File "code/__torch__/torch/nn/intrinsic/quantized/modules/conv_relu.py", line 24
return _0
def __setstate__(self: __torch__.torch.nn.intrinsic.quantized.modules.conv_relu.ConvReLU2d,
state: Tuple[int, int, Tuple[int, int], Tuple[int, int], Tuple[int, int], Tuple[int, int], bool, Tuple[int, int], int, str, Tensor, Optional[Tensor], float, int, bool]) -> NoneType:
~~~~~~~~ <--- HERE
self.in_channels = (state)[0]
self.out_channels = (state)[1]
I am facing the same issue
cc @jeffxtang
Did you create d2go.pt using the script in the repo, or use the model file directly in the repo?
I am creating d2go.pt in Google colab
I am training custom model and for conversion I am referring create_d2go.py
Did you use PyTorch 1.9 and torchvision 0.10.0 to create your model? Then the build.gradle needs to be updated with 1.9.0 like this and use the lite version api like this.
Or you can install PyTorch 1.8 and torchvision 0.9 to work with the current Android code.
I am facing the same issue.
I followed @jeffxtang advice, but I get this error on android:
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 ()
from the line :
mModule = LiteModuleLoader.load(MainActivity.assetFilePath(getApplicationContext(), "d2go.pt"));
I guess d2go is only supported for Pytorch 1.8 : (If I am not mistaken) [https://pytorch.org/mobile/android/]
Now I am trying to run the notebook again from colab with Pytorch installed 1.8.
But that doesn't seem to work :\
Import errors from torch text..
ImportError: /usr/local/lib/python3.7/dist-packages/torchtext/_torchtext.so: undefined symbol: _ZN2at6detail10noopDeleteEPv
Any leads ?
The goal is to try the balloon toy set on D2go so I could later twist it to my Custom dataset.
D2Go for PyTorch 1.9 works, but an updated script is required to create the model - please checkout the PyTorch 1.9 updated D2Go iOS demo app, steps 1-3 of here for now. Will update this D2Go Android demo app to 1.9 soon.
@MayarLotfy I am trying this in colab and it has started to train
!pip install --pre torch==1.8.0 torchvision==0.9.0 torchtext==0.9.1 -f https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html -U
Will update whether the generated .pt file is working
The app is crashing when I press detect. I think we have to wait for the updated app
@jeffxtang I am getting this error
Process: org.pytorch.demo.objectdetection, PID: 9752 com.facebook.jni.CppException: Method 'forward' is not defined. Exception raised from get_method at ../../../../src/main/cpp/libtorch_include/x86/torch/csrc/jit/api/object.h:96 (most recent call first): (no backtrace available) at org.pytorch.NativePeer.forward(Native Method) at org.pytorch.Module.forward(Module.java:49) at org.pytorch.demo.objectdetection.MainActivity.run(MainActivity.java:241) at java.lang.Thread.run(Thread.java:923) I/Process: Sending signal. PID: 9752 SIG: 9