Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[s2t] install ctc_decoder for windows #2167

Merged
merged 8 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 17 additions & 18 deletions third_party/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
* [python_kaldi_features](https://github.com/ZitengWang/python_kaldi_features)
# python_kaldi_features

[python_kaldi_features](https://github.com/ZitengWang/python_kaldi_features)
commit: fc1bd6240c2008412ab64dc25045cd872f5e126c
ref: https://zhuanlan.zhihu.com/p/55371926
license: MIT

* [python-pinyin](https://github.com/mozillazg/python-pinyin.git)
commit: 55e524aa1b7b8eec3d15c5306043c6cdd5938b03
license: MIT
# Install ctc_decoder for Windows

* [zhon](https://github.com/tsroten/zhon)
commit: 09bf543696277f71de502506984661a60d24494c
license: MIT
`install_win_ctc.bat` is bat script to install paddlespeech_ctc_decoders for windows

* [pymmseg-cpp](https://github.com/pluskid/pymmseg-cpp.git)
commit: b76465045717fbb4f118c4fbdd24ce93bab10a6d
license: MIT
## Prepare your environment

* [chinese_text_normalization](https://github.com/speechio/chinese_text_normalization.git)
commit: 9e92c7bf2d6b5a7974305406d8e240045beac51c
license: MIT
insure your environment like this:

* [phkit](https://github.com/KuangDD/phkit.git)
commit: b2100293c1e36da531d7f30bd52c9b955a649522
license: None
* gcc: version >= 12.1.0
* cmake: version >= 3.24.0
* make: version >= 3.82.90
* visual studio: version >= 2019

* [nnAudio](https://github.com/KinWaiCheuk/nnAudio.git)
license: MIT
## Start your bat script

```shell
start install_win_ctc.bat

```
3 changes: 2 additions & 1 deletion third_party/ctc_decoders/scorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include "decoder_utils.h"

using namespace lm::ngram;

// if your platform is windows ,you need add the define
#define F_OK 0
Scorer::Scorer(double alpha,
double beta,
const std::string& lm_path,
Expand Down
3 changes: 2 additions & 1 deletion third_party/ctc_decoders/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ def compile_test(header, library):
or fn.endswith('unittest.cc'))
]
# yapf: enable

LIBS = ['stdc++']
if platform.system() != 'Darwin':
LIBS.append('rt')
if platform.system() == 'Windows':
LIBS = ['-static-libstdc++']

ARGS = ['-O3', '-DNDEBUG', '-DKENLM_MAX_ORDER=6', '-std=c++11']

Expand Down
21 changes: 21 additions & 0 deletions third_party/install_win_ctc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@echo off

cd ctc_decoders
if not exist kenlm (
git clone https://github.com/Doubledongli/kenlm.git
@echo.
)

if not exist openfst-1.6.3 (
echo "Download and extract openfst ..."
git clone https://gitee.com/koala999/openfst.git
ren openfst openfst-1.6.3
@echo.
)

if not exist ThreadPool (
git clone https://github.com/progschj/ThreadPool.git
@echo.
)
echo "Install decoders ..."
python setup.py install --num_processes 4