-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
P1Priority of the issue for triage purpose: Needs to be fixed soon.Priority of the issue for triage purpose: Needs to be fixed soon.bugSomething isn't workingSomething isn't workingloadsaveBugs related loading and saving data or modelsBugs related loading and saving data or models
Description
We would like to be able to load multiple models from disk on startup, then infer against them without having to reload from disk each pass.
If I try to keep 2 models in memory at the same time, I get an error if not calling against the last one initialized from disk.
i.e. this works - only including code needed to generate the error:
MLContext context = new MLContext();
TensorFlowModel model1 = context.Model.LoadTensorFlowModel("Model1");
TensorFlowEstimator estimator1 = model1.ScoreTensorFlowModel("serving_default_input_1", "StatefulPartitionedCall");
TensorFlowModel model2 = context.Model.LoadTensorFlowModel("Model2");
TensorFlowEstimator estimator2 = model2.ScoreTensorFlowModel("serving_default_input_1", "StatefulPartitionedCall");
but this throws an error like "Tensorflow.RuntimeError: 'Current graph is not default graph":
MLContext context = new MLContext();
TensorFlowModel model1 = context.Model.LoadTensorFlowModel("Model1");
TensorFlowModel model2 = context.Model.LoadTensorFlowModel("Model2");
TensorFlowEstimator estimator1 = model1.ScoreTensorFlowModel("serving_default_input_1", "StatefulPartitionedCall");
TensorFlowEstimator estimator2 = model2.ScoreTensorFlowModel("serving_default_input_1", "StatefulPartitionedCall");
I guess we could roll our own process to load from disk to stream 1x, then call context.Model.Load() but that still smells wrong - we're still initializing the model over and over just avoiding disk calls. Is this a bug or are we doing something wrong?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1Priority of the issue for triage purpose: Needs to be fixed soon.Priority of the issue for triage purpose: Needs to be fixed soon.bugSomething isn't workingSomething isn't workingloadsaveBugs related loading and saving data or modelsBugs related loading and saving data or models