-
Notifications
You must be signed in to change notification settings - Fork 106
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
How to populate onnx model with custom meta data map ? #214
Comments
The metadata information actually comes from onnxruntime. Could you file an issue with onnxruntime: https://github.com/microsoft/onnxruntime, they should be able to help you with this? |
@prabhat00155 I opened this in onnxruntime, and they want me to open here. The information comes from onnxruntime, but that needs to be set while converting the model to the ONNX format. In this use case, I am using sklearn to onnx converter, hence I opened this here. In my use case, I currently have a pickle file which carries some additional information. I would want to know if that could be serialized in the model itself using model metadatamap. Thanks |
@xadupre could clarify this. |
By the way, this is the issue reported in onnxruntime: microsoft/onnxruntime#1315. |
skl2onnx does not add any metadata but you can do it we module onnx once the model is converted. It is a list of key value pair where key and value are strings.
You need to do that after converting and before saving the ONNX model. |
Closing the issue. Feel free to reopen if the proposed solution does not fit your needs. |
Just to add supplemental information. If want to add more than two, one have to call meta = model_onnx.metadata_props.add()
meta.key = "key_meta_1"
meta.value = "value_meta_1"
meta = model_onnx.metadata_props.add()
meta.key = "key_meta_2"
meta.value = "value_meta_2" |
I have an array which I intend to append in the onnx file itself.
In my opninion, onnxruntime provides an option to retrieve custom meta data map/
from onnxruntime import InferenceSession
sess = InferenceSession(example)
meta = sess.get_modelmeta()
print("custom_metadata_map={}".format(meta.custom_metadata_map))
source - https://microsoft.github.io/onnxruntime/auto_examples/plot_metadata.html#sphx-glr-auto-examples-plot-metadata-py
However, it is always populated empty. My goal is to append some custom_metadata when I convert a scikit learn model to onnx which is available when the onnx is read by onnxruntime.
Please suggest if that is possible and how.
The text was updated successfully, but these errors were encountered: