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

ValidationError for ONNX exported model #3013

Closed
jo7ueb opened this issue Mar 6, 2018 · 2 comments
Closed

ValidationError for ONNX exported model #3013

jo7ueb opened this issue Mar 6, 2018 · 2 comments
Assignees
Labels

Comments

@jo7ueb
Copy link

jo7ueb commented Mar 6, 2018

Hi, I'm evaluating ONNX export feature.

I tried to export ResNet20 into ONNX file.
save function worked well but onnx.checker.check_model raises following error.

Traceback (most recent call last):
  File "cntk2onnx.py", line 19, in <module>
    onnx.checker.check_model(onnx_model)
  File "/usr/local/lib/python3.5/dist-packages/onnx/checker.py", line 32, in checker
    proto.SerializeToString(), ir_version)
onnx.onnx_cpp2py_export.checker.ValidationError: Field 'type' of attr is required but missing.

==> Context: Bad node spec: output: "Parameter5454" name: "Parameter5454" op_type: "Constant" attribute { name: "value" t { dims: 1 dims: 10 data_type: FLOAT float_data: -0.070361428 float_data: -0.357194 float_data: 0.37219584 float_data: 0.47041565 float_data: 0.071708754 float_data: -0.092652842 float_data: -0.015438936 float_data: -0.084205344 float_data: -0.074094325 float_data: -0.22061794 } } doc_string: "" domain: ""

Here's my evaluation code.

import argparse
import cntk as C
import onnx

parser = argparse.ArgumentParser(description='Convert CNTK model to ONNX')
parser.add_argument('--input',  '-i', required=True, type=str)
parser.add_argument('--output', '-o', required=True, type=str)
args = parser.parse_args()

# obtain PyTorch model
model = C.Function.load(args.input, device=C.device.cpu())

# export to ONNF
print('converting to ONNX')
model.save(args.output, format=C.ModelFormat.ONNX)

print('checking converted model')
onnx_model = onnx.load(args.output)
onnx.checker.check_model(onnx_model)

It looks like CNTK's fault.

Thanks.

@jo7ueb jo7ueb changed the title Bad node spec for ONNX exported model ValidationError for ONNX exported model Mar 6, 2018
@ke1337 ke1337 added the bug label Mar 6, 2018
@spandantiwari
Copy link
Contributor

Yes, this is a known issue. We will be fixing this soon. Stay tuned.

@spandantiwari
Copy link
Contributor

This has been fixed in CNTK 2.5. Please give it a try again and report any issues.

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

No branches or pull requests

3 participants