System.InvalidOperationException:异步操作尚未完成 [英] System.InvalidOperationException : The asynchronous operation has not completed

查看:51
本文介绍了System.InvalidOperationException:异步操作尚未完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装管道会导致Ml.net中的异常. Fit 并不是值得期待的,我对此感到困惑.任何帮助都是可以的

Fitting the pipeline causing exception in Ml.net. The Fit is not an awaitable and I'm confused why this happens. Any help is appreciable

var model = pipe.Fit(dataView);

堆栈跟踪

在System.Threading.Channels.AsyncOperation.ThrowIncompleteOperationException()在Microsoft.ML.Data.RootCursorBase.MoveNext()在System.Threading.Channels.AsyncOperation 1.GetResult(Int16令牌)在Microsoft.ML.Transforms.RowShufflingTransformer.Cursor.MoveNextCore()在Microsoft.ML.TrainersMicrosoft.ML.Trainers.SdcaTrainerBase上的.TrainingCursorBase.MoveNext() 3.TrainCore(IChannel ch,RoleMappedData数据,LinearModelParameters预测变量,Int32weightSetCount)Microsoft.ML.Trainers.TrainerEstimatorBase的Microsoft.ML.Trainers.StochasticTrainerBase 2.TrainModelCore(TrainContext上下文) 2.TrainTransformer(IDataViewtrainSet,IDataViewvalidationSet,IPredictor initPredictor)位于Microsoft.ML.Data.EstimatorChain 1.Fit(IDataView输入)上的Microsoft.ML.Trainers.TrainerEstimatorBase 2.Fit(IDataView输入)ML.DetectFakeJobPosts.Analyzer.Train()在D:\ Sources \ code-everything \ CodeItHere \ ML.DetectFakeJobPosts \ Program.cs:line75,位于ML.DetectFakeJobPosts.Program.Main(String [] args)中D:\ Sources \ code-everything \ CodeItHere \ ML.DetectFakeJobPosts \ Program.cs:line13

at System.Threading.Channels.AsyncOperation.ThrowIncompleteOperationException() at 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 data, LinearModelParameters predictor, Int32 weightSetCount) at Microsoft.ML.Trainers.StochasticTrainerBase2.TrainModelCore(TrainContext context) at Microsoft.ML.Trainers.TrainerEstimatorBase2.TrainTransformer(IDataView trainSet, IDataView validationSet, IPredictor initPredictor) at Microsoft.ML.Trainers.TrainerEstimatorBase2.Fit(IDataView input) at Microsoft.ML.Data.EstimatorChain1.Fit(IDataView input) at ML.DetectFakeJobPosts.Analyzer.Train() in D:\Sources\code-everything\CodeItHere\ML.DetectFakeJobPosts\Program.cs:line 75 at ML.DetectFakeJobPosts.Program.Main(String[] args) in 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());

单击此处获取数据集

版本

Ml.net:1.5.1

Ml.net : 1.5.1

核心:3.1

推荐答案

此问题来自渠道.事实证明,在检查导致错误的结果之前,并不总是可以保证完成异步调用.

The issue for this is from a PR I made to update part of the code to use Channels. It turns out that it's not always guaranteed to finish the async call before we check the result of it which is causing the error.

每日NuGet feed ,以获取最新的每日版本,直到1.5.2版正式发布.

There's a fix for this currently in the daily NuGet feed to get the latest daily build until the 1.5.2 version gets officially released.

这篇关于System.InvalidOperationException:异步操作尚未完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆