-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
add projects capability in CodeGenerator #5002
add projects capability in CodeGenerator #5002
Conversation
<ProjectCapability Include="MLNETCLIGenerated" /> | ||
<#}else{#> | ||
<ProjectCapability Include="ModelBuilderGenerated" /> | ||
<#}#> |
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's diverging between CLI and MB that we need MLNETCLIGenerated
vs ModelBuilderGenerated
?
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.
It's from our PM, we want to differentiate ModelBuilder-Generated from MLNet CLI Generated in telemetry data
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.
Sounds good.
this.Write(" <ProjectCapability Include=\"MLNETCLIGenerated\" />\r\n"); | ||
}else{ | ||
this.Write(" <ProjectCapability Include=\"ModelBuilderGenerated\" />\r\n"); | ||
} |
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.
Should modify the upstream .tt
so the .cs
is formatted properly here.
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.
Same w/ ModelProject.tt
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 you mean
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.
@LittleLittleCloud aren't these files generated from TT files?
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.
In this PR it looks like the CS files were modified directly instead of changing the TT files.
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.
Nevermind I see them now :)
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.
The newly added code is currently being formatted as:
machinelearning/src/Microsoft.ML.CodeGenerator/Templates/Console/PredictProject.cs
Lines 77 to 86 in e84006b
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace)); | |
this.Write(".Model.csproj\" />\r\n </ItemGroup>\r\n\r\n <ItemGroup>\r\n"); | |
if (Target==CSharp.GenerateTarget.Cli) { | |
this.Write(" <ProjectCapability Include=\"MLNETCLIGenerated\" />\r\n"); | |
}else{ | |
this.Write(" <ProjectCapability Include=\"ModelBuilderGenerated\" />\r\n"); | |
} | |
this.Write(" </ItemGroup>\r\n</Project>\r\n"); | |
return this.GenerationEnvironment.ToString(); | |
} |
It should be:
this.Write(this.ToStringHelper.ToStringWithCulture(Namespace));
this.Write(".Model.csproj\" />\r\n </ItemGroup>\r\n\r\n <ItemGroup>\r\n");
if (Target==CSharp.GenerateTarget.Cli) {
this.Write(" <ProjectCapability Include=\"MLNETCLIGenerated\" />\r\n");
}
else {
this.Write(" <ProjectCapability Include=\"ModelBuilderGenerated\" />\r\n");
}
this.Write(" </ItemGroup>\r\n</Project>\r\n");
return this.GenerationEnvironment.ToString();
}
The generated .cs
files are created from their corresponding .tt
T4 template files. The change would occur there. I left a comment on the .cs
as it shows the output.
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.
@JakeRadMSFT it's auto-gen, I didn't modify those cs file a bit :)
@@ -54,4 +62,5 @@ public bool IncludeResNet18Package {get; set;} | |||
public bool IncludeRecommenderPackage {get;set;} | |||
public string StablePackageVersion {get;set;} | |||
public string UnstablePackageVersion {get;set;} | |||
internal CSharp.GenerateTarget Target {get;set;} |
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.
NIT: I would think of CLI vs ModelBuilder as the Source instead of Target. It's the thing causing the projects to get generated.
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.
Will do
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.
LGTM; I'd recommend improving the code formatting: #5002 (review)
Current CI error on one Centos and one Ubuntu run is: - ##[error]Unhandled exception. System.IO.IOException: No space left on device @harishsk: Thoughts on how to resolve? |
@frank-dong-ms I believe you are already looking at this, aren't you? |
if generated by ModelBuilder, will add
<ProjectCapability Include="ModelBuilderGenerated" />
else
<ProjectCapability Include="MLNETCLIGenerated" />
to .Model and .Console project