-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Obsolete API #1686
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
Obsolete API #1686
Conversation
1. Disable warning 612 reported in test file 2. Remove Microsoft.ML.PipelineInference project 3. Remove two commands used in pipeline inference. - InferRecipesCommand.cs - InferSchemaCommand.cs Note that we add [Obsolete] to everything in Microsoft.ML.Legacy but auto-generated APIs.
this should fix #1684 #Resolved |
@@ -15,8 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Core.Tests", " | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CpuMath", "src\Microsoft.ML.CpuMath\Microsoft.ML.CpuMath.csproj", "{46F2F967-C23F-4076-858D-33F7DA9BD2DA}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.PipelineInference", "src\Microsoft.ML.PipelineInference\Microsoft.ML.PipelineInference.csproj", "{2D7391C9-8254-4B8F-BF26-FADAF8F02F44}" |
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.
Doing this will make it not build anymore. Is that what we intend? If yes, we may as well delete the code IMO. Someone can get it from source control history if they need it. #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, InferencePipeline needs to be removed. I can build my changes locally. Do you mean that CI will still crash? #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.
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.
1. Make everything in CSharpApi.cs obsolete by modifying CSharpApiGenerator.cs and CSharpGeneratorUtils.cs. 2. Some checked-in [Obsolete] are removed because they conflict with those automatically generated in CSharpApi.cs. 3. Some classes in Microsoft.ML.Legacy are still not obsolete so we addd [Obsolete] to them. 4. Supress warnings 612 and 618 (warning 44 for F# test) for tests and benchmarks.
The others were obsolete, is this one not? So while the legacy API is bad, we need to get a catalog of those entry-points published in legacy that need to be preserved and migrate them, so that NimbusML or somesuch continues to function. (My belief is that other entry-point consumers predate ML.NET., so those would not be a concern.) I am not certain whether this is one of them or not, but I know some of these are actually used so we must catalog those, and migrate them somehow. I'm not suggesting this as a necessary precondition to your PR, but I'm wondering if we've thought about it. Refers to: src/Microsoft.ML.Legacy/Runtime/EntryPoints/OneVersusAllMacro.cs:21 in 702fc85. [](commit_id = 702fc85, deletion_comment = False) |
|
||
namespace Microsoft.ML.Runtime.EntryPoints.JsonUtils | ||
{ | ||
[Obsolete] | ||
internal sealed class ExecuteGraphCommand : ICommand |
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.
ExecuteGraphCommand [](start = 26, length = 19)
General entry-point utilities like this that were incorrectly moved into this doomed project must be borne out. This includes, at least, this command, the graph runner, and I am pretty sure the manifest utils.
So let's draw a distinction, there's the CSharpApi that was generated out of entry-points. That's bad and needs to get removed. The facilities though for entry-points by themselves are not bad and should be preserved. So any "viral" effects from any references to the contents of CSharpApi.cs
or any other similarly structured classes (e.g., the duplicate evaluators that were written meant to be used within these pipelines) should be marked obsolete. Similar story for the code-gen. But this by itself should not have been marked obsolete.
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.
Ok. I will only mark things referring to CSharpApi.cs obsolete and move entry point utilities to a new project, Microsoft.ML.EntryPoint.
In reply to: 235447577 [](ancestors = 235447577)
|
||
namespace Microsoft.ML.Runtime.EntryPoints | ||
{ | ||
[Obsolete] | ||
public static class ModelOperations |
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.
ModelOperations [](start = 24, length = 15)
This would be an example of a set of entry-points that does not reference the legacy namespaces/projects at all, and should have been borne out somewhere where it will be preserved. I am fairly certain that NimbusML uses this.
Do you know any efficient way to identify those function used elsewhere? Do I need to go through NimbusML? In reply to: 440717541 [](ancestors = 440717541) Refers to: src/Microsoft.ML.Legacy/Runtime/EntryPoints/OneVersusAllMacro.cs:21 in 702fc85. [](commit_id = 702fc85, deletion_comment = False) |
If you are looking to identify those entry-points here actually used in NimbusML, assuredly my expectation must be that you would have to look at NimbusML to determine this. Perhaps it is unclear how to do this. Let's take the one in this file. The entry point name is declared here. machinelearning/src/Microsoft.ML.Legacy/Runtime/EntryPoints/OneVersusAllMacro.cs Line 138 in b509add
NimbusML generates Python calling functions using this autogenerated code, which was placed here in this file If we search the NimbusML codebase to see if it is actually used anywhere, we see that it is. We will have to migrate it. Which means that instead of using the autogenerated C# API, we will when migrating this have to make it modify the entry-point graph itself just like macros used to do. (Not saying you'd do this latter work, someone else can, but it's important to at least identify those that must be migrated.) Other entry-points may be easier; the macros might be the hardest cases. Others don't touch the legacy API at all, and so can be moved now (might be good to do so, or at least identify those that can be moved). would just for now actually move out of legacy since I think many of them will just work. In reply to: 440741687 [](ancestors = 440741687,440717541) Refers to: src/Microsoft.ML.Legacy/Runtime/EntryPoints/OneVersusAllMacro.cs:21 in 702fc85. [](commit_id = 702fc85, deletion_comment = False) |
1. Things in Microsoft.ML.Legacy.Runtime are not obsolete. If they reference to obsolete CSharpApi.cs, we supress the warning 612. 2. Things in Microsoft.ML.Legacy have two destinies. Anything (a) referring CSharpApi.c, (b) being a part of CSharpApi.cs, or (c) using ILearningPipelineItem.cs are are obsolete. Otherwise, they are not obsolete.
…d project's binary files
Thank you Tom. I just draft a plan for moving those can be easily moved. The path specified at the left hand side of " ---> " will be moved to the right hand side.
In reply to: 440809174 [](ancestors = 440809174,440741687,440717541) Refers to: src/Microsoft.ML.Legacy/Runtime/EntryPoints/OneVersusAllMacro.cs:21 in 702fc85. [](commit_id = 702fc85, deletion_comment = False) |
@@ -7,6 +7,9 @@ | |||
using System.Linq; | |||
using Microsoft.ML.Runtime.Data; | |||
|
|||
// The warning #612 is disabled because the following code uses a lot of things in Legacy.Models while Legacy.Model is marked as obsolete. |
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.
When are we going to rewrite the below code? Is there an issue tracking it?
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 one: #1565.
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 looks good to me thank you @wschin .
@@ -50,15 +50,6 @@ private static bool LoadStandardAssemblies() | |||
_ = typeof(SweepCommand).Assembly; // ML.Sweeper | |||
_ = typeof(OneHotEncodingTransformer).Assembly; // ML.Transforms | |||
|
|||
// The following assemblies reference this assembly, so we can't directly reference them |
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 one line comment is still valid. Please don't delete it #Resolved
I think things like https://github.com/dotnet/machinelearning/blob/master/src/Microsoft.ML.Legacy/Models/BinaryClassificationMetrics.cs#L17 need to be marked |
@@ -26,4 +25,8 @@ | |||
<NativeAssemblyReference Include="MklImports" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> | |||
<Folder Include="Commands\" /> |
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 should be deleted. #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.
Ok.
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.
Fixed. Everything under Microsoft.ML.Legacy.Models is obsolete now. In reply to: 441769564 [](ancestors = 441769564) |
We are planning removing classical APIs defined in Microsoft.ML.Legacy. The commits are organized so please read them one-by-one.
Fixes #1684.