c# - 训练 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()
一些有趣的事实:
我在尝试训练时观察了机器上的 RAM 计数,但它没有超过可用总 RAM 的 65%。
在同一个 VS 解决方案中,我有另一个应用程序,我经常通过 EF 将整个有问题的表读入内存。
我正在使用 VS Community 和 SQL Express
在错误发生之前,我看到 RAM 计数可能增加了 3 GB 左右。它闻起来非常难闻,就像它以 32 位运行进程(这对所有这一切都有意义),但如果有这个设置,我找不到它。我检查了我的 ML 项目的Build属性,并确保将其设置为 64 位,但我不确定这是否是您训练模型时所使用的。
解决方案
模型构建器(必然)是一个 32 位扩展,因此它无法处理我试图推送给它的尽可能多的数据。我已经打开了一个错误/功能请求,以将数据引入到一些 64 位代码中,或者更改数据被摄取的方式。
https://github.com/dotnet/machinelearning-modelbuilder/issues/647
推荐阅读
- mysql - 如何通过重复键查找唯一行
- swift - Foundation是默认导入的吗?
- python - Does Flask support some kind of life cycle methods?
- html - Responsive centered 2x2 Grid in Angular Ionic
- python - 在哪里可以找到有关 TF2.0 实施的更多详细信息?
- c# - 自动填充 Excel 列
- ravendb - Extracting meta data in RavenDB
- c# - Windows 7 update, results in "Item has already been added. Key in dictionary: controlbrush" in WPF application
- oracle - EXECUTE IMMEDIATE results into Table Type
- javascript - ResizeObserver: How to retrieve the Id of the resized element?