System Information (please complete the following information):
- OS & Version: [e.g. Windows 10]
- ML.NET Version: [e.g. ML.NET v1.6]
- .NET Version: [e.g. .NET 5.0]
Describe the bug
In the PredictionEngineBase Dispose(), a call to ITransformer.Dispose() is made, making it impossible to use a cached model to perform predictions when creating the predictionengine in a using-statement. See line 142 -> https://github.com/dotnet/machinelearning/blob/main/src/Microsoft.ML.Data/Prediction/PredictionEngine.cs
To Reproduce
Steps to reproduce the behavior:
- Load your model into a global variable (simulate a cache).
- Create a method where you create a predictionEngine in a using-statement and call Predict()
- The second time you call that method, an AccessViolationException will be thrown due to the 'cached' model being disposed as well upon disposing the predictionEngine.
Expected behavior
The ITransformer.Dispose() is not being called inside the Dispose() of PredictionEngineBase.
System Information (please complete the following information):
Describe the bug
In the PredictionEngineBase Dispose(), a call to ITransformer.Dispose() is made, making it impossible to use a cached model to perform predictions when creating the predictionengine in a using-statement. See line 142 -> https://github.com/dotnet/machinelearning/blob/main/src/Microsoft.ML.Data/Prediction/PredictionEngine.cs
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The ITransformer.Dispose() is not being called inside the Dispose() of PredictionEngineBase.