Skip to content

LoadTransform and LinearClassificationTrainer doesnot work in AzureFunctions #559

@Anipik

Description

@Anipik

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

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions