-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
P0Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.
Description
If you have both OnnxSequenceType and ColumnName attributes on a property, ML.NET gets confused and throws an exception.
For example, if you pull the following code:
https://github.com/sethjuarez/SeeSharp/tree/c864892252880d4ef87006008823dee3b29adf9c
And change the ImagePrediction class to be:
public class ImagePrediction
{
[ColumnName("classLabel")]
[VectorType]
public string[] Prediction;
[ColumnName("loss")]
[OnnxSequenceType(typeof(IDictionary<string, float>))]
public IEnumerable<IDictionary<string, float>> Loss;
}
(You will also need to change 1 place in the Main method to change from output.loss.FirstOrDefault(); to output.Loss.FirstOrDefault(); from the rename.)
You get an error:
Unhandled Exception: System.ArgumentOutOfRangeException: Could not determine an IDataView type for member Loss
Parameter name: rawType
at Microsoft.ML.Data.InternalSchemaDefinition.GetVectorAndItemType(String name, Type rawType, IEnumerable`1 attributes, Boolean& isVector, Type& itemType)
at Microsoft.ML.Data.SchemaDefinition.Create(Type userType, Direction direction)
at Microsoft.ML.Data.TypedCursorable`1.Create(IHostEnvironment env, IDataView data, Boolean ignoreMissingColumns, SchemaDefinition schemaDefinition)
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 SeeSharp.Program.LoadModel(String onnxModelFilePath) in /Users/eerhardt/git/SeeSharp/SeeSharp/Program.cs:line 76
at SeeSharp.Program.Main(String[] args) in /Users/eerhardt/git/SeeSharp/SeeSharp/Program.cs:line 39
This should work. The program works if you remove the ColumnName attribute. And fails with the above as soon as you add the ColumnName attribute.
/cc @wschin
Metadata
Metadata
Assignees
Labels
P0Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.Priority of the issue for triage purpose: IMPORTANT, needs to be fixed right away.