-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MLContext.Model.Load overloads that take file path instead of stream. #3008
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 Report
@@ Coverage Diff @@
## master #3008 +/- ##
==========================================
- Coverage 72.35% 72.35% -0.01%
==========================================
Files 803 803
Lines 143295 143278 -17
Branches 16155 16155
==========================================
- Hits 103678 103664 -14
+ Misses 35191 35189 -2
+ Partials 4426 4425 -1
|
acbf668
to
b2a958c
Compare
/// </summary> | ||
/// <param name="stream">A readable, seekable stream to load from.</param> | ||
/// <returns>A model of type <see cref="CompositeDataLoader{IMultiStreamSource, ITransformer}"/> containing the loader | ||
/// and the transformer chain.</returns> | ||
public IDataLoader<IMultiStreamSource> Load(Stream stream) | ||
public IDataLoader<IMultiStreamSource> LoadDataLoader(Stream stream) |
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.
Should we make a similar change for the Save
method?
/// <summary>
/// Save the model to the file.
/// </summary>
/// <param name="model">The trained model to be saved.</param>
/// <param name="filePath">Path where model should be saved.</param>
public void Save<TSource>(IDataLoader<TSource> model, string filePath)
{
using (var stream = File.Create(filePath))
Save(model, stream);
}
These are no longer symmetric.
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 but this is Load API PR. I have created another PR to rename this for Save API #3019
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.
@eerhardt @TomFinley feels we shouldn't change for Save because in .Net we have ReadChar, ReadInt, ReadDouble, etc but Write() is just one loaded set of methods. Thoughts?
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 dont quite follow is there more discussion on github?
In reply to: 267100385 [](ancestors = 267100385)
/// </summary> | ||
/// <param name="modelPath">Path to model.</param> | ||
/// <param name="inputSchema">Will contain the input schema for the model. If the model was saved using older APIs | ||
/// it may not contain an input schema, in this case <paramref name="inputSchema"/> will be null.</param> |
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.
Is it worth calling out the behavior for older models having a null input schema? That should never be the case now right?
fixes #2991