Skip to content

[1.0.0-preview] Bug? - Getting an exception while loading .ZIP model MultiClass-Classification trained with SdcaNonCalibrated #3209

Closed
@prathyusha12345

Description

@prathyusha12345

I am trying to migrate IRIS Classification sample in the repo here to v1.0.0-preview.

While loading the model for prediction I am getting the below error at the statement

            trainedModel = mlContext.Model.Load(stream, out var modelInputSchema);
System.InvalidOperationException
  HResult=0x80131509
  Message=Error during class instantiation
  Source=Microsoft.ML.Core
  StackTrace:
   at Microsoft.ML.Runtime.ComponentCatalog.LoadableClassInfo.CreateInstanceCore(Object[] ctorArgs)
   at Microsoft.ML.Runtime.ComponentCatalog.TryCreateInstance[TRes](IHostEnvironment env, Type signatureType, TRes& result, String name, String options, Object[] extra)
   at Microsoft.ML.Runtime.ComponentCatalog.TryCreateInstance[TRes,TSig](IHostEnvironment env, TRes& result, String name, String options, Object[] extra)
   at Microsoft.ML.ModelLoadContext.TryLoadModelCore[TRes,TSig](IHostEnvironment env, TRes& result, Object[] extra)
   at Microsoft.ML.ModelLoadContext.TryLoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, Entry ent, String dir, Object[] extra)
   at Microsoft.ML.ModelLoadContext.LoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, Entry ent, String dir, Object[] extra)
   at Microsoft.ML.ModelLoadContext.LoadModelOrNull[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, String dir, Object[] extra)
   at Microsoft.ML.ModelLoadContext.LoadModel[TRes,TSig](IHostEnvironment env, TRes& result, RepositoryReader rep, String dir, Object[] extra)
   at Microsoft.ML.ModelOperationsCatalog.Load(Stream stream, DataViewSchema& inputSchema)
   at MulticlassClassification_Iris.Program.TestSomePredictions(MLContext mlContext) in C:\GitRepos\machinelearning-samples-v1.0.0-Preview\samples\csharp\getting-started\MulticlassClassification_Iris\IrisClassification\IrisClassificationConsoleApp\Program.cs:line 99
   at MulticlassClassification_Iris.Program.Main(String[] args) in C:\GitRepos\machinelearning-samples-v1.0.0-Preview\samples\csharp\getting-started\MulticlassClassification_Iris\IrisClassification\IrisClassificationConsoleApp\Program.cs:line 36

Inner Exception 1:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 2:
InvalidOperationException: Error during class instantiation

Inner Exception 3:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 4:
InvalidOperationException: Error during class instantiation

Inner Exception 5:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 6:
FormatException: Couldn't load model: 'TransformerChain\Transform_002\Transform_000\Model'

the dataset format is like this

#Label	Sepal length	Sepal width	Petal length	Petal width
0	5.4	3.7	1.5	0.2
0	4.8	3.4	1.6	0.2
0	4.8	3.0	1.4	0.1
0	4.3	3.0	1.1	0.1

I have pushed the code to the Github repo here https://github.com/dotnet/machinelearning-samples/tree/migration/1.1.0-preview/samples/csharp/getting-started/MulticlassClassification_Iris

I did not understand the reason for the error. Could anyone help

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions