-
Notifications
You must be signed in to change notification settings - Fork 3k
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
add load from buffer #10162
add load from buffer #10162
Conversation
…o jingf/add-LoadFromBuffer
TODO: still need to add tests |
@@ -104,22 +104,42 @@ namespace ROOT_NS.AI.MachineLearning | |||
//! Loads an ONNX model from a stream asynchronously. | |||
[remote_async] | |||
static Windows.Foundation.IAsyncOperation<LearningModel> LoadFromStreamAsync(Windows.Storage.Streams.IRandomAccessStreamReference modelStream); | |||
//! Loads an ONNX model from a buffer asynchronously. |
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.
curious what you think about grouping all of these into one (MachineLearningContract, 6) block instead of having four of them?
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.
Yeah technically I don't have problem with that, just thought it might make more sense to keep them together within their own group
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.
Remember that this needs an associated change in the OS repo as well.
This reverts commit 5cd57bb.
This reverts commit 5cd57bb.
Description: Add LoadFromBuffer API for LearningModel
Motivation and Context
Currently, to load a model for inferencing, developers are given 2 options:
However, neither LoadFromFilePath nor LoadFromStream method work well in VTL1 scenario. LoadFromFilePath would fail because VTL1 restricts file access to ensure a more secure trust level than the normal VTL0. LoadFromStream loads extra WinRT dependencies that are either not IUM signed or are not VTL1 registered COM components; on the other hand, LoadFromStream also makes several unnecessary model copies throughout the method call, heavily impacting performance when loading large models.
The proposed LoadFromBuffer method solves the above issues by not accessing the file system, avoiding loading unnecessary winrt dependencies, and making no extra model copies, making Windows Machine Learning one step closer to VTL1 ready