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

[Training] Convert to onnx with opset 16 but cannot find an implementation for operator Cos with opset 7. #19710

Closed
SunHaoOne opened this issue Feb 29, 2024 · 4 comments
Labels
training issues related to ONNX Runtime training; typically submitted using template

Comments

@SunHaoOne
Copy link

SunHaoOne commented Feb 29, 2024

Describe the issue

I have convert the onnx with opset 16, but cannot run it with ort. It said onnxruntime.capi.onnxruntime_pybind11_state.NotImplemented: [ONNXRuntimeError] : 9 : NOT_IMPLEMENTED : Could not find an implementation for Cos(7) node with name '/encoder/Cos'
I have provided more details in this issue. Could you please give me some ideas?

To reproduce

#19414

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.16.3

PyTorch Version

2.1.1+cu118

Execution Provider

Default CPU

Execution Provider Library Version

cu118

@SunHaoOne SunHaoOne added the training issues related to ONNX Runtime training; typically submitted using template label Feb 29, 2024
@baijumeswani
Copy link
Contributor

baijumeswani commented Feb 29, 2024

Are you able to share the onnx model?
Or if you're able to share the all the steps such that I can reproduce this on my end, I can take a deeper look.

@SunHaoOne
Copy link
Author

SunHaoOne commented Mar 1, 2024

Are you able to share the onnx model? Or if you're able to share the all the steps such that I can reproduce this on my end, I can take a deeper look.

Hi, @baijumeswani .Thanks for your reply, I update the onnx file here. By the way, the model can be successfully run by tensorRT.

@baijumeswani
Copy link
Contributor

baijumeswani commented Mar 1, 2024

I think the problem seems to be that the model is using Cos for inputs with types float64:

image

The problem is that onnxruntime has not defined a cpu kernel for Cos that takes in tensors of type double. See here.

Are you able to change your model to use float 32 inputs?

@SunHaoOne
Copy link
Author

The problem is that onnxruntime has not defined a cpu kernel for Cos that takes in tensors of type double. See here.

Are you able to change your model to use float 32 inputs?

Hi, @baijumeswani.
Thank you very much for your insightful suggestions. I have checked the inputs; they are float64, and if we change it to float32, it does not matter for my problems. So, when I exported the model to ONNX, I only needed to change the dummy_input type from float64 to float32, and it works. Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training issues related to ONNX Runtime training; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants