Toybrick

RKNN-tools 1.4 转 pytorch模型 报错 

RK用户

中级会员

积分
218
楼主
发表于 2020-10-14 17:25:02    查看: 7095|回复: 1 | [复制链接]    打印 | 只看该作者
以下是报错信息

--> config model
done
--> Loading model
/home/maple/anaconda3/lib/python3.6/site-packages/onnx_tf/common/__init__.py:87: UserWarning: FrontendHandler.get_outputs_names is deprecated. It will be removed in future release.. Use node.outputs instead.
  warnings.warn(message)
./resnet_car.pt ********************
WARNING: Token 'COMMENT' defined, but not used
WARNING: There is 1 unused token
Syntax error in input! LexToken(NAMED_IDENTIFIER,'str',7,340)
!!!!! Illegal character '"'
!!!!! Illegal character '-'
!!!!! Illegal character '"'
!!!!! Illegal character '"'
E Catch exception when loading pytorch model: ./resnet_car.pt!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 611, in rknn.api.rknn_base.RKNNBase.load_pytorch
E   File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 97, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
E   File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 570, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.__init__
E   File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 641, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.model_simplify
E   File "/home/maple/anaconda3/lib/python3.6/site-packages/torch/tensor.py", line 412, in __array__
E     return self.numpy()
E TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Load pytorch model failed!
模型转换跟cuda有什么关系?

回复

使用道具 举报

RK用户

中级会员

积分
218
沙发
 楼主| 发表于 2020-10-15 09:42:30 | 只看该作者
张量输入不能Tensor.to(device),创建tensor后直接torch.jit.trace
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表