Introduction
How to clone this repo
sudo apt-get install git-lfs
git clone https://huggingface.co/csukuangfj/icefall-asr-librispeech-conformer-ctc-jit-bpe-500-2021-11-09
cd icefall-asr-librispeech-conformer-ctc-jit-bpe-500-2021-11-09
git lfs pull
Catuion: You have to run git lfs pull
. Otherwise, you will be SAD later.
Description
This repo provides pre-trained conformer CTC model for the librispeech dataset using icefall.
The commands for training are:
cd egs/librispeech/ASR/conformer_ctc
./prepare.sh
export CUDA_VISIBLE_DEVICES="0,1,2,3"
./conformer_ctc/train.py \
--exp-dir conformer_ctc/exp_500_att0.8 \
--lang-dir data/lang_bpe_500 \
--att-rate 0.8 \
--full-libri 1 \
--max-duration 200 \
--concatenate-cuts 0 \
--world-size 4 \
--bucketing-sampler 1 \
--start-epoch 00 \
--num-epochs 80
The command for decoding is:
./conformer_ctc/decode.py \
--exp-dir conformer_ctc/exp_500_att0.8 \
--lang-dir data/lang_bpe_500 \
--max-duration 30 \
--concatenate-cuts 0 \
--bucketing-sampler 1 \
--num-paths 1000 \
--epoch 77 \
--avg 55 \
--method attention-decoder \
--nbest-scale 0.5
You can find the log in this repo: log/log-decode-2021-11-09-17-38-28.
The best WER for the librispeech test dataset is:
test-clean | test-other | |
---|---|---|
WER | 2.42 | 5.73 |
The best scale values are:
ngram_lm_scale | attention_scale |
---|---|
2.0 | 2.0 |
File description
log/
, this directory contains the decoding logdata/
, this directory contains files generated by./prepare.sh
Note: For the data/lm
directory, we provide only G_4_gram.pt
. If you need other files
in this directory, please run ./prepare.sh
.
exp
, this directory contains two files:preprained.pt
andcpu_jit.pt
.
exp/pretrained.pt
is generated by the following command:
./conformer_ctc/export.py \
--epoch 77 \
--avg 55 \
--jit 0 \
--lang-dir data/lang_bpe_500 \
--exp-dir conformer_ctc/exp_500_att0.8
exp/cpu_jit.pt
is generated by the following command:
./conformer_ctc/export.py \
--epoch 77 \
--avg 55 \
--jit 1 \
--lang-dir data/lang_bpe_500 \
--exp-dir conformer_ctc/exp_500_att0.8
Deploy your model in C++ using k2
To deploy your model in C++ using k2 without depending on Python, do the following:
# Note: It requires torch >= 1.8.0
git clone https://github.com/k2-fsa/k2
cd k2
git checkout v2.0-pre
mkdir build_release
cd build_release
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j ctc_decode ngram_lm_rescore attention_rescore