dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.05k stars 1.89k forks source link

InvalidOperationException: Invalid TValue in GetGetter: 'Microsoft.ML.Data.VBuffer`1[System.Single]' #4201

Closed gerjanvl closed 5 years ago

gerjanvl commented 5 years ago

System information

Packages

Microsoft.ML 1.4.0-preview Microsoft.ML.OnnxRuntime 0.5.0 Microsoft.ML.OnnxTransformer 1.4.0-preview

Issue

Source Code:

https://github.com/GerjanVlot/BERT-ML.NET

Callstack:

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.GenerateSetter(DataViewRow input, Int32 index, Column column, Delegate poke, Delegate peek)
   at Microsoft.ML.Data.TypedCursorable`1.TypedRowBase..ctor(TypedCursorable`1 parent, DataViewRow input, String channelMessage)
   at Microsoft.ML.Data.TypedCursorable`1.GetRow(DataViewRow input)
   at Microsoft.ML.PredictionEngineBase`2.PredictionEngineCore(IHostEnvironment env, InputRow`1 inputRow, IRowToRowMapper mapper, Boolean ignoreMissingColumns, SchemaDefinition outputSchemaDefinition, Action& disposer, IRowReadableAs`1& outputRow)
   at Microsoft.ML.PredictionEngineBase`2..ctor(IHostEnvironment env, ITransformer transformer, Boolean ignoreMissingColumns, SchemaDefinition inputSchemaDefinition, SchemaDefinition outputSchemaDefinition)
   at Microsoft.ML.PredictionEngineExtensions.CreatePredictionEngine[TSrc,TDst](ITransformer transformer, IHostEnvironment env, Boolean ignoreMissingColumns, SchemaDefinition inputSchemaDefinition, SchemaDefinition outputSchemaDefinition)
   at ML.BERT.TestApp.Onnx.OnnxModelConfigurator`1.GetMlNetPredictionEngine[T]() in ML.BERT.TestApp\Onnx\OnnxModelConfigurator.cs:line 34
   at ML.BERT.TestApp.Program.Main(String[] args) in ML.BERT.TestApp\Program.cs:line 22
gerjanvl commented 5 years ago

I got it working, The order of the columns matters and the main problem was it couldn't handle a variable column so I removed the output.

If you want to know what I changed. https://github.com/GerjanVlot/BERT-ML.NET/commit/9ad4cde1e17fe3244c43f23923f230e469127d9a