RK3399 model deployment


#1

I’m unable to deploy model to rk3399, I’m running this script “deploy_model_on_mali_gpu.py” and getting this error:

TVMError: [14:05:34] /home/firefly/Desktop/tvm_rk/tvm/src/runtime/module_util.cc:35: Check failed: f != nullptr Loader of (module.loadbinary_) is not presented.

Any suggestions?


#2

Did you make any changes to the tutorial script?


#3

The only change I made was setting local_demo = False to run on target device. If I keep local_demo = True it runs as it should.


#4

I cannot seem to reproduce the issue on my end. How did you compile the runtime on the rk3399 board?


#5

I followed the tutorial and got the RPC server up and running. I can see the connection coming from the host before the error.


#6

Is there a way to check if the TVM runtime compile succeeded on target ?

BTW here’s the complete error:
kendryte@kendryte-VirtualBox:~/tvm$ python ~/Downloads/deploy_model_on_mali_gpu.py
Downloading cat.png from https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true
Downloading synset.txt from https://gist.githubusercontent.com/zhreshold/4d0b62f3d01426887599d4f7ede23ee5/raw/596b27d23537e5a1b5751d2b0481ef172f58b539/imagenet1000_clsid_to_human.txt
[16:16:08] /home/kendryte/tvm/src/runtime/opencl/opencl_device_api.cc:239: No OpenCL platform matched given existing options …
Traceback (most recent call last):
File “/home/kendryte/Downloads/deploy_model_on_mali_gpu.py”, line 196, in
rlib = remote.load_module(‘net.tar’)
File “/home/kendryte/tvm/python/tvm/rpc/client.py”, line 132, in load_module
return base._LoadRemoteModule(self._sess, path)
File “/home/kendryte/tvm/python/tvm/_ffi/_ctypes/function.py”, line 185, in call
ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
File “/home/kendryte/tvm/python/tvm/_ffi/base.py”, line 72, in check_call
raise TVMError(py_str(_LIB.TVMGetLastError()))
tvm._ffi.base.TVMError: Except caught from RPC call: TVMCall CFunc Error:
Traceback (most recent call last):
File “/home/firefly/Desktop/tvm_rk/tvm/python/tvm/_ffi/_ctypes/function.py”, line 55, in cfun
rv = local_pyfunc(*pyargs)
File “/home/firefly/Desktop/tvm_rk/tvm/python/tvm/rpc/server.py”, line 50, in load_module
m = _load_module(path)
File “/home/firefly/Desktop/tvm_rk/tvm/python/tvm/module.py”, line 244, in load
return _LoadFromFile(path, fmt)
File “/home/firefly/Desktop/tvm_rk/tvm/python/tvm/_ffi/_ctypes/function.py”, line 185, in call
ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
File “/home/firefly/Desktop/tvm_rk/tvm/python/tvm/_ffi/base.py”, line 72, in check_call
raise TVMError(py_str(LIB.TVMGetLastError()))
TVMError: [13:16:18] /home/firefly/Desktop/tvm_rk/tvm/src/runtime/module_util.cc:35: Check failed: f != nullptr Loader of (module.loadbinary
) is not presented.

Stack trace returned 9 entries:
[bt] (0) /home/firefly/Desktop/tvm_rk/tvm/build/libtvm_runtime.so(+0xef2c) [0x7fa7c4ef2c]
[bt] (1) /home/firefly/Desktop/tvm_rk/tvm/build/libtvm_runtime.so(+0x3693c) [0x7fa7c7693c]
[bt] (2) /home/firefly/Desktop/tvm_rk/tvm/build/libtvm_runtime.so(+0x1d8b4) [0x7fa7c5d8b4]
[bt] (3) /home/firefly/Desktop/tvm_rk/tvm/build/libtvm_runtime.so(tvm::runtime::Module::LoadFromFile(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)+0x3cc) [0x7fa7c6e6c4]
[bt] (4) /home/firefly/Desktop/tvm_rk/tvm/build/libtvm_runtime.so(+0x3105c) [0x7fa7c7105c]
[bt] (5) /home/firefly/Desktop/tvm_rk/tvm/build/libtvm_runtime.so(TVMFuncCall+0x70) [0x7fa7c53078]
[bt] (6) /usr/lib/aarch64-linux-gnu/libffi.so.6(ffi_call_SYSV+0x64) [0x7fb0820d28]
[bt] (7) /usr/lib/aarch64-linux-gnu/libffi.so.6(ffi_call+0xc8) [0x7fb0821698]
[bt] (8) /usr/lib/python2.7/lib-dynload/_ctypes.aarch64-linux-gnu.so(_ctypes_callproc+0x274) [0x7fb08424fc]


#7

1 compile by cross compiler on computer
2 deploy json and others to 3399

note that, local_demo = False,
and make sure that
sudo apt-get install aarch64-linux-gnu

GOOD LUCK


#8

https://docs.tvm.ai/deploy/index.html


#9

If you are using the GPU on the device, you need to compile with OpenCL support (edit config.cmake) on the device.