pkufool's picture
Update README.md
6eabed3
|
raw
history blame
6.76 kB
### training
```
#!/usr/bin/env bash
set -x
K2_ROOT=/path/to/k2
ICEFALL=/path/to/icefall
export PYTHONPATH=$K2_ROOT/k2/python:$PYTHONPATH
export PYTHONPATH=$K2_ROOT/build/lib:$PYTHONPATH
export PYTHONPATH=$ICEFALL:$PYTHONPATH
export CUDA_VISIBLE_DEVICES="0,1,2,3"
./pruned_transducer_stateless4/train.py \
--exp-dir pruned_transducer_stateless4/exp \
--full-libri 1 \
--dynamic-chunk-training 1 \
--short-chunk-size 32 \
--num-left-chunks 4 \
--causal-convolution 1 \
--max-duration 300 \
--world-size 4 \
--start-epoch 1 \
--num-epochs 30
```
### decoding
#### simulate streaming
```
#!/usr/bin/env bash
set -x
K2_ROOT=/path/to/k2
ICEFALL=/path/to/icefall
export PYTHONPATH=$K2_ROOT/k2/python:$PYTHONPATH
export PYTHONPATH=$K2_ROOT/build/lib:$PYTHONPATH
export PYTHONPATH=$ICEFALL:$PYTHONPATH
export CUDA_VISIBLE_DEVICES="0"
for size in 1 2 4 8 16 32; do
for left in 32 64 -1; do
./pruned_transducer_stateless4/decode.py \
--simulate-streaming 1 \
--decode-chunk-size ${size} \
--left-context ${left} \
--causal-convolution 1 \
--use-averaged-model 1 \
--epoch 29 \
--avg 6 \
--exp-dir ./pruned_transducer_stateless4/exp \
--max-sym-per-frame 1 \
--max-duration 1000 \
--decoding-method greedy_search
done
done
```
#### streaming
```
#!/usr/bin/env bash
set -x
K2_ROOT=/path/to/k2
ICEFALL=/path/to/icefall
export PYTHONPATH=$K2_ROOT/k2/python:$PYTHONPATH
export PYTHONPATH=$K2_ROOT/build/lib:$PYTHONPATH
export PYTHONPATH=$ICEFALL:$PYTHONPATH
export CUDA_VISIBLE_DEVICES="0"
#left_context=32
#chunk_size=8
left_context=64
chunk_size=16
for right in 0 2 4 8; do
./pruned_transducer_stateless4/streaming_decode.py \
--left-context ${left_context} \
--decode-chunk-size ${chunk_size} \
--right-context ${right} \
--exp-dir ./pruned_transducer_stateless4/exp \
--use-averaged-model 1 \
--epoch 29 \
--avg 6 \
--num-decode-streams 1000
done
```
### export
for pretrained.pt
```
python pruned_transducer_stateless4/export.py \
--exp-dir ./pruned_transducer_stateless4/exp \
--epoch 29 \
--avg 6 \
--streaming-model 1 \
--causal-convolution 1
```
for cpu_jit.pt
```
python pruned_transducer_stateless4/export.py \
--exp-dir ./pruned_transducer_stateless4/exp \
--epoch 29 \
--avg 6 \
--streaming-model 1 \
--causal-convolution 1 \
--jit 1
```
---
license: apache-2.0
---