@ReactMethod
public void testModelLoading(String imagePath, String envName,final Callback successCallback, final Callback errorCallback) {
try {
String modifiedPath = imagePath.replace(“file://”, “”);
String modelFilePath = assetFilePath(reactContext, “my_model_lite.ptl”);
Log.i(“FCNVImagePyTorch”, “Model trying”);
Module module = Module.load(modelFilePath);
Log.i(“FCNVImagePyTorch”, “Model loaded successfully”);
successCallback.invoke(“Model loaded successfully”);
} catch (Exception e) {
Log.e(“FCNVImagePyTorch”, "Exception: " + e.getMessage());
errorCallback.invoke("Exception: " + e.getMessage());
}
}
I am trying to load a model which is of 4.6mb and app got crashed immediately after loading.
When I used adb logcat --buffer=crash to check logs
I got below
: Abort message: 'terminating with uncaught exception of type c10::Error: isTuple()INTERNAL ASSERT FAILED at “…/…/…/…/src/main/cpp/libtorch_include/arm64-v8a/ATen/core/ivalue_inl.h”:1306, please report a bug to PyTorch. Expected Tuple but got String
08-05 12:56:20.965 4347 4347 F DEBUG : Exception raised from toTuple at …/…/…/…/src/main/cpp/libtorch_include/arm64-v8a/ATen/core/ivalue_inl.h:1306 (most recent call first):
But another .ptl file of size 5 mb worked perfectly without any error. When I checked in Python. Both models loaded perfectly. Only in react native environment one is loading and the other one is failing with above error. Please help to resolve this issue