-
Notifications
You must be signed in to change notification settings - Fork 235
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
Adds ONNX Surrogate support from OMLT #1308
Conversation
Likely want to refactor this later
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1308 +/- ##
=======================================
Coverage 77.43% 77.43%
=======================================
Files 390 392 +2
Lines 63758 63844 +86
Branches 11737 11749 +12
=======================================
+ Hits 49373 49440 +67
- Misses 11841 11852 +11
- Partials 2544 2552 +8 ☔ View full report in Codecov by Sentry. |
@avdudchenko @rundxdi should this be part of the next (now May) release? |
@avdudchenko @rundxdi now would be a good time to get this on the Aug release, if you can find a reviewer for it |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1308 +/- ##
==========================================
- Coverage 76.98% 76.98% -0.01%
==========================================
Files 382 384 +2
Lines 61913 61995 +82
Branches 10130 10136 +6
==========================================
+ Hits 47665 47728 +63
- Misses 11848 11859 +11
- Partials 2400 2408 +8 ☔ View full report in Codecov by Sentry. |
@avdudchenko, this is now on the Nov 2024 release board. Can progress be picked up on this now? |
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.
Finalizing my review -- looks good at this point
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.
I think the changes implemented here are good. Not critical to fix, there are a few places in the ONNX file that refer to "keras" instead of "onnx".
@avdudchenko Can you look at the test failures and see if they can be fixed? |
Fixes
This adds ONNX surrogate model object and slightly refactors the current Keras surrogate model to support multiple omlt model types.
Summary/Motivation:
Currently, if one generates a NN model using PyTorch, or any other method for use in IDAES and depended project (e.g. WaterTAP) we must export the model to ONNX format, and then to keras format to use in IDAES, which makes little sense.
This PR adds native support to onnx model format provided through OMLT.
Changes proposed in this PR:
-move out part of Keras functions into omlt_surrogate_base.py to enable simple support for multiple omlt import types
-adds ONNXSurrogate object that can load onnx model directly in IDAES flowsheet block
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: