Throwing error reading JSON file


#1

Hi @tqchen @srkreddy1238 @kayneWest I am able deploy and run iOS_rpc sample application iPad 6th gen, but while deploying cousomized tvm model I am getting error in reading JSON file.
Below are build details:

arch = "arm64"
sdk = "iphoneos"
target_host = "llvm -target=%s-apple-darwin" % arch

from tvm import relay
mod, params = relay.frontend.from_caffe2(init_net, predict_net, shape_dict, dtype_dict)

target = 'metal'
with relay.build_config(opt_level=0):
    graph, lib, params = relay.build(mod[mod.entry_func], target_host, target_host=target_host, params=params)

Loading code:

loaded_json = open(path_json).read()
remote = rpc.connect(proxy_host, proxy_port, key=key)
#remote = rpc.LocalSession()
ctx = remote.metal(0)
loaded_lib = remote.load_module("dev_lib.dylib")
module = graph_runtime.create(loaded_json, loaded_lib, ctx) **#here I am getting error**

Error:

module = graph_runtime.create(loaded_json, loaded_lib, ctx)
Traceback (most recent call last):

  File "<ipython-input-11-ed6b5ede16f0>", line 1, in <module>
    module = graph_runtime.create(loaded_json, loaded_lib, ctx)

  File "/Users/MacMini/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-macosx-10.7-x86_64.egg/tvm/contrib/graph_runtime.py", line 56, in create
    return GraphModule(fcreate(graph_json_str, hmod, *device_type_id))

  File "/Users/MacMini/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-macosx-10.7-x86_64.egg/tvm/_ffi/_ctypes/function.py", line 209, in __call__
    raise get_last_ffi_error()

TVMError: Traceback (most recent call last):
  [bt] (8) 9   tvmrpc                              0x00000001028c6b04 void std::__1::__invoke_void_return_wrapper<void>::__call<tvm::runtime::$_46&, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*>(tvm::runtime::$_46&&&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 88
  [bt] (7) 8   tvmrpc                              0x00000001028c6b94 decltype(std::__1::forward<tvm::runtime::$_46&>(fp)(std::__1::forward<tvm::runtime::TVMArgs>(fp0), std::__1::forward<tvm::runtime::TVMRetValue*>(fp0))) std::__1::__invoke<tvm::runtime::$_46&, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*>(tvm::runtime::$_46&&&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 96
  [bt] (6) 7   tvmrpc                              0x00000001028c6d9c tvm::runtime::$_46::operator()(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*) const + 488
  [bt] (5) 6   tvmrpc                              0x00000001027f4db0 tvm::runtime::GraphRuntimeCreate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, tvm::runtime::Module const&, std::__1::vector<DLContext, std::__1::allocator<DLContext> > const&) + 108
  [bt] (4) 5   tvmrpc                              0x00000001027eed58 tvm::runtime::GraphRuntime::Init(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, tvm::runtime::Module, std::__1::vector<DLContext, std::__1::allocator<DLContext> > const&) + 104
  [bt] (3) 4   tvmrpc                              0x00000001027eee5c tvm::runtime::GraphRuntime::Load(dmlc::JSONReader*) + 72
  [bt] (2) 3   tvmrpc                              0x000000010281be50 dmlc::JSONReader::BeginObject() + 388
  [bt] (1) 2   tvmrpc                              0x00000001027cc438 dmlc::LogMessageFatal::~LogMessageFatal() + 28
  [bt] (0) 1   tvmrpc                              0x00000001027cdc40 dmlc::LogMessageFatal::~LogMessageFatal() + 80
TVMError: Except caught from RPC call: [15:52:53] ../../3rdparty/dmlc-core/include/dmlc/json.h:731: Check failed: ch == '{' (49 vs. {) : Error at Line 0, around ^`2, `, Expect '{' but get '1'

What is target and target_host name iPad ?
Where I will get this target details?


#3

Hi @tqchen @KayneWest @srkreddy1238 @Laurawly @masahi any suggestion for my issue i am not able to figure it out.