csukuangfj commited on
Commit
990ab50
1 Parent(s): a227b40

Update README.

Browse files
Files changed (1) hide show
  1. README.md +152 -0
README.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Introduction
2
+
3
+ This repo contains pre-trained model using
4
+ <https://github.com/k2-fsa/icefall/pull/219>.
5
+
6
+ It is trained on [AIShell](https://www.openslr.org/33/) dataset
7
+ using modified transducer from [optimized_transducer](https://github.com/csukuangfj/optimized_transducer).
8
+ Also, it uses [aidatatang_200zh](http://www.openslr.org/62/) as extra training data.
9
+
10
+ ## How to clone this repo
11
+ ```
12
+ sudo apt-get install git-lfs
13
+ git clone https://huggingface.co/csukuangfj/icefall-aishell-transducer-stateless-modified-2-2022-03-01
14
+
15
+ cd icefall-aishell-transducer-stateless-modified-2-2022-03-01
16
+ git lfs pull
17
+ ```
18
+
19
+ **Catuion**: You have to run `git lfs pull`. Otherwise, you will be SAD later.
20
+
21
+ The model in this repo is trained using the commit `TODO`.
22
+
23
+ You can use
24
+
25
+ ```
26
+ git clone https://github.com/k2-fsa/icefall
27
+ cd icefall
28
+ git checkout TODO
29
+ ```
30
+ to download `icefall`.
31
+
32
+ You can find the model information by visiting <https://github.com/k2-fsa/icefall/blob/TODO/egs/aishell/ASR/transducer_stateless_modified-2/train.py#L232>.
33
+
34
+
35
+ In short, the encoder is a Conformer model with 8 heads, 12 encoder layers, 512-dim attention, 2048-dim feedforward;
36
+ the decoder contains a 512-dim embedding layer and a Conv1d with kernel size 2.
37
+
38
+ The decoder architecture is modified from
39
+ [Rnn-Transducer with Stateless Prediction Network](https://ieeexplore.ieee.org/document/9054419).
40
+ A Conv1d layer is placed right after the input embedding layer.
41
+
42
+ -----
43
+
44
+ ## Description
45
+
46
+ This repo provides pre-trained transducer Conformer model for the AIShell dataset
47
+ using [icefall][icefall]. There are no RNNs in the decoder. The decoder is stateless
48
+ and contains only an embedding layer and a Conv1d.
49
+
50
+ The commands for training are:
51
+
52
+ ```bash
53
+ cd egs/aishell/ASR
54
+ ./prepare.sh --stop-stage 6
55
+ ./prepare_aidatatang_200zh.sh
56
+
57
+ export CUDA_VISIBLE_DEVICES="0,1,2"
58
+
59
+ ./transducer_stateless_modified-2/train.py \
60
+ --world-size 3 \
61
+ --num-epochs 90 \
62
+ --start-epoch 0 \
63
+ --exp-dir transducer_stateless_modified-2/exp-2 \
64
+ --max-duration 250 \
65
+ --lr-factor 2.0 \
66
+ --context-size 2 \
67
+ --modified-transducer-prob 0.25 \
68
+ --datatang-prob 0.2
69
+ ```
70
+
71
+ The tensorboard training log can be found at
72
+ <https://tensorboard.dev/experiment/oG72ZlWaSGua6fXkcGRRjA/>
73
+
74
+ The commands for decoding are
75
+
76
+ ```bash
77
+ # greedy search
78
+ for epoch in 89; do
79
+ for avg in 38; do
80
+ ./transducer_stateless_modified-2/decode.py \
81
+ --epoch $epoch \
82
+ --avg $avg \
83
+ --exp-dir transducer_stateless_modified-2/exp-2 \
84
+ --max-duration 100 \
85
+ --context-size 2 \
86
+ --decoding-method greedy_search \
87
+ --max-sym-per-frame 1
88
+ done
89
+ done
90
+
91
+ # modified beam search
92
+ for epoch in 89; do
93
+ for avg in 38; do
94
+ ./transducer_stateless_modified-2/decode.py \
95
+ --epoch $epoch \
96
+ --avg $avg \
97
+ --exp-dir transducer_stateless_modified-2/exp-2 \
98
+ --max-duration 100 \
99
+ --context-size 2 \
100
+ --decoding-method modified_beam_search \
101
+ --beam-size 4
102
+ done
103
+ done
104
+ ```
105
+
106
+ You can find the decoding log for the above command in this
107
+ repo (in the folder [log][log]).
108
+
109
+ The WER for the test dataset is
110
+
111
+ | | test |comment |
112
+ |------------------------|------|----------------------------------------------------------------|
113
+ | greedy search | 4.94 |--epoch 89, --avg 38, --max-duration 100, --max-sym-per-frame 1 |
114
+ | modified beam search | 4.68 |--epoch 89, --avg 38, --max-duration 100 --beam-size 4 |
115
+
116
+ # File description
117
+
118
+ - [log][log], this directory contains the decoding log and decoding results
119
+ - [test_wavs][test_wavs], this directory contains wave files for testing the pre-trained model
120
+ - [data][data], this directory contains files generated by [prepare.sh][prepare]
121
+ - [exp][exp], this directory contains only one file: `preprained.pt`
122
+
123
+ `exp/pretrained.pt` is generated by the following command:
124
+
125
+ ```bash
126
+ epoch=89
127
+ avg=38
128
+
129
+ ./transducer_stateless_modified-2/export.py \
130
+ --exp-dir ./transducer_stateless_modified-2/exp-2 \
131
+ --lang-dir ./data/lang_char \
132
+ --epoch $epoch \
133
+ --avg $avg
134
+ ```
135
+
136
+ **HINT**: To use `pretrained.pt` to compute the WER for the `test` dataset,
137
+ just do the following:
138
+
139
+ ```bash
140
+ cp icefall-aishell-transducer-stateless-modified-2-2022-03-01/exp/pretrained.pt \
141
+ /path/to/icefall/egs/aishell/ASR/transducer_stateless_modified-2/exp/epoch-999.pt
142
+ ```
143
+ and pass `--epoch 999 --avg 1` to `transducer_stateless_modified-2/decode.py`.
144
+
145
+
146
+ [icefall]: https://github.com/k2-fsa/icefall
147
+ [prepare]: https://github.com/k2-fsa/icefall/blob/master/egs/aishell/ASR/prepare.sh
148
+ [exp]: https://huggingface.co/csukuangfj/icefall-aishell-transducer-stateless-modified-2-2022-03-01/tree/main/exp
149
+ [data]: https://huggingface.co/csukuangfj/icefall-aishell-transducer-stateless-modified-2-2022-03-01/tree/main/data
150
+ [test_wavs]: https://huggingface.co/csukuangfj/icefall-aishell-transducer-stateless-modified-2-2022-03-01/tree/main/test_wavs
151
+ [log]: https://huggingface.co/csukuangfj/icefall-aishell-transducer-stateless-modified-2-2022-03-01/tree/main/log
152
+ [icefall]: https://github.com/k2-fsa/icefall