-
Notifications
You must be signed in to change notification settings - Fork 442
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
ML.NET v1.4 doesn't work on Azure Functions with .NET Core 2.1 #5187
Milestone
Comments
@fabiocav - I'd like to take a stab at fixing this. Can you assign it to me? |
eerhardt
added a commit
to eerhardt/azure-functions-host
that referenced
this issue
Nov 1, 2019
This allows for probing of more locations for native libraries instead of just the "runtimes\{rid}\native" folder. For example, native assets can also live in a "runtimes\{rid}\nativeassets\{tfm}" folder. Fix Azure#5187
fabiocav
pushed a commit
that referenced
this issue
Nov 1, 2019
This allows for probing of more locations for native libraries instead of just the "runtimes\{rid}\native" folder. For example, native assets can also live in a "runtimes\{rid}\nativeassets\{tfm}" folder. Fix #5187
Merged
ghost
locked as resolved and limited conversation to collaborators
Dec 31, 2019
fabiocav
pushed a commit
that referenced
this issue
Apr 22, 2020
This allows for probing of more locations for native libraries instead of just the "runtimes\{rid}\native" folder. For example, native assets can also live in a "runtimes\{rid}\nativeassets\{tfm}" folder. Fix #5187
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When creating an Azure Function on netcoreapp2.1 and using ML.NET v1.4, it is failing to load the CpuMathNative library.
Between ML.NET 1.3. and 1.4 we’ve updated our “CpuMath” package in order to support .NET Core 3.0. We are now taking advantage of the new C# Hardware Intrinsics (SIMD) APIs in .NET Core 3.0. In order to make that change, we had to refactor our NuGet package a bit, and that refactoring seems to break Azure Functions.
In 1.4, our native assembly has moved inside the NuGet package.
Before
runtimes\win-x64\native\CpuMathNative.dll
After
runtimes\win-x64\nativeassets\netstandard2.0\CpuMathNative.dll
This change was needed because we don’t need the native assembly when running on netcoreapp3.0. So taking advantage of the
runtimes\{RID}\nativeassets\{TFM}
functionality in NuGet allowed us to not ship an unnecessary native binary in the customer’s app. For more information on this support in NuGet, see NuGet/Home#2782.When running an Azure Functions app, it isn’t handling the
nativeassets
folder correctly. Thus, the CpuMathNative assembly isn’t loaded, and the Azure Function fails.Repro steps
Provide the steps required to reproduce the problem:
Invoke-RestMethod "http://localhost:7071/api/AnalyzeSentiment" -Method Post -Body (@{SentimentText="This is a very bad steak"} | ConvertTo-Json) -ContentType "application/json"
Expected behavior
The app should work and the function should return "Negative" since
bad steak
is a negative sentiment.Actual behavior
From Debugging in Visual Studio the exception is:
Known workarounds
The only workaround I know of is to use ML.NET 1.3.
Related information
I played locally with a change to the Azure Function native assembly loading code, and I was able to get this fixed when the
function.deps.json
file is present. If you want to take a look, my change is here.The text was updated successfully, but these errors were encountered: