Skip to content

LoadTransform and LinearClassificationTrainer doesnot work in AzureFunctions #559

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

Closed
Anipik opened this issue Jul 19, 2018 · 2 comments
Closed

Comments

@Anipik
Copy link
Contributor

Anipik commented Jul 19, 2018

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

@eerhardt
Copy link
Member

This should no longer be necessary once #371 is completed. We will no longer need to to front load the assembly loading, as the API usage will be directly against the underlying C# assemblies.

@eerhardt
Copy link
Member

eerhardt commented Oct 1, 2018

This now works as expected in 0.6 after #970. Closing.

@eerhardt eerhardt closed this as completed Oct 1, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants