System Information (please complete the following information):
OS & Version: Windows 11 Pro 23H2 build 22631.3235
ML.NET Version: ML.NET version 3.0.1
.NET Version: .NET 8.0
Describe the bug
System.AccessViolationException
HResult=0x80004003
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
To Reproduce
Steps to reproduce the behavior:
Make a console app project
Install following packages with NuGet Package Manager:
Microsoft.ML Version 3.0.1
Microsoft.ML.AutoML Version 0.21.1
Microsoft.ML.CpuMath Version 3.0.1
Microsoft.ML.DataView Version 3.0.1
Microsoft.ML.FastTree Version 3.0.1
Microsoft.ML.LightGbm Version 3.0.1
Microsoft.ML.Mkl.Compreonents Version 3.0.1
Microsoft.ML.Mkl.Redist Version 3.0.1
Edit Program.cs:
using Microsoft.ML;
using Microsoft.ML.AutoML;
using Microsoft.ML.Data;
using static Microsoft.ML.DataOperationsCatalog;
MLContext mlContext;
string sampleData = "taxi-fare-full.csv";
mlContext = new MLContext();
var regressionMetric = RegressionMetric.RootMeanSquaredError;
experiment
.SetPipeline(pipeline)
.SetRegressionMetric(regressionMetric,
labelColumn: columnInference.ColumnInformation.LabelColumnName)
.SetTrainingTimeInSeconds(100) // Training time in sec
.SetDataset(trainValidationData);
4.Download the [taxi-fare-full.csv](https://github.com/dotnet/machinelearning-samples/blob/main/samples/csharp/getting-started/Regression_TaxiFarePrediction/TaxiFarePrediction/Data/taxi-fare-full.csv) and set it to be copied.
5.This works without errors. Add LightGBM version 4.0.0 or latest 4.3.0 with NuGet Package Manager.
6. See error
**Additional context**
Without installing LightGBM version 4.?.?, ML.NET version 3.0.1 uses LightGBM version 3.3.5.
I've asked [Version 3.3.5 to Version 4.3.0](https://github.com/microsoft/LightGBM/issues/6309) at microsoft/LightGBM.
LightGBM Version 4.3.0 itself maybe works fine. So it might be the problem how ML.NET calls LightGBM.
System Information (please complete the following information):
Describe the bug
System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
To Reproduce Steps to reproduce the behavior:
MLContext mlContext; string sampleData = "taxi-fare-full.csv"; mlContext = new MLContext();
// Infer column information ColumnInferenceResults columnInference = mlContext.Auto() .InferColumns(sampleData, labelColumnName: "fare_amount", groupColumns: false); // Create text loader TextLoader loader = mlContext.Data.CreateTextLoader(columnInference.TextLoaderOptions);
// Load data into IDataView IDataView data = loader.Load(sampleData);
TrainTestData trainValidationData = mlContext.Data.TrainTestSplit(data, testFraction: 0.2);
SweepablePipeline pipeline = mlContext.Auto() .Featurizer(data, columnInformation: columnInference.ColumnInformation) .Append(mlContext.Auto() .Regression(labelColumnName: columnInference.ColumnInformation.LabelColumnName));
AutoMLExperiment experiment = mlContext.Auto().CreateExperiment();
var regressionMetric = RegressionMetric.RootMeanSquaredError; experiment .SetPipeline(pipeline) .SetRegressionMetric(regressionMetric, labelColumn: columnInference.ColumnInformation.LabelColumnName) .SetTrainingTimeInSeconds(100) // Training time in sec .SetDataset(trainValidationData);
// Log experiment trials mlContext.Log += (_, e) => { if (e.Source.Equals("AutoMLExperiment")) { Console.WriteLine(e.RawMessage); } };
TrialResult experimentResults = await experiment.RunAsync();