warp-ctc icon indicating copy to clipboard operation
warp-ctc copied to clipboard

这个支持win10安装warp-ctc吗?

Open QQ2737499951 opened this issue 5 years ago • 7 comments

我的环境是win10 +cuda9.2+vs2017,cmake 成功了。通过vs2017 编译成功了3个文件,warpctc.dll,warpctc.exp,warpctc.lib,生成项目“test_gpu.vcxproj”的操作 - 失败。 生成项目“test_cpu.vcxproj”的操作 - 失败。

然后我把编译成功了3个文件,warpctc.dll,warpctc.exp,warpctc.lib全部复制到 C:\Users\WWWW\warp-ctc\build目录下,运行 C:\Users\WWWW\warp-ctc\pytorch_binding>python setup.py install

C:\Users\WWWW\warp-ctc\pytorch_binding>python setup.py install Torch gpu = True lib_ext后缀= .dll generating build\warpctc_pytorch_warp_ctc__warp_ctc.c (already up-to-date) not modified: 'build\warpctc_pytorch\_warp_ctc\warp_ctc.c' running install running bdist_egg running egg_info creating warpctc_pytorch.egg-info writing warpctc_pytorch.egg-info\PKG-INFO writing dependency_links to warpctc_pytorch.egg-info\dependency_links.txt writing top-level names to warpctc_pytorch.egg-info\top_level.txt writing manifest file 'warpctc_pytorch.egg-info\SOURCES.txt' reading manifest file 'warpctc_pytorch.egg-info\SOURCES.txt' writing manifest file 'warpctc_pytorch.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py creating build\lib.win-amd64-3.6 creating build\lib.win-amd64-3.6\warpctc_pytorch copying warpctc_pytorch_init.py -> build\lib.win-amd64-3.6\warpctc_pytorch creating build\lib.win-amd64-3.6\warpctc_pytorch_warp_ctc copying warpctc_pytorch_warp_ctc_init.py -> build\lib.win-amd64-3.6\warpctc_pytorch_warp_ctc running build_ext building 'warpctc_pytorch._warp_ctc._warp_ctc' extension creating build\temp.win-amd64-3.6 creating build\temp.win-amd64-3.6\Release creating build\temp.win-amd64-3.6\Release\build creating build\temp.win-amd64-3.6\Release\build\warpctc_pytorch creating build\temp.win-amd64-3.6\Release\build\warpctc_pytorch_warp_ctc creating build\temp.win-amd64-3.6\Release\Users creating build\temp.win-amd64-3.6\Release\Users\WWWW creating build\temp.win-amd64-3.6\Release\Users\WWWW\warp-ctc creating build\temp.win-amd64-3.6\Release\Users\WWWW\warp-ctc\pytorch_binding creating build\temp.win-amd64-3.6\Release\Users\WWWW\warp-ctc\pytorch_binding\src D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-ID:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include" "-ID:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\TH" "-ID:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\THC" "-ID:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2/include" "-IC:\Program Files\NVIDIA Corporation\NvToolsExt/include" -IC:\Users\WWWW\warp-ctc\include "-ID:\Program Files\Python366\include" "-ID:\Program Files\Python366\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\ATLMFC\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /Tcbuild\warpctc_pytorch_warp_ctc_warp_ctc.c /Fobuild\temp.win-amd64-3.6\Release\build\warpctc_pytorch_warp_ctc_warp_ctc.obj -std=c99 -std=c++11 -fPIC -std=c99 -DWARPCTC_ENABLE_GPU cl: 命令行 warning D9002 :忽略未知选项“-std=c99” cl: 命令行 warning D9002 :忽略未知选项“-std=c++11” cl: 命令行 warning D9002 :忽略未知选项“-fPIC” cl: 命令行 warning D9002 :忽略未知选项“-std=c99” warp_ctc.c D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-ID:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include" "-ID:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\TH" "-ID:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\THC" "-ID:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2/include" "-IC:\Program Files\NVIDIA Corporation\NvToolsExt/include" -IC:\Users\WWWW\warp-ctc\include "-ID:\Program Files\Python366\include" "-ID:\Program Files\Python366\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\ATLMFC\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-ID:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /EHsc /TpC:\Users\WWWW\warp-ctc\pytorch_binding\src\binding.cpp /Fobuild\temp.win-amd64-3.6\Release\Users\WWWW\warp-ctc\pytorch_binding\src\binding.obj -std=c99 -std=c++11 -fPIC -std=c99 -DWARPCTC_ENABLE_GPU cl: 命令行 warning D9002 :忽略未知选项“-std=c99” cl: 命令行 warning D9002 :忽略未知选项“-std=c++11” cl: 命令行 warning D9002 :忽略未知选项“-fPIC” cl: 命令行 warning D9002 :忽略未知选项“-std=c99” binding.cpp D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\ATen/Error.h(69): warning C4275: 非 dll 接口 class“std::exception”用作 dll 接口 class“at::Error”的基 D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include\vcruntime_exception.h(43): note: 参见“std::exception”的声明 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\ATen/Error.h(69): note: 参见“at::Error”的声明 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\ATen/Error.h(70): warning C4251: “at::Error::what_without_backtrace”: class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 class“at::Error”的客户端使用 D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参见“std::basic_string<char,std::char_traits,std::allocator>”的声明 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\ATen/Error.h(71): warning C4251: “at::Error::what”: class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 class“at::Error”的客户端使用 D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参见“std::basic_string<char,std::char_traits,std::allocator>”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(115): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(116): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(117): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(118): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(120): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(121): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(122): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 d:\program files\python366\lib\site-packages\torch\lib\include\aten\Half-inl.h(123): warning C4244: “参数”: 从“int” 转换到“float”,可能丢失数据 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\ATen/Allocator.h(95): warning C4251: “at::InefficientStdFunctionContext::ptr”: class“std::unique_ptr<void,std::function<void (void *)>>”需要有 dll 接口由 struct“at::InefficientStdFunctionContext”的客户端使用 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\ATen/Allocator.h(95): note: 参见“std::unique_ptr<void,std::function<void (void *)>>”的声明 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\TH\THAllocator.h(71): warning C4251: “THMapAllocator::filename”: class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口由 class“THMapAllocator”的客户端使用 D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参见“std::basic_string<char,std::char_traits,std::allocator>”的声明 D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib\include\TH\THAllocator.h(77): warning C4251: “THMapAllocator::eventname”: class“std::basic_string<char,std::char_traits,std::allocator>”需要有 dll 接口 由 class“THMapAllocator”的客户端使用 D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include\xstring(4273): note: 参见“std::basic_string<char,std::char_traits,std::allocator>”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\THCHalf.h(24): warning C4190: “THC_float2half”有指 定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\THCBlas.h(11): warning C4190: “THCudaBlas_Hdot”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCStorage.h(29): warning C4190: “THCudaHalfStorage_get”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensor.h(129): warning C4190: “THCudaHalfTensor_get1d”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensor.h(130): warning C4190: “THCudaHalfTensor_get2d”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensor.h(131): warning C4190: “THCudaHalfTensor_get3d”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensor.h(132): warning C4190: “THCudaHalfTensor_get4d”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensorMathReduce.h(35): warning C4190: “THCudaHalfTensor_minall”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensorMathReduce.h(36): warning C4190: “THCudaHalfTensor_maxall”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 d:\program files\python366\lib\site-packages\torch\lib\include\thc\generic/THCTensorMathReduce.h(37): warning C4190: “THCudaHalfTensor_medianall”有指定的 C 链接,但返回了与 C 不兼容的 UDT“__half” d:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\cuda_fp16.hpp(147): note: 参见“__half”的声明 C:\Users\WWWW\warp-ctc\pytorch_binding\src\binding.cpp(39): warning C4244: “初始化”: 从“int64_t”转换到“int”,可能 丢失数据 C:\Users\WWWW\warp-ctc\pytorch_binding\src\binding.cpp(92): warning C4244: “初始化”: 从“int64_t”转换到“int”,可能 丢失数据 D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2/lib/x64" "/LIBPATH:C:\Program Files\NVIDIA Corporation\NvToolsExt/lib/x64" "/LIBPATH:D:\Program Files\Python366\lib\site-packages\torch\utils\ffi....\lib" /LIBPATH:C:\Users\WWWW\warp-ctc\build "/LIBPATH:D:\Program Files\Python366\libs" "/LIBPATH:D:\Program Files\Python366\PCbuild\amd64" "/LIBPATH:D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\ATLMFC\lib\x64" "/LIBPATH:D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:D:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" "/LIBPATH:D:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" warpctc.lib /EXPORT:PyInit___warp_ctc build\temp.win-amd64-3.6\Release\build\warpctc_pytorch_warp_ctc__warp_ctc.obj build\temp.win-amd64-3.6\Release\Users\WWWW\warp-ctc\pytorch_binding\src\binding.obj /OUT:build\lib.win-amd64-3.6\warpctc_pytorch_warp_ctc__warp_ctc.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\build\warpctc_pytorch_warp_ctc__warp_ctc.cp36-win_amd64.lib -Wl,-rpath,C:\Users\WWWW\warp-ctc\build LINK : warning LNK4044: 无法识别的选项“/Wl,-rpath,C:\Users\WWWW\warp-ctc\build”;已忽略 正在创建库 build\temp.win-amd64-3.6\Release\build\warpctc_pytorch_warp_ctc__warp_ctc.cp36-win_amd64.lib 和对象 build\temp.win-amd64-3.6\Release\build\warpctc_pytorch_warp_ctc__warp_ctc.cp36-win_amd64.exp binding.obj : error LNK2001: 无法解析的外部符号 __imp_THCState_getCurrentStream binding.obj : error LNK2001: 无法解析的外部符号 __imp_THFloatTensor_data binding.obj : error LNK2001: 无法解析的外部符号 __imp_THCudaMalloc binding.obj : error LNK2001: 无法解析的外部符号 __imp_THFloatTensor_storage binding.obj : error LNK2001: 无法解析的外部符号 __imp_THCudaTensor_data binding.obj : error LNK2001: 无法解析的外部符号 get_workspace_size binding.obj : error LNK2001: 无法解析的外部符号 "struct THCState * state" (?state@@3PEAUTHCState@@EA) binding.obj : error LNK2001: 无法解析的外部符号 __imp_THCudaTensor_storage binding.obj : error LNK2001: 无法解析的外部符号 __imp_THFloatTensor_size binding.obj : error LNK2001: 无法解析的外部符号 __imp_THCudaFree binding.obj : error LNK2001: 无法解析的外部符号 compute_ctc_loss binding.obj : error LNK2001: 无法解析的外部符号 __imp_THIntTensor_data build\lib.win-amd64-3.6\warpctc_pytorch_warp_ctc__warp_ctc.cp36-win_amd64.pyd : fatal error LNK1120: 12 个无法解析的外部命令 error: command 'D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\link.exe' failed with exit status 1120

C:\Users\WWWW\warp-ctc\pytorch_binding>

QQ2737499951 avatar Sep 23 '18 09:09 QQ2737499951

``# build.py import os import platform import sys from setuptools import setup, find_packages

from torch.utils.ffi import create_extension import torch

extra_compile_args = ['-std=c++11', '-fPIC', '-std=c99'] warp_ctc_path = "../build/"#/build/Release"

if torch.cuda.is_available() or "CUDA_HOME" in os.environ: enable_gpu = True print('Torch gpu = True') else: print("Torch was not built with CUDA support, not building warp-ctc GPU extensions.") enable_gpu = False

if platform.system() == 'Darwin':#达尔文系统 lib_ext = ".dylib" else: lib_ext = ".dll" #".so" #这些都是linux系统用的 ,win系统是.dll

print ("lib_ext后缀=",lib_ext)

headers = ['src/cpu_binding.h']

if enable_gpu: extra_compile_args += ['-DWARPCTC_ENABLE_GPU'] headers += ['src/gpu_binding.h']

if "WARP_CTC_PATH" in os.environ: warp_ctc_path = os.environ["WARP_CTC_PATH"] print("warp_ctc_path=",warp_ctc_path) if not os.path.exists(os.path.join(warp_ctc_path, "warpctc" + lib_ext)):#"libwarpctc" + lib_ext)): print(("Could not find warpctc" + lib_ext + " in {}.\n" "Build warp-ctc and set WARP_CTC_PATH to the location of" " libwarpctc.so (default is '../build')").format(warp_ctc_path)) sys.exit(1) include_dirs = [os.path.realpath('../include')]

ffi = create_extension( name='warpctc_pytorch._warp_ctc', package=True, language='c++', headers=headers, sources=['src/binding.cpp'], with_cuda=enable_gpu, include_dirs=include_dirs, library_dirs=[os.path.realpath(warp_ctc_path)], libraries=['warpctc'], extra_link_args=['-Wl,-rpath,' + os.path.realpath(warp_ctc_path)], extra_compile_args=extra_compile_args) ffi = ffi.distutils_extension() setup( name="warpctc_pytorch", version="0.1", description="PyTorch wrapper for warp-ctc", url="https://github.com/baidu-research/warp-ctc", author="Jared Casper, Sean Naren", author_email="[email protected], [email protected]", license="Apache", packages=find_packages(), ext_modules=[ffi], )

QQ2737499951 avatar Sep 23 '18 09:09 QQ2737499951

安装还是不成功,请问 要怎样修改?

生成项目“test_gpu.vcxproj”的操作 - 失败。 生成项目“test_cpu.vcxproj”的操作 - 失败。 这2个不影响吧?

warp-ctc是不是只支持linux?不支持win10安装吗? 谢谢

QQ2737499951 avatar Sep 23 '18 09:09 QQ2737499951

release X64 单独编译 test_gpu.vcxproj, 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 namespace "std" has no member "max" test_gpu c:\users\wwww\warp-ctc\tests\test.h 57

for (int a = 0; a < alphabet_size; ++a) max_activation = std::max(max_activation, acts[t*alphabet_size + a]);

QQ2737499951 avatar Sep 23 '18 10:09 QQ2737499951

不知道有没有人搞定了?请加QQ2737499951 沟通交流一下,谢谢

QQ2737499951 avatar Sep 23 '18 10:09 QQ2737499951

This version of code can't generate correct warpctc.dll in windows. I have resolve the errors, and code commit to https://github.com/amberblade/warp-ctc/

amberblade avatar Nov 23 '18 10:11 amberblade

还有问题的,可以加Q群264191384 注明(warp)共同研究

QQ2737499951 avatar May 14 '19 03:05 QQ2737499951

还有问题的,可以加Q群264191384 注明(warp)共同研究

付费加群。。。敛财啊.....

lmw0320 avatar Aug 17 '20 07:08 lmw0320