-
Notifications
You must be signed in to change notification settings - Fork 233
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
[Good First Issue][NNCF]: Fixing NNCFGraph export for visualization in Netron #2552
Comments
.take |
Thank you for looking into this issue! Please let us know if you have any questions or require any help. |
Hi @andrey-churkin, The The Netron OpenVino frontend supports only the native OpenVino datatypes So we can choose to save the original An alternative solution would be to map the I think the first solution would be the correct one as it will allow to display of the correct data type in Netron, but this requires modifying all the Let me know your thoughts on this, so I can proceed with the implementation |
@DaniAffCH Hi |
I've just submitted the PR #2567 solving this issue |
### Changes This PR solves #2552 by fixing the Netron visualization. The function `save_for_netron` now produces an XML file that can be correctly opened by Netron. To achieve this, a dummy `dtype` conversion has been introduced, as discussed in #2552. This conversion maps the nncf dtype `Dtype.FLOAT` to `f32` and `DType.INTEGER` to `i32`. The `precision` parameter of the class `PortDesc` now is no longer optional as it's always available and it's necessary to produce a working XML file. In addition, I added a docstring for all the functions/classes and implemented tests for the following methods: - `get_graph_desc()` - `PortDesc.as_xml_element()` - `NodeDesc.as_xml_element()` - `EdgeDesc.as_xml_element()` ### Reason for changes <!--- Why should the change be applied --> It was not possible to open XML files produced by the function `save_for_netron` due to the error: `Error loading OpenVINO model. Unsupported precision 'undefined'` ### Related tickets N/A ### Tests To validate the accuracy of the modifications, I created Netron XML files from multiple ONNX models. The visualization of these models in Netron was successful, confirming the effectiveness of the changes.
@DaniAffCH Thanks for the contribution! |
Context
Neural Network Compression Framework (NNCF) uses an instance of
NNCFGraph
class to represent a framework-specific deep learning model. An instance ofNNCFGraph
class is used in almost every algorithm and serves as the primary means to obtain information about deep learning model.It is very beneficial to have a way to visualize such graph. One possible way to visualize it is by using a
.dot
file.Please see
visualize_graph()
method:nncf/nncf/common/graph/graph.py
Lines 565 to 567 in 481ce9d
The main disadvantage of this approach is that it is very difficult to analyze a
.dot
file for very large models. It is better to use Netron. We already have a method that allows us to export an instance of theNNCFGraph
class to a format supported by Netron. Actually, we export NNCFGraph to the OpenVINO IR format. Please see OpenVINO IR format specification. We save only the topology (.XML
file).Please follow the following code snippet to understand how to save
NNCFGraph
for visualization in NetronWhat needs to be done?
graph.xml
in Netron. The main task is to resolve this problem by fixing the export. Netron returns the following error: Error loading OpenVINO model. Unsupported precision 'undefined'get_graph_desc()
,save_for_netron()
) and classes (PortDesc
,NodeDesc
,EdgeDesc
) insidenncf.experimental.common.graph.netron
moduleget_graph_desc()
PortDesc.as_xml_element()
NodeDesc.as_xml_element()
EdgeDesc.as_xml_element()
Example Pull Requests
N/A
Resources
Contact points
@andrey-churkin @alexsu52
Ticket
N/A
The text was updated successfully, but these errors were encountered: