tvm/src/runtime/module.cc:58: Check failed: f != nullptr Loader of (module.loadfile_so) is not presented.
terminate called after throwing an instance of 'dmlc::Error'
what(): [16:49:05] tvm/src/runtime/module.cc:58: Check failed: f != nullptr Loader of (module.loadfile_so) is not presented.
Reproducing step:
Get the pretrained resnet18 model and dump the necessary files: graph json, parameters and library file
android native deploy this helps you to show how to run on android os using native function call, library which you need to deploy on target(Android) should be precompiled with proper target and target host and should be export using NDK toolcahin.
Please refer this link to compile cpu and gpu flavor version for android target.
@dayanandasiet My use case is deploying deep learning model in ordinary cpu.(Tensorflow/caffe won’t work due to protobuf version issues). So would you given a more detailed tutorial on how to deploy a mxnet model(like a pretrained resnet18 model) to a cpu environment! That will be much helpful! And building a tvm static library is preferred in my production environment.
And the key is not the python part, how to deploy a model in a c++ enviroment is the key here!
nm tvm/libtvm.a | grep module
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
module_util.cc.o:
0000000000000c3c t _GLOBAL__sub_I_module_util.cc
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
module.cc.o:
0000000000003978 t _GLOBAL__sub_I_module.cc
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
dso_module.cc.o:
0000000000000677 t _GLOBAL__sub_I_dso_module.cc
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
system_lib_module.cc.o:
00000000000006e5 t _GLOBAL__sub_I_system_lib_module.cc
0000000000000000 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000030 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
0000000000000038 d _ZN3tvm7runtime6symbolL14tvm_module_ctxE
0000000000000068 d _ZN3tvm7runtime6symbolL15tvm_module_mainE
Will this be of any help for your debug in this case??
Can you try including all files inside your c++ app instead of another libtvm.a ?
Or
Create tvm.cc which just includes all above files and build libtvm.a from this single file ?
I use this way in a different build environment and it works.
tvm/src/runtime/module.cc:58: Check failed: f != nullptr Loader of (module.loadfile_so) is not presented.
terminate called after throwing an instance of ‘dmlc::Error’
what(): [16:49:05] tvm/src/runtime/module.cc:58: Check failed: f != nullptr Loader of (module.loadfile_so) is not presented.
I have combined all the .cc.o files into one .a file, then used this archive file to generated the application. Application build fine, but when I am deploying on the arm device, it shows that error, whereas it works fine for libtvm_runtime.so.
I did not understand your above mentioned solution
“Create tvm.cc which just includes all above files and build libtvm.a from this single file ?
I use this way in a different build environment and it works.”
Just to be sure,while building tvm as static library, we should be using the lib.so (for arm64 ) generated from the python file right? That will work with c++ deployement?
thanks
Above solution is about how we build static TVM runtime and compile against our final executable.
Instead of building individual files of runtime and then archiving I suggested to include all .cc files in another file and then make an archive.
Compiled module (graph, params, model)
Here model is the lib.so (python build output) which is just compiled module not runtime.