首页 > 解决方案 > 训练 ML.NET——System.OutOfMemoryException

问题描述

首先,我是 ML.NET(以及整个 ML)的新手。我正在尝试使用 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()

一些有趣的事实:

标签: c#.netsql-servermachine-learningml.net

解决方案


模型构建器(必然)是一个 32 位扩展,因此它无法处理我试图推送给它的尽可能多的数据。我已经打开了一个错误/功能请求,以将数据引入到一些 64 位代码中,或者更改数据被摄取的方式。

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


推荐阅读