mxnet转onnx 之 onnx_mxnet.export_model失败原因

mxnet模型转换onnx折腾了很久,终于搞清楚失败原因

转换代码参考: https://github.com/onnx/tutorials/blob/master/tutorials/MXNetONNXExport.ipynb

 

一开始的环境:

  • windows 10
  • visual studio 2019
  • python37
  • mxnet==1.4.1

pip install onnx 安装的是最新的1.6.0版本 

运行到 “onnx_mxnet.export_model” 这一句代码的时候 提示invalid *** array,然后就不能转换了

mxnet.base.MXNetError: [10:25:05] C:\Jenkins\workspace\mxnet-tag\mxnet\src\ndarray\ndarray.cc:1805: Check failed: fi->Read(data) Invalid NDArray file format

好嘛, 我查资料说是onnx1.2.1版本可以转换成功,(也有说1.2.2,1.3.0都可以的) pip install onnx==1.2.1竟然失败

好,我源码安装,参考https://github.com/onnx/onnx/readme.md 一样失败 源码折腾了近两天啊

 

要疯了

 

终于找到资料这么说的:

Hi thanks for reporting this. It looks like you are build onnx for python2.7 using vc9.0. We highly suggested you switch to python3.5/6 on Windows because 1)onnx is developed with c++11 standard so dated VC cannot support some functions. 2) if using new VC (can do it in a conda3.5/6 with a py2.7 environment), there could be potential CRT libs mismatch in later uses or development (python 2.7 on windows is made with dated VC). it may cause more problem later.

这个人的问题(https://github.com/onnx/onnx/issues/936)跟我的不太一样,但是它提醒了我,我的vc版本和python版本过高

 

更新后的环境:

  • windows 10
  • visual studio 2017
  • python36
  • mxnet==1.4.1
  • onnx==1.2.1  (pip install onnx==1.2.1)

安装成功了

 

运行提示:

[10:20:49] C:\Jenkins\workspace\mxnet-tag\mxnet\src\ndarray\ndarray.cc:1805: Check failed: fi->Read(data) Invalid NDArray file format

错误一样

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值