Skip to content
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 MLContext.Model.Load overload that takes a file path #2983

Closed
eerhardt opened this issue Mar 15, 2019 · 3 comments · Fixed by #2991
Closed

Add MLContext.Model.Load overload that takes a file path #2983

eerhardt opened this issue Mar 15, 2019 · 3 comments · Fixed by #2991
Assignees

Comments

@eerhardt
Copy link
Member

Today, the only way to load a model is by using a Stream:

/// <summary>
/// Load the model from the stream.
/// </summary>
/// <param name="stream">A readable, seekable stream to load from.</param>
/// <returns>The loaded model.</returns>
public ITransformer Load(Stream stream) => TransformerChain.LoadFrom(_env, stream);

We should add an overload that takes a string filePath as a convenience API over top of this. That way all the callers don't need to open a FileStream and dispose of it, etc, just to load a model.

@TomFinley @CESARDELATORRE @sfilipi @shauheen

@codemzs codemzs self-assigned this Mar 15, 2019
@codemzs
Copy link
Member

codemzs commented Mar 15, 2019

You have my full support!

@CESARDELATORRE
Copy link
Contributor

And of course you have my full support, too. :)
I opened an issue related to this topic in Nov. 2018:

#1689

This change will make the code a lot cleaner!
:)

@glebuk
Copy link
Contributor

glebuk commented Mar 18, 2019

Sounds great. Also todo in this issue:

  • Ensure to have a file overload for both load and save model methods
  • Update samples to use the overload when loading/saving from file.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants