I'm trying to load TensorFlow model(SavedModel
) to ML.NET and create an estimator with ML.NET.
I am loading the model without errors, but tensorFlowModel.ScoreTensorFlowModel
got Exception "System.MissingMethodException IntPtr Tensorflow.Status.op_Implicit(Tensorflow.Status)".
My code:
using Microsoft.ML;
var inputNodeName = "serving_default_dense_input";
var outputNodeName = "StatefulPartitionedCall_1";
var tensorFlowModel = mlContext.Model.LoadTensorFlowModel(@"model"); //model directory contains saved_model.pb file
var pipeline = tensorFlowModel.ScoreTensorFlowModel(new[] { outputNodeName },new[] { inputNodeName }, addBatchDimensionInput: false);
Installed NuGet packages:
ML.NET
SciSharp.TensorFlow.Redist
TensorFlow.NET
These packages are updated to the latest version.
I've run into this same error a few times and it's always been a mismatch between ML.NET and TensorFlow versions. I noticed you've included
SciSharp.TensorFlow.Redist
package and while there are probably tutorials that still mention using that later versions of ML.NET have a dependency onTensorFlow.NET >= 0.11.8.1
that seems to include the necessary files so that's not necessary and a likely cause of your problem.The other thing is while the dependency is >= 0.11.8.1 later versions of
TensorFlow.NET
can cause the the same problem as per this Github Issue so also check you haven't updated to a later version ofTensorFlow.NET
and if you have try reverting back to 0.11.8.1.