I am getting the following error while running a PyTorch model on android model?
Lite Interpreter verson number does not match. The model version must be between 3 and 5But the model version is 7 ()
Any suggestion?
I am getting the following error while running a PyTorch model on android model?
Lite Interpreter verson number does not match. The model version must be between 3 and 5But the model version is 7 ()
Any suggestion?
Probably the version of the PyTorch the model was exported with and the Android PyTorch API that you want to use in your Android app don't match. It seems that the PyTorch version was released later, hence the old version of the Android PyTorch API does not support the newer PyTorch model version.
You should update the build dependencies of your Android project. With the latest version of the pytorch_android_lite and the pytorch_android_torchvision_lite the issue you've reported should be eliminated.
If you use Gradle, you should add the two implementation
configuration to your project's build.gradle
file (supposing the latest version of the two dependencies is 1.13.1):
dependencies {
...
implementation 'org.pytorch:pytorch_android_lite:1.13.1'
implementation 'org.pytorch:pytorch_android_torchvision_lite:1.13.1'
}
following code converts the version 7 model to 5: