-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Onnx load model #5782
Onnx load model #5782
Conversation
@@ -348,7 +347,7 @@ public static OnnxModel CreateFromBytes(byte[] modelBytes) | |||
public static OnnxModel CreateFromBytes(byte[] modelBytes, int? gpuDeviceId = null, bool fallbackToCpu = false, | |||
IDictionary<string, int[]> shapeDictionary = null) | |||
{ | |||
var tempModelFile = Path.GetTempFileName(); | |||
var tempModelFile = Path.Combine(MLContext.TempFilePath, Path.GetRandomFileName()); |
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.
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.
If we add this, it should be internal
. We don't want to expose it publicly.
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.
Its a new random file path each time, so we probably wouldn't want it to be a property. I could add an internal method that returned that though.
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.
Added some minor comments. otherwise, LGTM.
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.
The new property shouldn't be static. We should change it to an instance property.
Codecov Report
@@ Coverage Diff @@
## main #5782 +/- ##
==========================================
+ Coverage 68.35% 68.40% +0.04%
==========================================
Files 1131 1131
Lines 241210 241203 -7
Branches 25039 25039
==========================================
+ Hits 164887 164989 +102
+ Misses 69819 69727 -92
+ Partials 6504 6487 -17
Flags with carried forward coverage won't be shown. Click here to find out more.
|
eef96f0
to
02bab82
Compare
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.
Yes, this is the direction I had in mind. A few more comments to fix, then after that I think this will be ready to be merged.
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
35ef427
to
0313706
Compare
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.
LGTM. Nice work here.
* fixed onnx temp model deleting * random file path fixed * updates from pr * Changes from PR comments. * Changed how auto ml caches. * PR fixes. * Update src/Microsoft.ML.AutoML/API/ExperimentSettings.cs Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> * Tensorflow fixes from PR comments * fixed filepath issues Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
…#5796) * Raised the limit of recursions in the creation of the CodedInputStream in the OnnxTransformer (as the default value in the Google.Protobuf). Otherwise some models cannot be loaded (ex. TF2 Efficentdet). * Updated arcade to the latest version (#5783) * updated arcade to the latest version * updated eng/common correctly * Fixed benchmark test. * Use dotnet certificate (#5794) * Use dotnet certificate * Update 3.1 SDK Co-authored-by: Prashanth Govindarajan <prgovi@microsoft.com> Co-authored-by: Michael Sharp <51342856+michaelgsharp@users.noreply.github.com> * Arm build changes (#5789) * arm testing * initial commit with build working on arm64 * windows changes * build fixes for arm/arm64 with cross compilation * cross build instructions added * renamed arm to Arm. Changed TargetArchitecture to default to OS architecture * fixed some formatting * fixed capitilization * fixed Arm Capitilization * Fix cross-compilation if statement * building on apple silicon * removed non build related files * Changes from PR comments. Removal of FastTreeNative flag. * Changes from pr comments. * Fixes from PR comments. * Changed how we are excluding files. * Onnx load model (#5782) * fixed onnx temp model deleting * random file path fixed * updates from pr * Changes from PR comments. * Changed how auto ml caches. * PR fixes. * Update src/Microsoft.ML.AutoML/API/ExperimentSettings.cs Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> * Tensorflow fixes from PR comments * fixed filepath issues Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> Co-authored-by: Michael Sharp <51342856+michaelgsharp@users.noreply.github.com> Co-authored-by: Matt Mitchell <mmitche@microsoft.com> Co-authored-by: Prashanth Govindarajan <prgovi@microsoft.com> Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Fixes #5766 and #5764 by letting the user specify a temp path location, which defaults to the current location to keep existing behavior, and by make sure the temp onnx model file gets cleaned up by opening it with a delete on close flag.