Introduction

How to clone this repo

sudo apt-get install git-lfs
git clone https://huggingface.co/csukuangfj/icefall-asr-librispeech-transducer-stateless-bpe-500-2021-12-22


cd icefall-asr-librispeech-transducer-stateless-bpe-500-2021-12-22
git lfs pull

Catuion: You have to run git lfs pull. Otherwise, you will be SAD later.

The model in this repo is trained using the commit fb6a57e9e01dd8aae2af2a6b4568daad8bc8ab32.

You can use

git clone https://github.com/k2-fsa/icefall
cd icefall
git checkout fb6a57e9e01dd8aae2af2a6b4568daad8bc8ab32

to download icefall.

You can find the model information by visiting https://github.com/k2-fsa/icefall/blob/fb6a57e9e01dd8aae2af2a6b4568daad8bc8ab32/egs/librispeech/ASR/transducer_stateless/train.py#L195.

In short, the encoder is a Conformer model with 8 heads, 12 encoder layers, 512-dim attention, 2048-dim feedforward; the decoder contains a 1024-dim embedding layer and a Conv1d with kernel size 2.

The decoder architecture is modified from Rnn-Transducer with Stateless Prediction Network. A Conv1d layer is placed right after the input embedding layer.


Description

This repo provides pre-trained transducer Conformer model for the LibriSpeech dataset using icefall. There are no RNNs in the decoder. The decoder is stateless and contains only an embedding layer and a Conv1d.

The commands for training are:

cd egs/librispeech/ASR/
./prepare.sh
export CUDA_VISIBLE_DEVICES="0,1,2,3"
./transducer_stateless/train.py \
  --world-size 4 \
  --num-epochs 30 \
  --start-epoch 0 \
  --exp-dir transducer_stateless/exp-full \
  --full-libri 1 \
  --max-duration 250 \
  --lr-factor 3

The tensorboard training log can be found at https://tensorboard.dev/experiment/PsJ3LgkEQfOmzedAlYfVeg/#scalars&_smoothingWeight=0

The command for decoding is:

epoch=20
avg=10

## greedy search
./transducer_stateless/decode.py \
  --epoch $epoch \
  --avg $avg \
  --exp-dir transducer_stateless/exp-full \
  --bpe-model ./data/lang_bpe_500/bpe.model \
  --max-duration 100

## beam search
./transducer_stateless/decode.py \
  --epoch $epoch \
  --avg $avg \
  --exp-dir transducer_stateless/exp-full \
  --bpe-model ./data/lang_bpe_500/bpe.model \
  --max-duration 100 \
  --decoding-method beam_search \
  --beam-size 4

You can find the decoding log for the above command in this repo (in the folder log).

The WERs for the test datasets are

test-clean test-other comment
greedy search 2.99 7.52 --epoch 20, --avg 10, --max-duration 100
beam search (beam size 2) 2.95 7.43
beam search (beam size 3) 2.94 7.37
beam search (beam size 4) 2.92 7.37
beam search (beam size 5) 2.93 7.38
beam search (beam size 8) 2.92 7.38

File description

exp/pretrained.pt is generated by the following command:

./transducer_stateless/export.py \
  --epoch 20 \
  --avg 10 \
  --bpe-model data/lang_bpe_500/bpe.model \
  --exp-dir transducer_stateless/exp-full

HINT: To use pre-trained.pt to compute the WER for test-clean and test-other, just do the following:

cp icefall-asr-librispeech-transducer-stateless-bpe-500-2021-12-22/exp/pretrained.pt \
  /path/to/icefall/egs/librispeech/ASR/transducer_stateless/exp/epoch-999.pt

and pass --epoch 999 --avg 1 to transducer_stateless/decode.py.