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

Can't convert model using custom operations #18713

Closed
Satmaks opened this issue Jul 21, 2023 · 7 comments
Closed

Can't convert model using custom operations #18713

Satmaks opened this issue Jul 21, 2023 · 7 comments
Assignees
Labels
category: extensions OpenVINO Extensibility Mechanism for custom operations category: ONNX FE OpenVINO ONNX FrontEnd support_request

Comments

@Satmaks
Copy link

Satmaks commented Jul 21, 2023

  • OpenVINO Source => Runtime /pip install / GitHub
  • OpenVINO Version => tag 2023.0
  • Operating System / Platform => Ubuntu 18/20
  • Compiler => Cmake
  • Problem classification: Model Conversion
  • Device use: CPU
  • Framework: PyTorch
Detailed description

Guys, I spent several days on this, read the documentation several times, I really hope for your help, please help, what am I doing wrong?

Previously, I used version 2020.3.0 and in order to make my model work with a custom operation, I patched OpenVINO like this:
aecc8a71be73e5b928c343cef869fa81c04a1c9d.zip

Now, for version 2023.0.0, I first need to convert the model with a custom operation, and then use the inference of the model.

  1. I installed openvino-runtime. (Please reopen my other question).

  2. I built the module as written here. I did as written here.
    Source code of my module:
    srelu.zip
    Please tell me if everything is correct at this stage? Is this the same as what I wrote for version 2020.3.0?

  3. To convert the model, I use the model optimizer via the Python API and get the error:

Traceback (most recent call last):                                                                                                                                                                                                                                                        
  File "....py", line 116, in main                                                                                                                                                                                  
    ov_model = convert_model(input_model=onnx_path, use_new_frontend=True, compress_to_fp16=True, static_shape=True, extensions="libopenvino_srelu_extension.so")                                                                                              
  File ".../.env3/lib/python3.9/site-packages/openvino/tools/mo/convert.py", line 348, in convert_model                                                                                                                               
    ov_model, _ = _convert(cli_parser, framework, params, True)                                                                                                                                                                                                                           
  File ".../.env3/lib/python3.9/site-packages/openvino/tools/mo/convert_impl.py", line 972, in _convert                                                                                                                               
    raise e.with_traceback(None)                                                                                                                                                                                                                                                          
RuntimeError: Check 'false' failed at src/frontends/onnx/frontend/src/core/graph.cpp:378:                                                                                                                                                                                                 
While validating ONNX node '<Node(SRelu): 156>':                                                                                                                                                                                                                                          
Check 'false' failed at /opt/intel/openvino_2023.0.0/runtime/include/openvino/frontend/extension/op.hpp:214:                                                                                                                                                                              
Check 'data != nullptr' failed at /opt/intel/openvino_2023.0.0/runtime/include/openvino/core/attribute_adapter.hpp:112:                                                                                                                                                                   
Data conversion is not possible. Empty data is provided.                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                          
Value for attribute "threshold_right" is not set or mapping between framework and openvino node attributes is incorrect.

Since I did not understand if I wrote the module in point 2 correctly, I removed these lines:

visitor.on_attribute("threshold_right", weights_threshold_right_);
visitor.on_attribute("slope_right", weights_slope_right_);
visitor.on_attribute("threshold_left", weights_threshold_left_);
visitor.on_attribute("slope_left", weights_slope_left_);

I was able to convert the model, but where do I get these arguments now? I assume that I deleted these lines in vain, initially I did everything right, but why does the error occur in poin 3? Help me please.

@Satmaks Satmaks added bug Something isn't working support_request labels Jul 21, 2023
@Jay-sanjay
Copy link

Hey , I think the error occurred because you deleted the certain lines of code related to attributes in the module

@Jay-sanjay
Copy link

I think to resolve that issue you might need to restore those lines of code
in the custom operation module and rebuild it.

@Satmaks
Copy link
Author

Satmaks commented Jul 23, 2023

@Jay-sanjay Hello, I think so too, but I get this error:

Traceback (most recent call last):                                                                                                                                                                                                                                                        
  File "....py", line 116, in main                                                                                                                                                                                  
    ov_model = convert_model(input_model=onnx_path, use_new_frontend=True, compress_to_fp16=True, static_shape=True, extensions="libopenvino_srelu_extension.so")                                                                                              
  File ".../.env3/lib/python3.9/site-packages/openvino/tools/mo/convert.py", line 348, in convert_model                                                                                                                               
    ov_model, _ = _convert(cli_parser, framework, params, True)                                                                                                                                                                                                                           
  File ".../.env3/lib/python3.9/site-packages/openvino/tools/mo/convert_impl.py", line 972, in _convert                                                                                                                               
    raise e.with_traceback(None)                                                                                                                                                                                                                                                          
RuntimeError: Check 'false' failed at src/frontends/onnx/frontend/src/core/graph.cpp:378:                                                                                                                                                                                                 
While validating ONNX node '<Node(SRelu): 156>':                                                                                                                                                                                                                                          
Check 'false' failed at /opt/intel/openvino_2023.0.0/runtime/include/openvino/frontend/extension/op.hpp:214:                                                                                                                                                                              
Check 'data != nullptr' failed at /opt/intel/openvino_2023.0.0/runtime/include/openvino/core/attribute_adapter.hpp:112:                                                                                                                                                                   
Data conversion is not possible. Empty data is provided.                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                          
Value for attribute "threshold_right" is not set or mapping between framework and openvino node attributes is incorrect.

I don't understand why this is happening.

@avitial avitial added category: MO Model Optimizer and removed bug Something isn't working labels Jul 25, 2023
@andrei-kochin andrei-kochin added category: ONNX FE OpenVINO ONNX FrontEnd category: extensions OpenVINO Extensibility Mechanism for custom operations and removed category: MO Model Optimizer labels Aug 4, 2023
@avitial
Copy link
Contributor

avitial commented Aug 28, 2023

@gkrivor gentle ping.

Copy link
Contributor

This issue will be closed in a week because of 9 months of no activity.

@andrei-kochin
Copy link
Contributor

@Satmaks hello! Sorry for the long delay

Is this issue still actual for you?

@avitial
Copy link
Contributor

avitial commented Oct 3, 2024

Closing this as it seems issue is no longer actual. Feel free to reopen and ask additional questions related to this topic if the issue persists.

@avitial avitial closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: extensions OpenVINO Extensibility Mechanism for custom operations category: ONNX FE OpenVINO ONNX FrontEnd support_request
Projects
None yet
Development

No branches or pull requests

7 participants