热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

装CTC

https:github.comSeanNarenwarp-ctc下载下来,传到服务器上解压更名cdwarp-ctcmkdirbuild;cdbuildc

https://github.com/SeanNaren/warp-ctc

下载下来,传到服务器上

解压

更名

cd warp-ctc
mkdir build; cd build
cmake ..
make

上面这些过程缺啥装啥,失败了,把缺的东西装上,重复下面这个过程,直到成功

cd build

make clean

cmake .. make

 

下一步开始安装

cd pytorch_binding
python setup.py install

报下面这个错:

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
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
reading manifest file 'warpctc_pytorch.egg-info/SOURCES.txt'
writing manifest file 'warpctc_pytorch.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying warpctc_pytorch/_warp_ctc/__init__.py -> build/lib.linux-x86_64-3.6/warpctc_pytorch/_warp_ctc
running build_ext
building 'warpctc_pytorch._warp_ctc.__warp_ctc' extension
gcc -pthread -B /home1/fzp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-pib/include -I/home1/fzp/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home1/fzp/anaconda3/li-I/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/include -I/home1/fzp/anaconda3/include/python3.6m -c build/warpctc_pyto__warp_ctc.o -std=c++11 -fPIC -std=c99 -DWARPCTC_ENABLE_GPU
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C [enabled by default]
gcc -pthread -B /home1/fzp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-pib/include -I/home1/fzp/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home1/fzp/anaconda3/li-I/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/include -I/home1/fzp/anaconda3/include/python3.6m -c /home1/fzp/attenti4-3.6/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/pytorch_binding/src/binding.o -std=c++11 -fPIC -std=c99 -DWARPCTC_EN
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-std=c99’ is valid for C/ObjC but not for C++ [enabled by default]
/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/pytorch_binding/src/binding.cpp: In function ‘int gpu_ctc(THCudaTensor*, 
/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/pytorch_binding/src/binding.cpp:92:49: error: cannot convert ‘THCudaTensotTensor*, int)’
     int probs_size = THFloatTensor_size(probs, 2);
                                                 ^
/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/pytorch_binding/src/binding.cpp:105:61: error: invalid conversion from ‘s
     void* gpu_workspace = THCudaMalloc(state, gpu_size_bytes);
                                                             ^
/home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/pytorch_binding/src/binding.cpp:105:61: error: too few arguments to funct
In file included from /home1/fzp/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/THC.h:4:0,
                 from /home1/fzp/attention-OCR/warp-ctc-pytorch_bindings/pytorch_binding/src/binding.cpp:9:
/home1/fzp/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:209:21: note: declared h
 THC_API cudaError_t THCudaMalloc(THCState *state, void **ptr, size_t size);
                     ^
error: command 'gcc' failed with exit status 1
解决方案:

7.0.5和7.1.3版本的cudnn比较合适我的机器

(crnn) [xxx@xxxxxx crnn.pytorch-master]$ conda install cudnn==7.1.3
Fetching package metadata .........................
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
  - cudnn ==7.1.3 -> cudatoolkit 8.0*
  - libtorch-gpu -> cudatoolkit ==7.5
Use "conda info " to see the dependencies for each package.

报错,版本不对应

再卸载再安装:

conda uninstall cudatoolkit
Fetching package metadata .........................
Solving package specifications: .

Package plan for package removal in environment /export/gpudata/fujingling/conda/envs/crnn:

The following packages will be REMOVED:

    cudatoolkit:  7.5-2           http://conda.jdfin.local/conda/free
    libtorch-gpu: 0.1.12-0        http://conda.jdfin.local/conda/free
    nccl:         1.3.4-cuda7.5_1 http://conda.jdfin.local/conda/free

一个一个的装回去

 conda install cudatoolkit==8.0
Fetching package metadata .........................
Solving package specifications: .

Package plan for installation in environment /export/gpudata/fujingling/conda/envs/crnn:

The following NEW packages will be INSTALLED:

    cudatoolkit: 8.0-3 http://conda.jdfin.local/conda/free

Proceed ([y]/n)? y

 

装cudnn

 conda install cudnn==7.1.3(省略日志)

装pytorch

conda install pytorch==0.4
Fetching package metadata .........................
Solving package specifications: .

Package plan for installation in environment /export/gpudata/fujingling/conda/envs/crnn:

The following NEW packages will be INSTALLED:

    intel-openmp: 2019.0-118           http://repos.jd.com/conda/main     
    libgcc-ng:    8.2.0-hdf63c60_1     http://repos.jd.com/conda/main     
    libgfortran:  3.0.0-1              http://conda.jdfin.local/conda/free
    libstdcxx-ng: 8.2.0-hdf63c60_1     http://repos.jd.com/conda/main     
    nccl:         1.3.5-cuda9.0_0      http://repos.jd.com/conda/main     
    ninja:        1.7.2-0              http://conda.jdfin.local/conda/free
    openblas:     0.2.14-4             http://conda.jdfin.local/conda/free
    pytorch:      0.4.0-py27hdf912b8_0 http://repos.jd.com/conda/main     

The following packages will be UPDATED:

    cudatoolkit:  8.0-3                http://conda.jdfin.local/conda/free --> 9.0-h13b8566_0  http://repos.jd.com/conda/main     
    mkl:          2017.0.3-0           http://conda.jdfin.local/conda/free --> 2019.0-118      http://repos.jd.com/conda/main     

The following packages will be DOWNGRADED:

    cudnn:        7.1.3-cuda8.0_0      http://repos.jd.com/conda/main      --> 7.1.2-cuda9.0_0 http://repos.jd.com/conda/main     
    numpy:        1.13.1-py27_0        http://conda.jdfin.local/conda/free --> 1.10.2-py27_0   http://conda.jdfin.local/conda/free

Proceed ([y]/n)? y

最后经过一番折腾,我发现,把warp-ctc/pytorch_binding/warpctc_pytorch 这个文件夹移动到crnn工程的上一级目录下就好了


推荐阅读
author-avatar
越秀地产星汇凤凰近_681
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有