今天试了一下baidu的torch ctc的安装:
pip install torch-baidu-ctc
发现使用下面的代码会报错:
import torch
from torch_baidu_ctc import ctc_loss, CTCLoss
然后就源码安装吧:
git clone --recursive https://github.com/jpuigcerver/pytorch-baidu-ctc.git
cd pytorch-baidu-ctc
python setup.py build
python setup.py install
测试一下:
python -m unittest torch_baidu_ctc.test
这里测试的时候注意,不要在编译的pytorch-baidu-ctc里面测试,否则会出现报错哦。
No module named 'torch_baidu_ctc._C', ERROR when installing from source
参考文献
[1]. No module named 'torch_baidu_ctc._C', ERROR when installing from source. https://github.com/jpuigcerver/pytorch-baidu-ctc/issues/1