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

Issues when converting model to float16 #208

Closed
toothache opened this issue Mar 8, 2022 · 3 comments
Closed

Issues when converting model to float16 #208

toothache opened this issue Mar 8, 2022 · 3 comments

Comments

@toothache
Copy link
Member

Some issues observed when converting model to float16:

  • When converting model with keep_io_types set to True, onnx.checker will complain:
    onnx.onnx_cpp2py_export.checker.ValidationError: Nodes in a graph must be topologically sorted,
    
    The fix would be fairly simple, inserting the Cast operator for input tensors to the beginning of node list.
  • Some operators (e.g., Resize, CumSum) support float16, however it's listed in DEFAULT_OP_BLOCK_LIST:
    • Should we update this list or auto generated from onnx opschema?
    • For operator like Resize, some of the optional inputs doesn't support float16. We need exclude fp16 conversion to them.
@xiaowuhu
Copy link
Collaborator

@toothache does this issue still existed?

@1615070057
Copy link

Hi, I also encountered the same problem, The fix would be fairly simple, inserting the Cast operator for input tensors to the beginning of node list. How should I do it, thanks!

@1615070057
Copy link

1615070057 commented Aug 18, 2023

The onnx.checker verification is successful, but the onnxruntime loading model reports an error: onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from model_fp16.onnx failed:This is an invalid model. Type Error: Type 'tensor(float16 )' of input parameter (const_empty_float__132) of operator (Resize) in node (Resize__139) is invalid.

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

3 participants