简体   繁体   English

训练 ML.NET -- System.OutOfMemoryException

[英]Training ML.NET -- System.OutOfMemoryException

First off, I am new to ML.NET (and ML as a whole).首先,我是 ML.NET(以及整个 ML)的新手。 I am trying to set up a model using a SQL Server table as my data source.我正在尝试使用 SQL Server 表作为我的数据源来设置模型。 I am selecting one label and 18 features from the same table and this table contains a little more than 3 million records in it.我从同一个表中选择了一个标签和 18 个特征,这个表中包含的记录略多于 300 万条。 When I finish selecting my label/features and click on the Train button, I get a prompt telling me that VS will download 1.1 GB of data from the SQL Server (hosted on the same machine) which I acknowledge.当我完成选择我的标签/功能并单击“训练”按钮时,我收到一条提示,告诉我 VS 将从我承认的 SQL Server(托管在同一台机器上)下载 1.1 GB 的数据。 I get feedback indicating that the download is in progress and this lasts for 30 - 60 seconds.我收到反馈,表明下载正在进行中,这会持续 30 - 60 秒。 Then I get the following error:然后我收到以下错误:

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()

Some fun facts:一些有趣的事实:

  • I've watched the RAM count on the machine while the attempt to train is made and it's not getting above 65% of total RAM available.我在尝试训练时观察了机器上的 RAM 计数,但它没有超过可用总 RAM 的 65%。

  • In the same VS solution, I have another app where I routinely read the entirety of the table in question into memory via EF.在同一个 VS 解决方案中,我有另一个应用程序,我经常通过 EF 将整个表读入内存。

  • I am using VS Community and SQL Express我正在使用 VS Community 和 SQL Express

  • I see the RAM count increase by maybe 3 or so GB before the error occurs.在错误发生之前,我看到 RAM 计数可能增加了 3 GB 左右。 It smells so badly like it's running the process in 32-bit (which would make sense of all of this) but if there's a setting for this, I can't find it.它闻起来很糟糕,就像它在 32 位(这将理解所有这些)中运行的过程一样,但是如果有这样的设置,我找不到它。 I've checked the Build properties for my ML project and made sure that's set to 64-bit but I'm not sure that's even what is being used when you're training the model.我已经检查了我的 ML 项目的Build属性,并确保它设置为 64 位,但我不确定这是否是您训练模型时使用的。

The ModelBuilder is (necessarily) a 32-bit extension and so it cannot process as much data as I was trying to push to it.模型构建器(必然)是 32 位扩展,因此它无法处理与我试图推送的数据一样多的数据。 I've opened a bug / feature request to get the data introduction into some 64-bit code or else change the way the data is ingested.我已经打开了一个错误/功能请求,以将数据引入一些 64 位代码,或者更改数据摄取的方式。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM