Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Mindspore内部,紧急】Onnx转Mindspore问题 #14

Open
NoOneUST opened this issue Jul 10, 2022 · 0 comments
Open

【Mindspore内部,紧急】Onnx转Mindspore问题 #14

NoOneUST opened this issue Jul 10, 2022 · 0 comments

Comments

@NoOneUST
Copy link

很抱歉叨扰您了~可是真的很紧急。
我先将一个Pytorch模型转成了Onnx(OpSet 11)并且验证过了等价性,但是现在我在无法用Mindconveter将Onnx转为Mindspore模型和权重。

我用于将Pytorch模型转为Onnx的代码:

image

直接将生成的Onnx转为Mindspore遇到Simplifying问题:
image

尝试将Onnx先进行优化:
image

优化后再用Mindconverter转换提示Operator不支持:
image

输出文件夹里没有权重和模型:
image

操作符扫描报告内容:
operator_name, count, status
onnx::Reshape, 261, Supported
onnx::Gather, 174, Supported
onnx::Mul, 99, Supported
onnx::Conv, 277, Supported
onnx::Transpose, 96, Supported
onnx::Squeeze, 2, Supported
onnx::Relu, 155, Supported
onnx::Div, 179, Supported
onnx::Slice, 341, Supported
onnx::Expand, 2, Unsupported
onnx::MatMul, 42, Supported
onnx::Add, 206, Supported
onnx::CumSum, 2, Supported
onnx::Tile, 4, Unsupported
onnx::Neg, 44, Supported
onnx::Concat, 70, Supported
onnx::Greater, 45, Supported
onnx::Not, 45, Supported
onnx::Where, 126, Supported
onnx::Sub, 90, Supported
onnx::ScatterND, 84, Unsupported
onnx::ConvTranspose, 26, Supported
onnx::Unsqueeze, 27, Supported
onnx::Pow, 27, Supported
onnx::GridSample, 42, Unsupported
onnx::ReduceSum, 72, Supported
onnx::5598, 1, Unsupported
onnx::5601, 1, Unsupported
onnx::5604, 1, Unsupported
onnx::5607, 1, Unsupported
onnx::5610, 1, Unsupported
onnx::5613, 1, Unsupported
onnx::5616, 1, Unsupported
onnx::Softmax, 24, Supported
onnx::Clip, 23, Supported
onnx::Log, 21, Supported
onnx::Exp, 21, Supported
onnx::5619, 1, Unsupported
onnx::Resize, 2, Supported
onnx::Abs, 3, Supported
onnx::Cast, 3, Supported
onnx::ReduceMean, 3, Supported
onnx::4244, 1, Unsupported
onnx::4247, 1, Unsupported
onnx::4250, 1, Unsupported
onnx::4253, 1, Unsupported
onnx::4256, 1, Unsupported
onnx::4259, 1, Unsupported
onnx::4262, 1, Unsupported
onnx::4265, 1, Unsupported
onnx::4268, 1, Unsupported
onnx::4271, 1, Unsupported
onnx::4274, 1, Unsupported
onnx::4277, 1, Unsupported
onnx::4280, 1, Unsupported
onnx::4283, 1, Unsupported
onnx::4286, 1, Unsupported
onnx::4289, 1, Unsupported

如果我在Pytorch文件里直接转:
image

报错4000000:
ldd: warning: you do not have execution permission for /export/data/lwangcg/anaconda3/lib/python3.7/site-packages/mindspore/run_check/../_c_expression.cpython-37m-x86_64-linux-gnu.so' ldd: warning: you do not have execution permission for /export/data/lwangcg/anaconda3/lib/python3.7/site-packages/mindspore/run_check/../_c_expression.cpython-37m-x86_64-linux-gnu.so'
[INFO] MI(190315:140408814913344,MainProcess):2022-07-11-03:14:47.696.105 [MINDCONVERTER] Pytorch model loading begins.
[ERROR] MI(190315:140408814913344,MainProcess):2022-07-11-03:14:47.696.692 [MINDCONVERTER] Failed to trace pytorch model to graph.
[ERROR] MI(190315:140408814913344,MainProcess):2022-07-11-03:14:47.699.808 [MINDCONVERTER] [SubGraphSearchingError] code: 4000000, msg: module 'torch.onnx.utils' has no attribute '_unique_state_dict'
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
[WARNING] MI(190315:140408814913344,MainProcess):2022-07-11-03:14:51.074.040 [MINDCONVERTER] For command line, libraries mindspore(>=1.2.0), onnx(>=1.8.0), onnxruntime(>=1.5.2) and onnxoptimizer(>=0.1.2) are required by converter, tensorflow(>=1.15.0) and tf2onnx(>=1.7.1) are required when converted from TF(.pb). For API, libraries mindspore(>=1.2.0) and torch(==1.8.2) are required. Current versions are: mindspore(==1.7.0), onnx(==1.12.0), onnxruntime(==1.11.1), onnxoptimizer(==0.2.7), tensorflow(==1.14.0), tf2onnx(==NotFound), mindspore(==1.7.0) and torch(==1.12.0+cu113).
Process finished with exit code 255

这就是我现在面对的问题的情况了,请问我应该如何操作以将Onnx或者我的Pytorch模型转为Mindspore?非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant