Open gl-hmasood opened 2 years ago
As listed in the repository, Chaquopy currently only supports PyTorch versions 1.4.0 and 1.8.1. Can you explain why you need a newer version?
Related: #758
As listed in the repository, Chaquopy currently only supports PyTorch versions 1.4.0 and 1.8.1. Can you explain why you need a newer version?
If I have a pytorch model trained on 1.10.1, and I tried to load it using 1.8.1 it give me the following error
ModuleNotFoundError: No module named 'torch.torch_version'
Please post the full stack trace and the relevant sections of your code.
Here is the full stack trace
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 6399
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: com.chaquo.python.PyException: ModuleNotFoundError: No module named 'torch.torch_version'
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3685)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: com.chaquo.python.PyException: ModuleNotFoundError: No module named 'torch.torch_version'
at <python>.java.chaquopy.import_override(import.pxi:20)
at <python>.java.chaquopy.import_override(import.pxi:60)
at <python>.torch.serialization._load(serialization.py:851)
at <python>.torch.serialization.load(serialization.py:592)
at <python>.flair.nn.model.load(model.py:142)
at <python>.main.predict(main.py:14)
at <python>.chaquopy_java.call(chaquopy_java.pyx:380)
at <python>.chaquopy_java.Java_com_chaquo_python_PyObject_callAttrThrowsNative(chaquopy_java.pyx:352)
at com.chaquo.python.PyObject.callAttrThrowsNative(Native Method)
at com.chaquo.python.PyObject.callAttrThrows(PyObject.java:232)
at com.chaquo.python.PyObject.callAttr(PyObject.java:221)
at com.example.myapplication.MainActivity.runNLPmodel(MainActivity.kt:37)
at com.example.myapplication.MainActivity.onCreate(MainActivity.kt:21)
at android.app.Activity.performCreate(Activity.java:8054)
at android.app.Activity.performCreate(Activity.java:8034)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
I/Process: Sending signal. PID: 6399 SIG: 9
And this error occurs on this line of code
torch.load("final-model.pt",map_location=torch.device('cpu'))
Thanks for the information. Unfortunately we won't be providing a new PyTorch version for at least the next few months, so the best option I can suggest is to regenerate your model with PyTorch 1.8.1.
If anyone else needs a new PyTorch version, please click the thumbs-up button above, and post a comment explaining why you need it.
I am trying to run pyannote.audio 2.0.1 on Android. It only supports torch >= 1.9. I can't use an older version of pyannote.audio, unfortunately. Any chance new support will be coming out soon?
We'll probably be looking at this in the next couple of months, but I'm afraid I can't be any more specific.
Meamwhile, the package build tool is now open-source, so if you'd like to try building a newer version yourself, follow the instructions here. And if you're successful, please make a pull request so we can add the new version to the public repository.
any progress on this?
The pytorch 1.8.1 library seems to not be linked with vulkan, so it doesn't support gpu
Also it would be good to support pytorch 2.x
Sorry, no progress yet.
I want to install new version of torch > 1.8.1 in android using chaquopy, but it is giving me error that can't install it. I had tried to download recent whl and put that in my project and then tried to pip install but again no success. Can anyone tell me how to fix it? Note: I am using M1 Apple Chip. Thanks