-
Notifications
You must be signed in to change notification settings - Fork 1.9k
LightGBM doesn't work during F5 of a .NET Core application #482
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
Comments
Hi Eric, were you using LightGBM nuget? |
Yes, here is my .csproj <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ML.LightGBM" Version="0.3.0-preview-26703-11" />
</ItemGroup>
<ItemGroup>
<None Update="iris-data.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> |
I spoke with Eric offline and as a work around running dotnet publish places the dependencies in one folder. |
There is another workaround (on the user end) as outlined in #618. It requires adding the following line to the .csproj file:
|
This problem should be soon resolved by the change from the LearningPipelineAPI to the direct access API #371. Users will call directly into the LightGBM assembly, which will therefore be loaded. |
The new direct access API and the changes coming with version 0.6.0 of ML.NET solved this issue. |
Using legacy APIs (even with workaround) when upgrading to ML.NET 0.6 seems to bring this issue back up. |
@artidoro can you please verify this issue with 0.7? |
Hello @bartczernicki! Sorry for the late reply.
|
System information
Issue
Using the latest
0.3.0-preview
NuGet package, I tried using LightGBM in a .NET Core application. I did the walk through: https://www.microsoft.com/net/learn/apps/machine-learning-and-ai/ml-dotnet/get-started/windows, only changing:I expected the walk through app to run successfully.
Notes
When F5 debugging a .NET Core app in VS, or using
dotnet run
on the command line, .NET Core doesn't have all the dependencies copied to the output directory. Instead, references that come from NuGet packages are executed from the NuGet package cache folder.Since LightGBM comes from a separate NuGet package than the rest of the Microsoft.ML, it is loaded from a separate folder than the rest of the Microsoft.ML package.
I've looked through the ComponentCatalog code, and it appears if I force the
Microsoft.ML.LightGBM.dll
to be loaded first, I can workaround the issue.So I added
And I am able to successfully use LightGBM on .NET Core during F5.
Workarounds
Any of these should allow you to workaround the issue:
new LightGbmArguments();
dotnet publish
your application and running it from the published folder (since all dependencies are copied during publish)/cc @ericstj @TomFinley @codemzs
The text was updated successfully, but these errors were encountered: