forked from gooofy/kaldi-adapt-lm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path4a-build-vosk-model.sh
36 lines (36 loc) · 1.56 KB
/
4a-build-vosk-model.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Collect all files of the adapted model (work folder) and build a Vosk-ASR compatible model
set -e
echo ---------------------------COLLECT-------------------------------
ORG_MODEL="model"
WORK_DIR="work"
TARGET_DIR="adapted_model"
if [ -n "$1" ]; then
TARGET_DIR="$1"
fi
if [ -d "${TARGET_DIR}" ]; then
echo "Removing old folder: ${TARGET_DIR} ..."
rm -r "${TARGET_DIR}"
fi
mkdir -p "${TARGET_DIR}/am"
mkdir -p "${TARGET_DIR}/conf"
mkdir -p "${TARGET_DIR}/graph/phones"
mkdir -p "${TARGET_DIR}/ivector"
# collect
echo "Collecting files ..."
cp $WORK_DIR/exp/adapt/final.mdl "${TARGET_DIR}/am/final.mdl"
cp $WORK_DIR/conf/mfcc_hires.conf "${TARGET_DIR}/conf/mfcc.conf"
cp $WORK_DIR/exp/adapt/graph/HCLG.fst "${TARGET_DIR}/graph/HCLG.fst"
cp $WORK_DIR/exp/adapt/graph/num_pdfs "${TARGET_DIR}/graph/num_pdfs"
cp $WORK_DIR/exp/adapt/graph/num_pdfs "${TARGET_DIR}/graph/num_pdfs"
cp $WORK_DIR/exp/adapt/graph/phones.txt "${TARGET_DIR}/graph/phones.txt"
cp $WORK_DIR/exp/adapt/graph/words.txt "${TARGET_DIR}/graph/words.txt"
cp $WORK_DIR/exp/adapt/graph/phones/word_boundary.int "${TARGET_DIR}/graph/phones/word_boundary.int"
cp $WORK_DIR/exp/extractor/* "${TARGET_DIR}/ivector/"
rm "${TARGET_DIR}/ivector/splice_opts"
cp $WORK_DIR/conf/online_cmvn.conf "${TARGET_DIR}/ivector/online_cmvn.conf"
# copy from original model (this is kind of a default file that should probably be tweaked further)
cp $ORG_MODEL/conf/model.conf "${TARGET_DIR}/conf/model.conf"
cp $ORG_MODEL/ivectors_test_hires/conf/splice.conf "${TARGET_DIR}/ivector/splice.conf"
echo "DONE"
echo "Check folder: ${TARGET_DIR}"