【问题标题】:System.InvalidOperationException : The asynchronous operation has not completedSystem.InvalidOperationException : 异步操作未完成
【发布时间】:2020-07-19 05:14:17
【问题描述】:

在 Ml.net 中安装导致异常的管道。 Fit 不是可等待的,我很困惑为什么会发生这种情况。任何帮助都是可观的

var model = pipeline.Fit(dataView);

堆栈跟踪

在 System.Threading.Channels.AsyncOperation.ThrowIncompleteOperationException() 在 System.Threading.Channels.AsyncOperation1.GetResult(Int16 token) at Microsoft.ML.Transforms.RowShufflingTransformer.Cursor.MoveNextCore() at Microsoft.ML.Data.RootCursorBase.MoveNext() at Microsoft.ML.Trainers.TrainingCursorBase.MoveNext() at Microsoft.ML.Trainers.SdcaTrainerBase3.TrainCore(IChannel ch, RoleMappedData 数据,LinearModelParameters 预测器,Int32 weightSetCount) 在 Microsoft.ML.Trainers.StochasticTrainerBase2.TrainModelCore(TrainContext context) at Microsoft.ML.Trainers.TrainerEstimatorBase2.TrainTransformer(IDataView trainSet, IDataView 验证集, IPredictor initPredictor) 在 Microsoft.ML.Trainers.TrainerEstimatorBase2.Fit(IDataView input) at Microsoft.ML.Data.EstimatorChain1.Fit(IDataView 输入)在 ML.DetectFakeJobPosts.Analyzer.Train() 在 D:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line 75 在 ML.DetectFakeJobPosts.Program.Main(String[] args) 中 D:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line 13

管道

    var pipeline = _context.Transforms.Categorical.OneHotEncoding("ec_title", "title")
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_location", "location"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_department", "department"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_salary_range", "salary_range"))
        .Append(_context.Transforms.Text.FeaturizeText("ec_company_profile", "company_profile"))
        .Append(_context.Transforms.Text.FeaturizeText("ec_description", "description"))
        .Append(_context.Transforms.Text.FeaturizeText("ec_requirements", "requirements"))
        .Append(_context.Transforms.Text.FeaturizeText("ec_benefits", "benefits"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_employment_type", "employment_type"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_required_experience", "required_experience"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_required_education", "required_education"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_industry", "industry"))
        .Append(_context.Transforms.Categorical.OneHotEncoding("ec_function", "function"))

        //drop unnecessary columns from view
        .Append(_context.Transforms.DropColumns("title", "location", "department", "salary_range", "company_profile", "description", "requirements", "benefits", "employment_type", "required_experience", "required_education", "industry", "function", "telecommuting", "has_company_logo", "has_questions"))

        //concate features
        .Append(_context.Transforms.Concatenate("Features", "ec_title", "ec_location", "ec_department", "ec_salary_range", "ec_company_profile", "ec_description", "ec_requirements", "ec_benefits", "ec_employment_type", "ec_required_experience", "ec_required_education", "ec_industry", "ec_function"))
        //set label/prediction column
        .Append(_context.Transforms.Conversion.ConvertType("Label", "fraudulent", DataKind.Boolean))
        //select a trainer
        .Append(_context.BinaryClassification.Trainers.SdcaLogisticRegression());

click here for dataset

版本

Ml.net:1.5.1

核心:3.1

【问题讨论】:

  • 您能分享一下您的管道代码是什么样的吗?
  • @Jon 添加了管道
  • 谢谢!您还可以展示您是如何获得数据视图的吗?它只是从文件中加载吗?
  • @Jon 它适用于版本1.5.2-29129-1。

标签: c# machine-learning .net-core ml.net


【解决方案1】:

这个问题是从PR I made 更新部分代码以使用Channels。事实证明,在我们检查导致错误的结果之前,并不总是保证完成异步调用。

目前在daily NuGet feed 中对此进行了修复,以获取最新的每日构建,直到 1.5.2 版本正式发布。

【讨论】:

  • 请注意,ML.NET 1.5.2 版现已发布,其中包含此修复程序。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-09-28
  • 1970-01-01
相关资源
最近更新 更多