microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.51k stars 4.29k forks source link

Support for netcoreapp2.0 #2352

Open robinhad opened 7 years ago

robinhad commented 7 years ago

Is there any plans to bring CNTK to, let's say, .NET Standard 2.0?

cha-zhang commented 7 years ago

Yes, CNTK C# API will comply with .NET 2.0.

robinhad commented 7 years ago

Can I ask for ETA?

KichangKim commented 7 years ago

I'm getting warning message when import CNTK.GPU from nuget:

Warning NU1701 Package 'CNTK.GPU 2.2.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. CNTKTest D:\Projects\CNTKTest\CNTKTest\CNTKTest.csproj 1

Isn't .Net Core 2.0 support ship with CNTK 2.2 yet?

JimSEOW commented 7 years ago

@kkc0923 @robinhad For .NET Core 2.0 support (e.g. Raspberry PI) . One of the main limitations faced by CNTK team is to bring the C++ DLL to ARM OS, in addition to Linux etc.

It will come. Community support is welcome.

liqunfu commented 7 years ago

Just got CNTK 2.2 released. One of many features added to this release is the Basic C# training API. While we believe CNTK C# API (for training and evaluation) is compatible with .Net core 2.0, we did not package CNTK C# API as a .Net core NuGet. Due to limited resources, we hope someone from the community can pick up this task to make a .net core 2.0 NuGet package.

Regarding, ARM support, I agree with @JimSEOW.

robinhad commented 7 years ago

@liqunfu I'm sorry for dummy question, but do you have instructions or materials about this? I could try to do it this week

liqunfu commented 7 years ago

@robinhad, No problem. @kkc0923 had tried to work with .NetCoew 2.0. How did it go? I guess it requires VS 2017 for .NetCore. I will install VS 2017 and try it out.

KichangKim commented 7 years ago

@liqunfu Yes, I tried it by using latest VS 2017 + .NetCore 2.0 SDK. Then created ".Net Core Console Application" and imported CNTK.GPU 2.2 from Nuget.

robinhad commented 7 years ago

@kkc0923 Is there any hope we can use it in Xamarin by targeting .NET Standard?

KichangKim commented 7 years ago

@robinhad If CNTK does fully support .NET Standard 2.0 and Nuget Packaging, it will work with Xamarin, but not yet I think

grzsz commented 6 years ago

No success with using CNTK on .netcore 2.0, get following warning for both GTPU and CPUOnly

Warning NU1701 Package 'CNTK.GPU 2.2.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.

I use VS2017. Any hints?

Ark-kun commented 6 years ago

AFAIK, Cntk's usage of .Net BCL is very limited, so netstandard 1.0 might be a better choice (the lowest version).

JimSEOW commented 6 years ago

@Ark-kun @robinhad For CNKT support of XAMRIN, it is a VERY Broad topics. Xamarin's To boldly go where no man has gone before ( cross platform to many OSs). One has to be very specific (which OS) when asking how and when CNTK will and can support XAMAIN.

robinhad commented 6 years ago

@JimSEOW @Ark-kun We have this table https://docs.microsoft.com/en-us/dotnet/standard/net-standard It is about to target lowest .NET Standard version possible to achive maximum portability @liqunfu I could try to run .NET Portability Analyzer to check what .NET Standard version CNTK can already support

robinhad commented 6 years ago

@liqunfu @JimSEOW @Ark-kun I run Portability Analyzer and got this report (attached). Instruction how to read this is there: https://github.com/Microsoft/dotnet-apiport/blob/master/docs/HowTo/PlatformPortability.md Long story short: current code is fully compatible with .NET Standard 2.0, lowest versions require changes, that you can find on Details page in attached report. CNTKApiPortAnalysis.xlsx I`m going to change target frameworks and will tell you tomorrow if it worked.

Ark-kun commented 6 years ago

@robinhad Errors concerning the exception classes look like noise. InteropServices.* are more problematic. I guess, HandleRef limits us to 2.0.

robinhad commented 6 years ago

@liqunfu @JimSEOW @Ark-kun I built successfully for .NET Standard and run "Training" unit tests successfully. I will try to run EvalTests this weekend and then will make a PR.

robinhad commented 6 years ago

@liqunfu Can you share pretrained models so I can test Eval examples? I don't have GPU to train on.

cha-zhang commented 6 years ago

https://github.com/Microsoft/CNTK/tree/master/PretrainedModels

robinhad commented 6 years ago

@cha-zhang Could you share atis.dnn model?

cha-zhang commented 6 years ago

@robinhad If you share with me your email, I can send the model to you. Thanks!

robinhad commented 6 years ago

@cha-zhang It seems like I encountered an issue #2260, not related to .NET bindings, but to CNTK itself. Sorry for disturbing you.

robinhad commented 6 years ago

@cha-zhang @liqunfu Targeting to .NET Standard also means using VS2017, because no tools for .NET Standard availbale for VS2015. But changing <TargetFrameworkName>v4.5<\TargetFrameworkName> to <TargetFrameworks>netstandard2.0;net45<\TargetFrameworks> leads to error:

platform value cannot be null

and as a result project can't be loaded.

cha-zhang commented 6 years ago

@robinhad VS2017 will need to wait till cuda 9 integrates. This should be done by the end of this iteration.

robinhad commented 6 years ago

@cha-zhang Then I will wait until CNTK will be ported to VS2017, there is no sense to do anything related to this issue before it happens.

ddurschlag commented 6 years ago

@cha-zhang Any update on this? I can't seem to find any documentation on the 2.3 release (its blockers, status, whether net standard 2 is in or out, anything about CUDA9's relationship with the release) -- if there's a good central place to track this information, I'd be grateful if you could pass it along.

cha-zhang commented 6 years ago

@ddurschlag , v2.3 hasn't been released and it's due Nov. 14. Please follow our iteration plan here: https://github.com/Microsoft/CNTK/wiki/Iteration-Plans

ddurschlag commented 6 years ago

Hi @cha-zhang -- it sounds like NetStandard targeting requires VS2k17, and VS2k17 requires CUDA9, and none of these made it for v2.3. Is that correct? If so, is it likely these might make v2.4?

cha-zhang commented 6 years ago

@ebarsoumMS can answer this.

helloguo commented 6 years ago

Does v2.3 support .NET Core?

ebarsoumMS commented 6 years ago

VS2017, CUDA9, cuDNN 7 and fp16 (volta) will be in 2.4 release. .net core if we can get it for 2.4 we will, if not it will be I the next release.

KichangKim commented 6 years ago

I checked that 2018-01-22 release doesn't have .net core support. Is it postponded to next release?

aaad commented 6 years ago

2018-03-15 release also doesn't have .net core support. Is it postponded to next release?

VoodooSV commented 6 years ago

v.2.5.0 still doesn't have .NET Core support :(

ddurschlag6river commented 6 years ago

With the move to VS2k17 and CUDA 9 in 2.4, is this now possible? @robinhad -- does that unblock your earlier work? It sounded promising.

olmobrutall commented 6 years ago

I have already translated Signum Framework to .Net Core 2.1, the only missing thing to start translating applications is the CNTK dependency.

I've seen that there is some progress there: https://github.com/Microsoft/CNTK/commits/master/bindings/csharp/CNTKLibraryManagedDll/CNTKLibraryManagedDll.csproj

When can we expect .Net Core support to be ready?

Thanks in advance!

ebarsoumMS commented 6 years ago

.Net Core 2 for Windows is already in master, Linux will follow soon. @davidbrownellMS

olmobrutall commented 6 years ago

Great! When will be available as Nuget?

olmobrutall commented 6 years ago

Hi again. Any progress on .Net Core?

Having any fuzzy-and-non-compromising estimate of when .Net Core will be supported (even if only for Windows and using pre-release Nuget) will be of great help to start migrating projects.

Thanks in advance.

ebarsoumMS commented 6 years ago

Hi @olmobrutall it is already in master and work for both Windows and Linux. You should be able to get from the nightly build. You can use the nightly build nuget package.

olmobrutall commented 6 years ago

Maybe I'm doing something wrong then:

image

Should I be using the UWP version?

Tixxx commented 6 years ago

The way we package the nugets in our Jenkins script is incorrect. It only assumes .net framework and therefore only packs for that one target. I will look into changing the packaging process to have net core packed in nightly build.

KichangKim commented 6 years ago

Current CNTK 2.6.0-rc0.dev20180731 in nuget does not work with .NET Core project. I wish next CNTK release supports .NET Standard 2.0 :)

olmobrutall commented 6 years ago

Looks like https://github.com/Microsoft/CNTK/blob/master/bindings/csharp/CNTKLibraryManagedDll/CNTKLibraryManagedDll.csproj is already targeting netstandard2.0 so it should work... Any idea @davidbrownellMS?

I would like to unblock this. Is this open for PRs? or only the .snk owners can test it?

Tixxx commented 6 years ago

The project itself is able to work with both netcore and netframework, it's the way we were packing the nugets. Since PackageManager looks at the lib path(i.e. net45 or netstandard2.0 etc) to determine the target framework, we were always packing the managed DLLs into net45 folder. I fixed our script yesterday to pack for netstandard2.0, but looks like our last nightly Windows build was failing which prevented the nugets from being published to nuget.org. We are looking into getting it all green now.

XavierGeerinck commented 6 years ago

Any update @Tixxx? :) would love to try it! standing ready to enter dotnet add <proj> package CNTK.CPUOnly --version <newversion> ;)

pksorensen commented 6 years ago

@Tixxx Awesome work, looking forward to seeing the new nuget package

olmobrutall commented 6 years ago

20 days without a daily 😔 Problems with publish script? Can we help somehow?

Tixxx commented 6 years ago

Apologize for the delay everyone. We have been fighting some test failures and infra issues which prevented the nugets from being uploaded. We have pushed a new version of CNTK nugets. I tested them with a net core app and it worked for me. Please give them a try and let me know if you see any issues.

olmobrutall commented 6 years ago

Hi @Tixxx, I’ve tried in a console application and works like a charm. Funny all this virtual dll files in the root folder.

I’ve had problems starting the web application. I’ll try harder tomorrow.

Thanks a lot!😺