-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
System information
- OS version/distro: Windows
- .NET Version (eg., dotnet --info):
.NET Core SDK (reflecting any global.json):
Version: 2.1.400-preview-009063
Commit: dd0179a67c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.400-preview-009063\
Host (useful for support):
Version: 2.1.1
Commit: 6985b9f684
Issue
-
What did you do?
I am trying to use the ML.net package in azure functions. I am running this https://github.com/dotnet/machinelearning-samples/tree/master/samples/end-to-end-apps/github-labeler inside an azure function. -
What happened?
The entry point map for theseMicrosoft.ML.Runtime.Data.LoadTransformandMicrosoft.ML.Runtime.Learners.LinearClassificationTrainertypes are not getting loaded properly. As a result I am not able to train or test using ML.net inside the Azure Function.
Errors
System.Private.CoreLib: Exception while executing function: GithubIssueLabeler. Microsoft.ML.Data: Couldn't load model: 'DataLoaderModel\Transform_001
System.Private.CoreLib: Exception while executing function: GithubIssueLabeler. System.Private.CoreLib: Exception has been thrown by the target of an invocation. Microsoft.ML.Data: Couldn't load model: 'DataLoaderModel\Transform_020\SchemaBindableMapper\InnerMapper\Predictor'.
- What did you expect?
Expect to work properly.
Source code / logs
[FunctionName("GithubIssueLabeler")]
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, TraceWriter log)
{
//var type = typeof(Microsoft.ML.Runtime.Data.LoadTransform);
//var type1 = typeof(Microsoft.ML.Runtime.Learners.LinearClassificationTrainer);
log.Info("Http Issue Webhook Request is Being Processed");
string requestBody = new StreamReader(req.Body).ReadToEnd();
dynamic data = JsonConvert.DeserializeObject(requestBody);
string Action = data?.action;
dynamic issue = data?.issue;
dynamic labels = issue?.labels;
if (Action == "opened" && labels.Count == 0)
{
string title = issue?.title;
int number = issue?.number;
string body = issue?.body;
log.Info($"A {number.ToString()} issue with {title} has been opened.");
Configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json").Build();
var labeler = new Labeler(Configuration["GitHubRepoOwner"], Configuration["GitHubRepoName"], Configuration["GitHubToken"]);
await labeler.PredictAndApplyLabelAsync(number, title, body, log); // can do training or prediting using already load model
log.Info("Labeling completed");
}
else
{
log.Info("The issue is already opened or it already has a label");
}
Console.ReadLine();
log.Info($"Issue Label request handled");
return Action != null
? (ActionResult)new OkObjectResult($"Issue Label request handled")
: new BadRequestObjectResult("Please pass a name on the query string or in the request body");
}WorkArounds
Adding these lines to the function helps the app to run perfectly fine.
var type = typeof(Microsoft.ML.Runtime.Data.LoadTransform);
var type1 = typeof(Microsoft.ML.Runtime.Learners.LinearClassificationTrainer);
cc @eerhardt
Metadata
Metadata
Assignees
Labels
No labels