Describe the bug
I created a PredictionEnginePool in Program.cs as:
builder.Services.AddPredictionEnginePool<ModelOutput, ModelOutput>()
.FromUri( modelName: "YieldModel",
uri: "/MechPropertiesModels/YieldModel.zip",
period: TimeSpan.FromMinutes(10));
In my Controller, after setting up the DI (PredEnginePool), I had the following code:
IEnumerable yieldOut = sampleData.Select(input => PredEnginePool.Predict<ModelOutput, ModelOutput>(modelName: "Yield", example: input)).ToList();
When I run the code, the error was:
_System.ArgumentNullException: Value cannot be null. (Parameter 'poolOptions')
at Microsoft.Extensions.ML.PoolLoader2..ctor(IServiceProvider sp, PredictionEnginePoolOptions2 poolOptions)
at Microsoft.Extensions.ML.PredictionEnginePool2.AddPool(String modelName) at Microsoft.Extensions.ML.PredictionEnginePool2.GetPredictionEngine(String modelName)
at Microsoft.Extensions.ML.PredictionEnginePoolExtensions.Predict[TData,TPrediction](PredictionEnginePool`2 predictionEnginePool, String modelName, TData example)
at CTLWebApi.Controllers.MachineLearningController.b__11_1(ModelOutput input) in C:\Users\bart.lynn\source\repos\CTL Projects\CTLWebsiteNet\CTLWebApi\Controllers\MachineLearningController.cs:line 91
I realized after some time, I had 2 different names for the Model (YieldModel, and Yield). The error pointed to missing 'poolOptions'. I tried any different searches looking for that 'poolOptions' and after a while I noticed the model name differences.
To Reproduce
Steps to reproduce the behavior:
Name the model something in the Program.cs
Name the model something different in the Controller.
Run
See error
Expected behavior
Maybe it should say, Model:"Yield" was not found in the pool.
Screenshots, Code, Sample Projects
Code is provided above.
Describe the bug I created a PredictionEnginePool in Program.cs as: builder.Services.AddPredictionEnginePool<ModelOutput, ModelOutput>() .FromUri( modelName: "YieldModel", uri: "/MechPropertiesModels/YieldModel.zip", period: TimeSpan.FromMinutes(10));
In my Controller, after setting up the DI (PredEnginePool), I had the following code: IEnumerable yieldOut = sampleData.Select(input => PredEnginePool.Predict<ModelOutput, ModelOutput>(modelName: "Yield", example: input)).ToList();
When I run the code, the error was: _System.ArgumentNullException: Value cannot be null. (Parameter 'poolOptions') at Microsoft.Extensions.ML.PoolLoaderb__11_1(ModelOutput input) in C:\Users\bart.lynn\source\repos\CTL Projects\CTLWebsiteNet\CTLWebApi\Controllers\MachineLearningController.cs:line 91
2..ctor(IServiceProvider sp, PredictionEnginePoolOptions
2 poolOptions) at Microsoft.Extensions.ML.PredictionEnginePool2.AddPool(String modelName) at Microsoft.Extensions.ML.PredictionEnginePool
2.GetPredictionEngine(String modelName) at Microsoft.Extensions.ML.PredictionEnginePoolExtensions.Predict[TData,TPrediction](PredictionEnginePool`2 predictionEnginePool, String modelName, TData example) at CTLWebApi.Controllers.MachineLearningController.I realized after some time, I had 2 different names for the Model (YieldModel, and Yield). The error pointed to missing 'poolOptions'. I tried any different searches looking for that 'poolOptions' and after a while I noticed the model name differences.
To Reproduce Steps to reproduce the behavior:
Expected behavior Maybe it should say, Model:"Yield" was not found in the pool.
Screenshots, Code, Sample Projects Code is provided above.