-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Renamed TlcEnvironment to Console. Also introduced LocalEnvironment #923
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
Conversation
@@ -215,7 +215,7 @@ private void ValidateMetadata(IDataView result) | |||
[Fact] | |||
public void TestCommandLine() | |||
{ | |||
using (var env = new TlcEnvironment()) | |||
using (var env = new ConsoleEnvironment()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using (var env = new ConsoleEnvironment()) [](start = 12, length = 42)
Why I'm even doing this? #Closed
@@ -97,7 +97,7 @@ public void Pkpd() | |||
{ | |||
var dataPath = GetDataPath(IrisDataPath); | |||
|
|||
using (var env = new TlcEnvironment()) | |||
using (var env = new ConsoleEnvironment()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env [](start = 23, length = 3)
you can use Env from base class, but it's unrelated to your PR #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -25,7 +25,7 @@ public ImageTests(ITestOutputHelper output) : base(output) | |||
[Fact] | |||
public void TestEstimatorChain() | |||
{ | |||
using (var env = new TlcEnvironment()) | |||
using (var env = new ConsoleEnvironment()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env [](start = 23, length = 3)
Want to replace it to Env from TestDataPipeBase? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to hear my valuable opinion? All our tests use XUnit which completely ignores Console, and you have to do this tricks to capture output. I would rather had XUnitEnvironment or TestEnvironment which would send output through ITestOutputHelper. Refers to: test/Microsoft.ML.StaticPipelineTesting/StaticPipeTests.cs:31 in 28a17e3. [](commit_id = 28a17e3, deletion_comment = False) |
namespace Microsoft.ML.Runtime.Data | ||
{ | ||
using Stopwatch = System.Diagnostics.Stopwatch; | ||
public sealed class LocalEnvironment : HostEnvironmentBase<LocalEnvironment> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LocalEnvironment [](start = 24, length = 16)
Maybe SilentEnvironment? Or you somehow can hook up to the messages? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -17,7 +17,7 @@ namespace Microsoft.ML.Runtime.Data | |||
public static class ProgressReporting | |||
{ | |||
/// <summary> | |||
/// The progress channel for <see cref="TlcEnvironment"/>. | |||
/// The progress channel for <see cref="ConsoleEnvironment"/>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConsoleEnvironment [](start = 48, length = 18)
Is it really only TlcEnvironment specific or can be used in any HostEnvironmentBase descendant? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could be used elsewhere, but I'm not sure, and I would rather not try now.
In reply to: 217869313 [](ancestors = 217869313)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -358,20 +358,36 @@ protected override void DisposeCore() | |||
private volatile ConsoleWriter _consoleWriter; | |||
private readonly MessageSensitivity _sensitivityFlags; | |||
|
|||
public TlcEnvironment(int? seed = null, bool verbose = false, | |||
/// <summary> | |||
/// Create an ML.NET environment for local execution, with console feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ML.NET environmen [](start = 22, length = 17)
add a #Resolved
@@ -480,7 +480,7 @@ private string DataArg(string dataPath) | |||
|
|||
protected void TestPipeFromModel(string dataPath, OutputPath model) | |||
{ | |||
using (var env = new TlcEnvironment(new SysRandom(42))) | |||
using (var env = new ConsoleEnvironment(42)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't an equivalent change, right? It used to use SysRandom
, but now it will use TauswortheHybrid
. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// <summary> | ||
/// An ML.NET environment for local execution. | ||
/// </summary> | ||
public sealed class LocalEnvironment : HostEnvironmentBase<LocalEnvironment> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have some tests that cover this class. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -111,7 +111,7 @@ private protected FastTreeTrainerBase(IHostEnvironment env, TArgs args) | |||
ParallelTraining.InitEnvironment(); | |||
// REVIEW: CLR 4.6 has a bug that is only exposed in Scope, and if we trigger GC.Collect in scope environment | |||
// with memory consumption more than 5GB, GC get stuck in infinite loop. So for now let's call GC only if we call things from TlcEnvironment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TlcEnvironment [](start = 138, length = 14)
This comment is now out of date. #Resolved
|
||
namespace Microsoft.ML.Runtime.Data | ||
{ | ||
using Stopwatch = System.Diagnostics.Stopwatch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What other kind of Stopwatch is there? Can we just have a using System.Diagnostics;
at the top? #ByDesign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System.Diagnostics
is a pretty big namespace with some names that for whatever reason cleave pretty tightly to common terms in ML (e.g., we have 90% of our code bent around processing instance data, and sure enough we get Process
and InstanceData
... :P), after several instances of developer confusion, we decided to adopt this practice. My innate tendency would be to keep up our existing practice of, when you want only a stopwatch, just import only that, rather than to relax it just yet. (Or better yet C# could have a less awkward way to import a single class from a namespace.)
Of course we could relax it. That practice dates from the times before we had channels, where literally every component instantiated stopwatches to time themselves, and there were lots of namespace collisions, and so lots of cost. Now that we do have channels, few things produce their own stopwatches -- use of System.Diagnostics is quite limited. So the amount of pain that would be generated now by your suggestion would be much less.
In reply to: 218094176 [](ancestors = 218094176)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void ChannelFinished() | ||
=> Dispatch(this, new ChannelMessage(ChannelMessageKind.Trace, MessageSensitivity.None, "Channel finished. Elapsed { 0:c }.", Watch.Elapsed)); | ||
|
||
protected override void DisposeCore() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - I logged #930 to implement the Dispose Pattern correctly on these types. #Resolved
@@ -113,7 +113,7 @@ public interface IMessageDispatcher : IHostEnvironment | |||
/// AddListener/RemoveListener methods, and exposes the <see cref="ProgressReporting.ProgressTracker"/> to | |||
/// query progress. | |||
/// </summary> | |||
public abstract class HostEnvironmentBase<TEnv> : ChannelProviderBase, IHostEnvironment, IDisposable, IChannelProvider, IMessageDispatcher | |||
public abstract class HostEnvironmentBase<TEnv> : ChannelProviderBase, IHostEnvironment, IChannelProvider, IMessageDispatcher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should get rid of the Dispose
method as well.
It feels like we should fix the whole IDisposable
concern in 1 change - i.e. remove the Dispose method, remove the "temp file" capability, etc.
Here, we are hanging in limbo where this type doesn't implement IDisposable, but it has a Dispose method, and it holds onto Disposable objects (the IFileHandle instances). #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, let's separate the change and get rid of temp files later
In reply to: 218099076 [](ancestors = 218099076)
No description provided.