适用于 Mac 的 NuGet 和 VisualStudio 上的 Microsoft CNTK
Microsoft CNTK on NuGet and VisualStudio for Mac
我在 VisualStudio Mac Preview 2 macOS Sierra 10.12.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.
[更新]
使用 .NET 控制台项目可以通过 NuGet 安装预发布包 CNTK.CPUOnly 2.0.0-beta8
。
顺便说一下 运行 一个使用 CNTK
包的基本示例代码,例如 [this][1] 改编自 CNTK Eval 示例的简单示例 [此处][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
CNTK Eval Nuget 包当前需要 .NET 4.5。不知道你用的MonoFramework 4.8支持不支持。此外,C# Eval 需要一些为 Intel/AMD X64 平台构建的原生 dll,我不确定它们是否可以直接 运行 在您的 MAC 机器上?另一个问题:你有什么特别的理由使用 Microsoft.Research.CNTK.CpuEval-acml 1.5.0 吗?它已被弃用,我们目前使用 Intel MKL 而不是 ACML,最新版本是 Microsoft CNTK Eval CPUOnly-mkl NuGet 2.0.0-beta7。搜索Nuget包时请启用"include pre-release"选项,否则只能搜索Microsoft CNTK Eval CPUOnly-mkl NuGet 1.7.2.
我在 VisualStudio Mac Preview 2 macOS Sierra 10.12.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.
[更新]
使用 .NET 控制台项目可以通过 NuGet 安装预发布包 CNTK.CPUOnly 2.0.0-beta8
。
顺便说一下 运行 一个使用 CNTK
包的基本示例代码,例如 [this][1] 改编自 CNTK Eval 示例的简单示例 [此处][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
CNTK Eval Nuget 包当前需要 .NET 4.5。不知道你用的MonoFramework 4.8支持不支持。此外,C# Eval 需要一些为 Intel/AMD X64 平台构建的原生 dll,我不确定它们是否可以直接 运行 在您的 MAC 机器上?另一个问题:你有什么特别的理由使用 Microsoft.Research.CNTK.CpuEval-acml 1.5.0 吗?它已被弃用,我们目前使用 Intel MKL 而不是 ACML,最新版本是 Microsoft CNTK Eval CPUOnly-mkl NuGet 2.0.0-beta7。搜索Nuget包时请启用"include pre-release"选项,否则只能搜索Microsoft CNTK Eval CPUOnly-mkl NuGet 1.7.2.