我在 macOS Sierra 10.12.2
VisualStudio Mac Preview 2 上使用NuGet当我尝试安装Microsoft CNTK软件包时:
Microsoft.Research.CNTK.CpuEval-acml 1.5.0
Microsoft.Research.CNTK.CpuEval-mkl 1.7.2
我收到了一些错误
Done Building Project "/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj" (restore target(s)) -- FAILED.
Build FAILED.
"/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj" (restore target) (1) ->
(Restore target) ->
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/NuGet.targets : error : Package Microsoft.Research.CNTK.CpuEval-acml 1.5.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.Research.CNTK.CpuEval-acml 1.5.0 supports: net45 (.NETFramework,Version=v4.5) [/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj]
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/NuGet.targets : error : One or more packages are incompatible with .NETCoreApp,Version=v1.0. [/Users/loretoparisi/Projects/CNTKDemo/CNTKDemo/CNTKDemo.csproj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:01.57
L'applicazione è stata terminata da un segnale: SIGHUP
Install failed. Rolling back...
Executing nuget actions took 3,48 sec
Unable to restore packages.
[UPDATE]
使用.NET控制台项目,可以通过NuGet预安装软件包CNTK.CPUOnly 2.0.0-beta8
。
顺便说一下,运行一个使用CNTK
包的基本示例代码,如[this] [1],改编自CNTK的简单示例Eval示例[here] [2]会导致异常:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CNTKLibraryCSBinding
at (wrapper managed-to-native) CNTK.CNTKLibPINVOKE+SWIGExceptionHelper:SWIGRegisterExceptionCallbacks_CNTKLib (CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate)
at CNTK.CNTKLibPINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
at CNTK.CNTKLibPINVOKE..cctor () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at CNTK.DeviceDescriptor.GetCPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTK.DeviceDescriptor.get_CPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTKDemo.MainClass.Main (System.String[] args) [0x0000b] in /Users/loretoparisi/Documents/Projects/AI/CNTKDemo/CNTKDemo/Program.cs:46
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CNTKLibraryCSBinding
at (wrapper managed-to-native) CNTK.CNTKLibPINVOKE+SWIGExceptionHelper:SWIGRegisterExceptionCallbacks_CNTKLib (CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate,CNTK.CNTKLibPINVOKE/SWIGExceptionHelper/ExceptionDelegate)
at CNTK.CNTKLibPINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
at CNTK.CNTKLibPINVOKE..cctor () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
--- End of inner exception stack trace ---
at CNTK.DeviceDescriptor.GetCPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTK.DeviceDescriptor.get_CPUDevice () [0x00000] in <0337cf7b3aa84dd9ab831eb8b7a1f934>:0
at CNTKDemo.MainClass.Main (System.String[] args) [0x0000b] in /Users/loretoparisi/Documents/Projects/AI/CNTKDemo/CNTKDemo/Program.cs:46
这是由于类型初始值设定项SWIGExceptionHelper
:
System.TypeInitializationException: The type initializer for 'CNTK.CNTKLibPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: CNTKLibraryCSBinding
- References on CNTK Github:see [here][3].
- Filed a Xamarin Bugzilla [here][4]:
[1]: https://gist.github.com/loretoparisi/61f5c7f8d1a21a7f59771f35c9092de6
[2]: https://github.com/Microsoft/CNTK/blob/master/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalExamples.cs
[3]: https://github.com/Microsoft/CNTK/issues/1288#issuecomment-272421564
[4]: https://bugzilla.xamarin.com/show_bug.cgi?id=51569
答案 0 :(得分:3)
CNTK Eval Nuget Package目前需要.NET 4.5。我不知道你使用的MonoFramework 4.8是否支持它。另外,C#Eval需要一些为Intel / AMD X64平台构建的本机dll,我不确定它们是否可以直接在你的MAC机器上运行?另一个问题:你有什么特别的理由使用Microsoft.Research.CNTK.CpuEval-acml 1.5.0吗?它被淘汰了,我们目前使用英特尔MKL而不是ACML,最新版本是微软CNTK Eval CPUOnly-mkl NuGet 2.0.0-beta7。请启用&#34;包含预发布&#34;搜索Nuget包时的选项,否则只能找到Microsoft CNTK Eval CPUOnly-mkl NuGet 1.7.2。