Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Train operation should be cancellable. #844

Closed
kant2002 opened this issue Sep 6, 2018 · 5 comments
Closed

Train operation should be cancellable. #844

kant2002 opened this issue Sep 6, 2018 · 5 comments

Comments

@kant2002
Copy link
Contributor

kant2002 commented Sep 6, 2018

System information

  • OS version/distro: All supported
  • .NET Version (eg., dotnet --info): All supported.

Issue

  • I attempt to write training of the models using API as part of internal pipeline
  • After I run pipeline.Train() I was not able to stop training using standard .NET CancellationToken API
  • Please provide ability to cancel such long running operation as training.
@Zruty0
Copy link
Contributor

Zruty0 commented Sep 6, 2018

With the new API we are going to expose IHostEnvironment to you (see https://github.com/dotnet/machinelearning/blob/master/src/Microsoft.ML.Core/Data/IHostEnvironment.cs).
Here's how you can cancel a process using that:

var env = new TlcEnvironment(); // Class name subject to change.
var host = env.Register("some user name");

var pipeline = ... // create pipeline using 'host'.
pipeline.Fit(data);

If you call host.StopExecution(), the training process will terminate with an exception.
I am not sure why we discarded the standard CancellationToken API. It was definitely considered at that time, but I forgot what was the reason not to use it.

@kant2002
Copy link
Contributor Author

kant2002 commented Sep 9, 2018

@Zruty0 are the IHostEnvironment could be used in the 0.4.0, or I should use nightlies for accessing this functionality? I'm aware about API change, just do not research on new API yet.

@klausmh
Copy link
Contributor

klausmh commented Dec 4, 2018

Could you provide an example of "var pipeline = ... // create pipeline using 'host'." in the current version of ML.NET?

@codemzs
Copy link
Member

codemzs commented Jun 30, 2019

Done as part of #2797

@codemzs codemzs closed this as completed Jun 30, 2019
@kant2002
Copy link
Contributor Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants