Loading tar module using C++ API

I guess tvm.runtime.load_module(path) is equivalent to tvm::runtime::Module::LoadFromFile() of C++ API. Though I cannot load module that has tar extension.

Check failed: (f != nullptr) is false: Loader of (runtime.module.loadfile_tar) is not presented.

I’m trying this in terms of cross compiling, without cross compiler in my local machine. Any workaround to enable this? Thanks in advance.

Actually, tvm.runtime.load_module(path) is not equivalent to tvm::runtime::Module::LoadFromFile(). tvm.runtime.load_module(path) is a wrapper for tvm::runtime::Module::LoadFromFile() to handle different model format(.so or .tar).

The implementation is here. tvm/module.py at 5c1a1cf7289b439b0042a85b63b0007dc1d9b98a · apache/tvm

In load_module(path), if the path ends with .tar, it extract .so within the tar archive to a temporary directory and load it by calling ModuleLoadFromFile() which is equivalent to tvm::runtime::Module::LoadFromFile(). So you can’t directory load .tar to C++. You need to untar it manually.

1 Like

Following the implementation I got how it works. Thanks for the details.