Skip to content
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

Support for netcoreapp2.0 #2352

Open
robinhad opened this issue Sep 14, 2017 · 61 comments
Open

Support for netcoreapp2.0 #2352

robinhad opened this issue Sep 14, 2017 · 61 comments
Assignees

Comments

@robinhad
Copy link

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

@cha-zhang
Copy link
Member

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

@robinhad
Copy link
Author

robinhad commented Sep 15, 2017 via email

@KichangKim
Copy link

KichangKim commented Sep 17, 2017

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
Copy link

JimSEOW commented Sep 17, 2017

@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
Copy link
Contributor

liqunfu commented Sep 18, 2017

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
Copy link
Author

@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
Copy link
Contributor

liqunfu commented Sep 20, 2017

@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
Copy link

@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
Copy link
Author

robinhad commented Sep 21, 2017

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

@KichangKim
Copy link

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

@grzsz
Copy link

grzsz commented Sep 25, 2017

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
Copy link
Contributor

Ark-kun commented Sep 27, 2017

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

@JimSEOW
Copy link

JimSEOW commented Sep 27, 2017

@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
Copy link
Author

@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
Copy link
Author

@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
Copy link
Contributor

Ark-kun commented Sep 28, 2017

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

@robinhad
Copy link
Author

@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
Copy link
Author

robinhad commented Oct 3, 2017

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

@cha-zhang
Copy link
Member

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

@robinhad
Copy link
Author

robinhad commented Oct 3, 2017

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

@cha-zhang
Copy link
Member

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

@robinhad
Copy link
Author

robinhad commented Oct 4, 2017

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

@robinhad
Copy link
Author

robinhad commented Oct 4, 2017

@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
Copy link
Member

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

@robinhad
Copy link
Author

robinhad commented Oct 4, 2017

@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
Copy link

@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
Copy link
Member

@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

@olmobrutall
Copy link

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
Copy link
Contributor

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

@olmobrutall
Copy link

Great! When will be available as Nuget?

@olmobrutall
Copy link

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
Copy link
Contributor

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
Copy link

Maybe I'm doing something wrong then:

image

Should I be using the UWP version?

@Tixxx
Copy link
Contributor

Tixxx commented Aug 3, 2018

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
Copy link

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
Copy link

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
Copy link
Contributor

Tixxx commented Aug 7, 2018

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
Copy link

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

@pksorensen
Copy link

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

@olmobrutall
Copy link

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

@Tixxx
Copy link
Contributor

Tixxx commented Aug 21, 2018

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
Copy link

olmobrutall commented Aug 21, 2018

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!😺

@Tixxx
Copy link
Contributor

Tixxx commented Aug 21, 2018

Sounds good @olmobrutall .
As for the virtual dlls, it's because in our .targets files we have
"PreserveNewest" for each included item, the packageReference style didn't show these in solution explorer but i think with the new SDK-style projects, all externals are shown now. We can try putting False for each item when packing the nugets. Are these dlls causing too much noise for you?

@KichangKim
Copy link

@Tixxx
Thanks for .net core supporting!

For the virtual dlls, some projects (like https://github.com/shimat/opencvsharp ) makes their native dlls into subfolder called "dll/x86/" or "dll/x64" so the project view is very clean.

@KichangKim
Copy link

@Tixxx Also, I found that newest build throw System.StackOverflowException on Trainer.TrainMinibatch().

My code did work with CNTK.GPU v2.5.1 (.NET Framework 4.7.1) and exactly same code throws above exception with CNTK.GPU v2.6.0-rc0.dev20180821 (.NET Core 2.1).

Both test uses saved model and checkpoint data from 2.5.1.

@Tixxx
Copy link
Contributor

Tixxx commented Aug 22, 2018

@kkc0923 Thanks for the link.
For the other exception you are seeing, do you mind opening another issue? It would be great if you can paste you code there as well. We have daily end-to-end tests to test that code path and they have been passing all along. If this is a regression, we will need to fix it asap. Thanks.

@KichangKim
Copy link

@Tixxx I created seperated issue ticket with minimum reproducible code. #3368
I hope this will help you.

@pksorensen
Copy link

Another issue that i ran into, https://stackoverflow.com/questions/51974745/how-to-load-a-onnx-model-with-cntk-on-dotnet-core

If i do a normal console app in visual studio and use latest stable version from nuget it loads and works fine. Have not figured out why it dont work with dotnet core/new csproj format.

@olmobrutall
Copy link

olmobrutall commented Aug 23, 2018

@Tixxx web app works perfectly too! Thanks!

@pksorensen
Copy link

I created a repro here with a none working 2.6 example: https://github.com/pksorensen/cntk-issue-26

@Tixxx
Copy link
Contributor

Tixxx commented Aug 24, 2018

@pksorensen I tested your app, it looks like the exception is agnostic to .net platform but related to cntk version because i see it fails on both net framework and netcore with 2.6.0-rc0.dev20180821 but passes for 2.5.1 on net framework. I'm suspecting this might be related to how the model was generated. That particular "attribute is missing type" exception only happens if the onnx IR version is >= 2 which is the case in 2.6.0, I need to get confirmation of what the IR version is in 2.5.1. Meanwhile if you can refer to this similar issue(onnx/models#9) in ONNX to see if adding type INT on the "axis" attribute in your model helps that would be great. If not, please open another issue for us to track as this thread for net core support topic. Thanks.

@pksorensen
Copy link

Thanks @Tixxx - as i downloaded the model from the model zoo thing, i cannot update it myself. But i will try to see if i can regenerate the onnx file and take it from there.

@pksorensen
Copy link

problem was solved with newer model . thanks @Tixxx

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

No branches or pull requests