commit
285e0c9cad
@ -0,0 +1,11 @@
|
||||
# 1xt2x
|
||||
|
||||
Convert Deepspeech 1.8 released model to 2.x.
|
||||
|
||||
## Model
|
||||
* Deepspeech2x
|
||||
|
||||
## Exp
|
||||
* baidu_en8k
|
||||
* aishell
|
||||
* librispeech
|
@ -0,0 +1,4 @@
|
||||
# Utils
|
||||
|
||||
* [kaldi utils](https://github.com/kaldi-asr/kaldi/blob/cbed4ff688/egs/wsj/s5/utils)
|
||||
* [espnet utils)(https://github.com/espnet/espnet/tree/master/utils)
|
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# 2020 author Jiayu DU
|
||||
# Apache 2.0
|
||||
|
||||
# This script reads in an Arpa format language model, and converts it into the
|
||||
# KenLM format language model.
|
||||
|
||||
[ -f path.sh ] && . ./path.sh;
|
||||
|
||||
# begin configuration section
|
||||
kenlm_opts="" # e.g. "-q 8 -b 8" for 8bits quantization
|
||||
model_type="trie" # "trie" or "probing". trie is smaller, probing is faster.
|
||||
# end configuration section
|
||||
|
||||
. utils/parse_options.sh
|
||||
|
||||
if [ $# != 2 ]; then
|
||||
echo "Usage: "
|
||||
echo " $0 [options] <arpa-lm-path> <kenlm-path>"
|
||||
echo "e.g.:"
|
||||
echo " $0 data/local/lm/4gram.arpa data/lang_test/G.trie"
|
||||
echo "Options:"
|
||||
echo " --model-type can be either \"trie\" or \"probing\""
|
||||
echo " --kenlm-opts directly pass through to kenlm"
|
||||
echo " e.g. for 8bits quantization, feed \"-q 8 -b 8\""
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
arpa_lm=$1
|
||||
kenlm=$2
|
||||
|
||||
if ! which build_binary >& /dev/null ; then
|
||||
echo "$0: cannot find KenLM's build_binary tool,"
|
||||
echo "check kenlm installation (tools/extras/install_kenlm_query_only.sh)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p $(dirname $kenlm)
|
||||
build_binary $kenlm_opts $model_type $arpa_lm $kenlm
|
||||
|
||||
echo "$0: Successfully built arpa into kenlm format: $kenlm"
|
||||
exit 0
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue