-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix conversion from split 11 to split 18. #6020
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6020 +/- ##
=======================================
Coverage 56.81% 56.82%
=======================================
Files 506 506
Lines 30370 30377 +7
Branches 4592 4592
=======================================
+ Hits 17256 17263 +7
Misses 12285 12285
Partials 829 829 ☔ View full report in Codecov by Sentry. |
There is a catch to this thing (which can be confusing): Split 11 implies (11, 12 ...) until a new version (13) is defined. In theory, we have 12->13, 17->18 already, which should be enough. From the issue it seems like the model is converted but turns out to be invalid. Looking at the issue and code https://github.com/ZelboK/onnx/blob/3160a050150cc5bc5232c96be3a1bbed5187a264/onnx/version_converter/adapters/split_17_18.h#L25 this line should have handled the situation when |
Ah I see, I figured there was context I lacked. My bad 😅 . Would reproducing this in a test be trivial? Looking at hte issue again I don't see the model anywhere. I need to familiarize myself with the code flow and see where it is going wrong. |
Justin is right. Version conversion is chained in this fashion.
It is not supposed to be |
From runing your script, this is what I get now @justinchuby. |
That would be good, but we have to maintain stable public apis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! 🙌
Could you check the DCO ci and sign off commits following its instructions? |
Woops! Forgot to do so. Will do now. |
Signed-off-by: Danial Javady <danialjavady96@gmail.com>
Signed-off-by: Danial Javady <danialjavady96@gmail.com>
…than returning a function that doesn't do it Signed-off-by: Danial Javady <danialjavady96@gmail.com>
Addresses onnx#5222 There does not exist a Split 12 from what I can see. I believe whomever made the conversion for Split 12 to Split 13 made a mistake and intended to do so for Split 11 to Split 13? IIUC, the conversions should chain. Running this with my built ONNX changes seems to work fine ``` >>> import onnx rt onnxruntime model = onnx.load('simple_model_split.onnx') model = onnx.version_converter.convert_version(model, 18) onnx.checker.check_model(model) # success sess = onnxruntime.InferenceSession(model.SerializeToString()) # fail>>> import onnxruntime >>> model = onnx.load('simple_model_split.onnx') >>> model = onnx.version_converter.convert_version(model, 18) >>> onnx.checker.check_model(model) # success >>> sess = onnxruntime.InferenceSession(model.SerializeToString()) # fail >>> >>> sess <onnxruntime.capi.onnxruntime_inference_collection.InferenceSession object at 0x7f82dcce0a30> >>> >>> import onnxruntime as rt >>> import numpy as np >>> model_serialized = model.SerializeToString() >>> sess = rt.InferenceSession(model_serialized) >>> dummy_input = np.random.randn(1, 1, 28, 28).astype(np.float32) Perfo>>> >>> outputs = sess.run(output_names=['output1', 'output2'], ... input_feed={'input': dummy_input}) >>> print(outputs) [array([[[[ 4.02100086e-01, 1.91692543e+00, 5.60453236e-01, ..., 1.10894358e+00, -9.10616279e-01, 2.63174176e-01], [ 9.16809678e-01, 8.39324117e-01, 1.30101681e+00, ..., -6.86384559e-01, 8.50693703e-01, -2.23367453e-01], [ 9.90843654e-01, 1.80581224e+00, -6.30877018e-01, ..., -4.17214930e-02, 9.42695260e-01, -9.54421163e-01], ``` Inferencing seems to work. I should remove the old split 12-> 13 converters but I would like confirmation from a contributor before I move forward. --------- Signed-off-by: Danial Javady <danialjavady96@gmail.com> Signed-off-by: isdanni <leedanni@gmail.com>
Addresses onnx#5222 There does not exist a Split 12 from what I can see. I believe whomever made the conversion for Split 12 to Split 13 made a mistake and intended to do so for Split 11 to Split 13? IIUC, the conversions should chain. Running this with my built ONNX changes seems to work fine ``` >>> import onnx rt onnxruntime model = onnx.load('simple_model_split.onnx') model = onnx.version_converter.convert_version(model, 18) onnx.checker.check_model(model) # success sess = onnxruntime.InferenceSession(model.SerializeToString()) # fail>>> import onnxruntime >>> model = onnx.load('simple_model_split.onnx') >>> model = onnx.version_converter.convert_version(model, 18) >>> onnx.checker.check_model(model) # success >>> sess = onnxruntime.InferenceSession(model.SerializeToString()) # fail >>> >>> sess <onnxruntime.capi.onnxruntime_inference_collection.InferenceSession object at 0x7f82dcce0a30> >>> >>> import onnxruntime as rt >>> import numpy as np >>> model_serialized = model.SerializeToString() >>> sess = rt.InferenceSession(model_serialized) >>> dummy_input = np.random.randn(1, 1, 28, 28).astype(np.float32) Perfo>>> >>> outputs = sess.run(output_names=['output1', 'output2'], ... input_feed={'input': dummy_input}) >>> print(outputs) [array([[[[ 4.02100086e-01, 1.91692543e+00, 5.60453236e-01, ..., 1.10894358e+00, -9.10616279e-01, 2.63174176e-01], [ 9.16809678e-01, 8.39324117e-01, 1.30101681e+00, ..., -6.86384559e-01, 8.50693703e-01, -2.23367453e-01], [ 9.90843654e-01, 1.80581224e+00, -6.30877018e-01, ..., -4.17214930e-02, 9.42695260e-01, -9.54421163e-01], ``` Inferencing seems to work. I should remove the old split 12-> 13 converters but I would like confirmation from a contributor before I move forward. --------- Signed-off-by: Danial Javady <danialjavady96@gmail.com> Signed-off-by: Linsho Kaku <linsho@preferred.jp>
Addresses #5222
There does not exist a Split 12 from what I can see. I believe whomever made the conversion for Split 12 to Split 13 made a mistake and intended to do so for Split 11 to Split 13?
IIUC, the conversions should chain. Running this with my built ONNX changes seems to work fine
Inferencing seems to work. I should remove the old split 12-> 13 converters but I would like confirmation from a contributor before I move forward.