Skip to content

[CodeGenerator] Fix MLNet.CLI build error. #5546

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

Merged
merged 14 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ public class ConsumeModel
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath(""");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, """);
this.Write(this.ToStringHelper.ToStringWithCulture(MLNetModelName));
this.Write("\");\r\n");
if(IsAzureImage || IsAzureObjectDetection){
this.Write(" \r\n public static string OnnxModelPath = Path.GetFullPath(\"");
this.Write(" \r\n public static string OnnxModelPath = Path.Combine(System.AppContext.Ba" +
"seDirectory, \"");
this.Write(this.ToStringHelper.ToStringWithCulture(OnnxModelName));
this.Write("\");\r\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ namespace <#= Namespace #>.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("<#= MLNetModelName #>");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "<#= MLNetModelName #>");
<#if(IsAzureImage || IsAzureObjectDetection){ #>
public static string OnnxModelPath = Path.GetFullPath("<#= OnnxModelName #>");
public static string OnnxModelPath = Path.Combine(System.AppContext.BaseDirectory, "<#= OnnxModelName #>");
<#} #>

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Test.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("\path\to\model");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "\path\to\model");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace CodeGenTest.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("/path/to/model");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "/path/to/model");

public static string OnnxModelPath = Path.GetFullPath("/path/to/onnxModel");
public static string OnnxModelPath = Path.Combine(System.AppContext.BaseDirectory, "/path/to/onnxModel");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace CodeGenTest.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("/path/to/model");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "/path/to/model");

public static string OnnxModelPath = Path.GetFullPath("/path/to/onnxModel");
public static string OnnxModelPath = Path.Combine(System.AppContext.BaseDirectory, "/path/to/onnxModel");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TestNamespace.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("x:\models\model.zip");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "x:\models\model.zip");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TestNamespace.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("x:\models\model.zip");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "x:\models\model.zip");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace Namespace.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("mlmodel.zip");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "mlmodel.zip");

public static string OnnxModelPath = Path.GetFullPath("onnx.onnx");
public static string OnnxModelPath = Path.Combine(System.AppContext.BaseDirectory, "onnx.onnx");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace Namespace.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("mlmodel.zip");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "mlmodel.zip");

public static string OnnxModelPath = Path.GetFullPath("onnx.onnx");
public static string OnnxModelPath = Path.Combine(System.AppContext.BaseDirectory, "onnx.onnx");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Namespace.Model
{
private static Lazy<PredictionEngine<ModelInput, ModelOutput>> PredictionEngine = new Lazy<PredictionEngine<ModelInput, ModelOutput>>(CreatePredictionEngine);

public static string MLNetModelPath = Path.GetFullPath("mlmodel.zip");
public static string MLNetModelPath = Path.Combine(System.AppContext.BaseDirectory, "mlmodel.zip");

// For more info on consuming ML.NET models, visit https://aka.ms/mlnet-consume
// Method for consuming model in your app
Expand Down