训练 ML.NET — System.OutOfMemoryException

首先,我对 ML.NET(以及整个机器学习领域)都是新手。我试图使用 SQL Server 表作为数据源来设置一个模型。我从同一张表中选择了一个标签和18个特征,这张表包含了超过300万条记录。当我完成选择标签/特征并点击训练按钮时,我收到一个提示,告诉我 VS 将从 SQL Server(托管在同一台机器上)下载1.1 GB的数据,我确认了这一操作。我收到了下载正在进行的反馈,这个过程持续了30到60秒。然后我得到了以下错误:

Error retrieving SQL data: "Exception of type 'System.OutOfMemoryException' was thrown."   at Microsoft.ML.ModelBuilder.ToolWindows.ModelBuilderDataContext.<DownloadSqlFileAsync>b__88_0()   at System.Threading.Tasks.Task`1.InnerInvoke()   at System.Threading.Tasks.Task.Execute()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.ML.ModelBuilder.ToolWindows.ModelBuilderDataContext.<DownloadSqlFileAsync>d__88.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.ML.ModelBuilder.ToolWindows.ModelBuilderDataContext.<<OnDataChanged>b__77_1>d.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.ML.ModelBuilder.ToolWindows.TrainTabDataContext.<BuildTrainModelParametersAsync>d__138.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at Microsoft.ML.ModelBuilder.ToolWindows.TrainTabDataContext.<StartTrainingAsync>d__130.MoveNext()--- End of stack trace from previous location where exception was thrown ---   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()   at Microsoft.ML.ModelBuilder.ToolWindows.TrainTabControl.<<StartTraining_Click>b__5_0>d.MoveNext()

一些有趣的事实:

  • 我在尝试训练模型时监控了机器的 RAM 使用情况,RAM 使用率始终未超过总可用 RAM 的65%。

  • 在同一个 VS 解决方案中,我有另一个应用程序,我经常通过 EF 将整个表读入内存。

  • 我使用的是 VS Community 和 SQL Express

  • 在错误发生之前,我看到 RAM 使用量增加了大约3 GB。这让我觉得它是在32位环境下运行的(这可以解释所有这些问题),但如果有这样的设置,我找不到。我已经检查了我的 ML 项目的构建属性,并确保将其设置为64位,但我不确定在训练模型时是否使用了这个设置。


回答:

ModelBuilder 是一个32位扩展,因此它无法处理我试图推送给它的那么多数据。我已经提交了一个错误/功能请求,以将数据引入到64位代码中,或者更改数据摄取的方式。

https://github.com/dotnet/machinelearning-modelbuilder/issues/647

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注