Skip to content

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

@eerhardt

Description

@eerhardt

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions