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

System.Private.CoreLib: Exception while executing function - Error running Azure Functions v2 locally with ML.NET #3190

Open
ChristianWeyer opened this Issue Jul 26, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@ChristianWeyer

ChristianWeyer commented Jul 26, 2018

Hey all, I have used the ML.NET tutorial here https://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/taxi-fare and wrapped the logic into an Azure Function.

I am using 2.0.1-beta.31 CLI tools and 1.0.14 from NuGet.

When executing the Function, I get this error

Http Functions:

        TaxiFarePredictor: http://localhost:7071/api/TaxiFarePredictor

[26/07/2018 06:54:15] Executing 'TaxiFarePredictor' (Reason='This function was programmatically called via the host APIs.', Id=234649db-5a6c-4d91-92ed-2af4f125a96b)
[26/07/2018 06:54:15] C# HTTP trigger TaxiFarePredictor function processed a request.
Duplicate loading of the assembly 'Microsoft.ML.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Duplicate loading of the assembly 'Microsoft.ML.Api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Duplicate loading of the assembly 'Microsoft.ML, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Duplicate loading of the assembly 'Microsoft.ML.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Duplicate loading of the assembly 'TaxiFarePrediction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
[26/07/2018 06:54:19] System.Private.CoreLib: Exception while executing function: TaxiFarePredictor. Microsoft.ML.Data: Entry point'Transforms.CategoricalOneHotVectorizer' not found.
[26/07/2018 06:54:19]
[26/07/2018 06:54:19] Executed 'TaxiFarePredictor' (Failed, Id=234649db-5a6c-4d91-92ed-2af4f125a96b)
[26/07/2018 06:54:19] System.Private.CoreLib: Exception while executing function: TaxiFarePredictor. Microsoft.ML.Data: Entry point'Transforms.CategoricalOneHotVectorizer' not found.

Repro:
https://github.com/ChristianWeyer/azure-functions-ml-net

This is the input JSON I am using to test the Function with:

{
   "VendorId": "VTS",
   "RateCode": "1",
   "PassengerCount": 1,
   "TripDistance": 10.33,
   "PaymentType": "CSH"
}

Any ideas what could be wrong here?
.cc @fabiocav

Thanks!

@ChristianWeyer

This comment has been minimized.

Show comment
Hide comment
@ChristianWeyer

ChristianWeyer Jul 27, 2018

Updated Core Tools to latest 2.0.1-beta.33 - still the same result.
(and yes, I corrected the sample JSON above ;-) )

ChristianWeyer commented Jul 27, 2018

Updated Core Tools to latest 2.0.1-beta.33 - still the same result.
(and yes, I corrected the sample JSON above ;-) )

@fabiocav

This comment has been minimized.

Show comment
Hide comment
@fabiocav

fabiocav Jul 27, 2018

Member

Will take a look at this as soon as possible. At a first glance, it does look like something coming from the code in those assemblies, but this needs some investigation

Member

fabiocav commented Jul 27, 2018

Will take a look at this as soon as possible. At a first glance, it does look like something coming from the code in those assemblies, but this needs some investigation

@fabiocav

This comment has been minimized.

Show comment
Hide comment
@fabiocav

fabiocav Jul 31, 2018

Member

@ChristianWeyer we're investigating some improvements and working with the ML.NET team to address this, but in the meantime, can you try adding the following to the beginning of your function to see if that unblocks you:

            if (typeof(Microsoft.ML.Runtime.Data.LoadTransform) == null ||
                typeof(Microsoft.ML.Runtime.Learners.LinearClassificationTrainer) == null ||
                typeof(Microsoft.ML.Runtime.Internal.CpuMath.SseUtils) == null ||
                typeof(Microsoft.ML.Runtime.FastTree.FastTree) == null)
            {
                log.Error("Error loading ML.NET");
                return new StatusCodeResult(500);
            }

You may still see the duplicate loading logs, but those should be harmless.

Member

fabiocav commented Jul 31, 2018

@ChristianWeyer we're investigating some improvements and working with the ML.NET team to address this, but in the meantime, can you try adding the following to the beginning of your function to see if that unblocks you:

            if (typeof(Microsoft.ML.Runtime.Data.LoadTransform) == null ||
                typeof(Microsoft.ML.Runtime.Learners.LinearClassificationTrainer) == null ||
                typeof(Microsoft.ML.Runtime.Internal.CpuMath.SseUtils) == null ||
                typeof(Microsoft.ML.Runtime.FastTree.FastTree) == null)
            {
                log.Error("Error loading ML.NET");
                return new StatusCodeResult(500);
            }

You may still see the duplicate loading logs, but those should be harmless.

@ChristianWeyer

This comment has been minimized.

Show comment
Hide comment
@ChristianWeyer

ChristianWeyer Jul 31, 2018

This works, thanks @fabiocav - should we leave this issue here open for tracking?

ChristianWeyer commented Jul 31, 2018

This works, thanks @fabiocav - should we leave this issue here open for tracking?

@lqdev

This comment has been minimized.

Show comment
Hide comment
@lqdev

lqdev Aug 8, 2018

Same issue here. The workaround worked. Thanks @fabiocav! I have upgraded to the latest version though 0.4.0 of ML.NET and the issue (without the workaround) persists.

lqdev commented Aug 8, 2018

Same issue here. The workaround worked. Thanks @fabiocav! I have upgraded to the latest version though 0.4.0 of ML.NET and the issue (without the workaround) persists.

@chrismckelt

This comment has been minimized.

Show comment
Hide comment
@chrismckelt

chrismckelt Aug 22, 2018

From ML repository -->

Related closed issue dotnet/machinelearning#559

says this will be fixed via dotnet/machinelearning#371 by no longer front loading assemblies, as the API usage will be directly against the underlying C# assemblies.

chrismckelt commented Aug 22, 2018

From ML repository -->

Related closed issue dotnet/machinelearning#559

says this will be fixed via dotnet/machinelearning#371 by no longer front loading assemblies, as the API usage will be directly against the underlying C# assemblies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment