You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/01/08 19:34:35 UTC
[GitHub] [incubator-tvm] trevor-m opened a new issue #4660: Unicode errors
using SaveJSON,
Base64 errors using LoadJSON on aarch64 only (works on x86_64)
trevor-m opened a new issue #4660: Unicode errors using SaveJSON, Base64 errors using LoadJSON on aarch64 only (works on x86_64)
URL: https://github.com/apache/incubator-tvm/issues/4660
The code snippet below gives the following error on aarch64 during the call to `save_json` (NVIDIA jetson xavier to be specific):
```
Traceback (most recent call last):
File "repro.py", line 35, in <module>
json_str = save_json(mod['main'])
File "/home/nvidia/trevor-tvm/python/tvm/api.py", line 171, in save_json
return _api_internal._save_json(node)
File "/home/nvidia/trevor-tvm/python/tvm/_ffi/_ctypes/function.py", line 210, in __call__
return RETURN_SWITCH[ret_tcode.value](ret_val)
File "/home/nvidia/trevor-tvm/python/tvm/_ffi/_ctypes/types.py", line 95, in <lambda>
TypeCode.STR: lambda x: py_str(x.v_str),
File "/home/nvidia/trevor-tvm/python/tvm/_ffi/base.py", line 46, in <lambda>
py_str = lambda x: x.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 202643: invalid start byte
```
I have also gotten the following error while deserializing using `LoadJSON`:
```
[bt] (3) /home/nvidia/trevor-tvm/build/libtvm.so(tvm::LoadJSON(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)+0x190) [0x7fa7c2da10]
[bt] (2) /home/nvidia/trevor-tvm/build/libtvm.so(tvm::runtime::NDArray::Load(dmlc::Stream*)+0x5d0) [0x7fa7c2ee68]
[bt] (1) /home/nvidia/trevor-tvm/build/libtvm.so(tvm::common::Base64InStream::Read(void*, unsigned long)+0x44c) [0x7fa7c2f88c]
[bt] (0) /home/nvidia/trevor-tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x4c) [0x7fa78de57c]
File "/home/nvidia/trevor-tvm/src/node/../common/base64.h", line 177
TVMError: Check failed: temp_ch_ == EOF || isspace(temp_ch_): invalid base64 format
```
The same exact code works fine on Intel x86_64. The error only happens when _bind_params is called. Commenting out the call to _bind_params allows everything to work fine, but I need to bind the params for my project.
```
import numpy as np
import tvm
from tvm import relay
from tvm.contrib import graph_runtime
import mxnet
from mxnet.gluon.model_zoo.vision import get_model
from tvm.api import save_json, load_json
input_shape = (1, 3, 224, 224)
block = get_model('resnet18_v1', pretrained=True)
mod, params = relay.frontend.from_mxnet(block, shape={'data': input_shape}, dtype='float32')
def _bind_params(func, params):
name_dict = {}
for arg in func.params:
name = arg.name_hint
if name in name_dict:
name_dict[name] = None
else:
name_dict[name] = arg
bind_dict = {}
for k, v in params.items():
if k not in name_dict:
continue
arg = name_dict[k]
if arg is None:
raise ValueError("Multiple args in the function have name %s" % k)
bind_dict[arg] = relay.expr.const(v)
return relay.expr.bind(func, bind_dict)
mod['main'] = _bind_params(mod['main'], params)
json_str = save_json(mod)
mod = load_json(json_str)
with relay.build_config(opt_level=3):
graph, lib, params = relay.build(mod, "cuda", params=params)
mod = graph_runtime.create(graph, lib, ctx=tvm.gpu(0))
mod.set_input(**params)
i_data = np.random.uniform(0, 1, input_shape).astype('float32')
for i in range(10):
mod.run(data=i_data)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] tqchen commented on issue #4660: Unicode,
Base64 errors using SaveJSON,
LoadJSON on constants with aarch64 only (works on x86_64)
Posted by GitBox <gi...@apache.org>.
tqchen commented on issue #4660: Unicode, Base64 errors using SaveJSON, LoadJSON on constants with aarch64 only (works on x86_64)
URL: https://github.com/apache/incubator-tvm/issues/4660#issuecomment-572313419
can you dig a bit into it? I feel it might be the problem of py_str and encoding issue
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] trevor-m commented on issue #4660: Unicode,
Base64 errors using SaveJSON,
LoadJSON on constants with aarch64 only (works on x86_64)
Posted by GitBox <gi...@apache.org>.
trevor-m commented on issue #4660: Unicode, Base64 errors using SaveJSON, LoadJSON on constants with aarch64 only (works on x86_64)
URL: https://github.com/apache/incubator-tvm/issues/4660#issuecomment-572332791
Sure, I will investigate it further
On Wed, Jan 8, 2020 at 3:49 PM Tianqi Chen <no...@github.com> wrote:
> can you dig a bit into it? I feel it might be the problem of py_str and
> encoding issue
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/incubator-tvm/issues/4660?email_source=notifications&email_token=ADDBJYXPPEQ7TPL572S5AHDQ4ZRAZA5CNFSM4KENPPSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIOM6SY#issuecomment-572313419>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADDBJYRJH2AV3Y4CWTHDPDTQ4ZRAZANCNFSM4KENPPSA>
> .
>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-tvm] tqchen closed issue #4660: Unicode,
Base64 errors using SaveJSON,
LoadJSON on constants with aarch64 only (works on x86_64)
Posted by GitBox <gi...@apache.org>.
tqchen closed issue #4660: Unicode, Base64 errors using SaveJSON, LoadJSON on constants with aarch64 only (works on x86_64)
URL: https://github.com/apache/incubator-tvm/issues/4660
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services