Hi everyone, I am currently working using relay VM. But when loading the saved serialized kernel binary and executable-related binary code I got some error message.
Serialize code and save:
vmc = relay.vm.compile(mod, target=target, params=params)
code, lib = vmc.save()
lib.export_library(vmc_lib_file)
with open(vmc_code_file, “wb”) as fo:
fo.write(code)
if os.path.exists(vmc_lib_file) and os.path.exists(vmc_code_file):
lib = tvm.runtime.load_module(vmc_lib_file)
code = bytearray(open(vmc_code_file, "rb").read())
vmc = runtime.vm.Executable.load_exec(code, lib)
else:
with auto_scheduler.ApplyHistoryBest(log_file):
with tvm.transform.PassContext(
opt_level=3, config={"relay.backend.use_auto_scheduler": True}
):
vmc = relay.vm.compile(mod, target=target, params=params)
# Save the vmc file for later use
code, lib = vmc.save()
lib.export_library(vmc_lib_file)
with open(vmc_code_file, "wb") as fo:
fo.write(code)
Error message:
Traceback (most recent call last):
File "redpajama-3b.py", line 257, in <module>
vmc = runtime.vm.Executable.load_exec(code, lib)
File "/tvm-0.15/python/tvm/runtime/vm.py", line 191, in load_exec
return Executable(_ffi_api.Load_Executable(bytecode, lib))
File "/tvm-0.15/python/tvm/_ffi/_ctypes/packed_func.py", line 239, in __call__
raise_last_ffi_error()
File "/tvm-0.15/python/tvm/_ffi/base.py", line 481, in raise_last_ffi_error
raise py_err
tvm._ffi.base.TVMError: Traceback (most recent call last):
4: _ZN3tvm7runtime13PackedFuncObj9ExtractorINS0_16PackedFuncSubObjIZNS0_15TypedPackedFuncIFNS0_6ModuleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_EE17AssignTypedLambdaINS0_2vmL9__mk_TVM6MUlSB_S5_E_EEEvT_SB_EUlRKNS0_7TVMArgsEPNS0_11TVMRetValueEE_EEE4CallEPKS1_SI_SM_
3: tvm::runtime::vm::Executable::Load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, tvm::runtime::Module)
2: tvm::runtime::vm::Executable::LoadCodeSection(dmlc::Stream*)
1: tvm::runtime::vm::DeserializeInstruction(tvm::runtime::vm::VMInstructionSerializer const&)
0: _ZN3tvm7runtime6detail8LogFatalD2Ev.
File "/tvm-0.15/src/runtime/vm/executable.cc", line 861
TVMError: Check failed: ((instr.fields.size()) >= (9U)) is false:
Can someone help me? Thank you for your assistance.