forked from gooofy/kaldi-adapt-lm
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path2-download-model.sh
84 lines (81 loc) · 3.21 KB
/
2-download-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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Download base model to adapt
echo "---------------------------BASE_MODEL_DOWNLOAD-------------------------------"
MODEL_LANG="help"
if [ -n "$1" ]; then
MODEL_LANG="$1"
fi
# Zamia Kaldi model
if [ -d "./model" ]; then
echo "Cleaning up old 'model' folder ..."
echo ""
rm -r "model"
fi
echo "Downloading ASR base model ..."
echo ""
if [ "$MODEL_LANG" = "en" ]; then
if [ ! -f "kaldi-generic-en-tdnn_250.zip" ]; then
wget https://github.com/fquirin/kaldi-adapt-lm/releases/download/v1.0.0/kaldi-generic-en-tdnn_250.zip
fi
unzip kaldi-generic-en-tdnn_250.zip -d model
elif [ "$MODEL_LANG" = "de" ]; then
if [ ! -f "kaldi-generic-de-tdnn_250.zip" ]; then
wget https://github.com/fquirin/kaldi-adapt-lm/releases/download/v1.0.0/kaldi-generic-de-tdnn_250.zip
fi
unzip kaldi-generic-de-tdnn_250.zip -d model
elif [ "$MODEL_LANG" = "de_zamia_org" ]; then
if [ ! -f "kaldi-generic-de-tdnn_250-r20190328.tar.xz" ]; then
wget https://goofy.zamia.org/zamia-speech/asr-models/kaldi-generic-de-tdnn_250-r20190328.tar.xz
fi
mkdir model && tar --strip-components=1 -xf kaldi-generic-de-tdnn_250-r20190328.tar.xz -C model
MODEL_LANG="de"
elif [ "$MODEL_LANG" = "en_zamia_org" ]; then
if [ ! -f "kaldi-generic-en-tdnn_250-r20190609.tar.xz" ]; then
wget https://goofy.zamia.org/zamia-speech/asr-models/kaldi-generic-en-tdnn_250-r20190609.tar.xz
fi
mkdir model && tar --strip-components=1 -xf kaldi-generic-en-tdnn_250-r20190609.tar.xz -C model
MODEL_LANG="en"
else
echo "Unknown language argument. Use one of: 'en', 'de', 'en_zamia_org', 'de_zamia_org'."
echo "To use your own model simply create the folder 'model' and place your files there."
echo "NOTE: Please check in advance if your model is compatible. You may need to rearrange files to match the required format."
fi
# Sequitur or Phonetisaurus for G2P ?
if [ -d "phonetisaurus" ]; then
echo "Downloading Phonetisaurus G2P model ..."
echo ""
if [ "$MODEL_LANG" = "en" ]; then
if [ ! -f "phonetisaurus_zamia_g2p_en.zip" ]; then
wget https://github.com/fquirin/kaldi-adapt-lm/releases/download/v1.0.0/phonetisaurus_zamia_g2p_en.zip
fi
unzip -u phonetisaurus_zamia_g2p_en.zip -d phonetisaurus
elif [ "$MODEL_LANG" = "de" ]; then
if [ ! -f "phonetisaurus_zamia_g2p_de.zip" ]; then
wget https://github.com/fquirin/kaldi-adapt-lm/releases/download/v1.0.0/phonetisaurus_zamia_g2p_de.zip
fi
unzip -u phonetisaurus_zamia_g2p_de.zip -d phonetisaurus
else
echo "No Phonetisaurus model found for language $MODEL_LANG"
echo "See README for instructions to train your own."
fi
fi
if [ -d "sequitur" ]; then
echo "Downloading Sequitur G2P model ..."
echo ""
if [ "$MODEL_LANG" = "en" ]; then
if [ ! -f "sequitur_g2p_zamia_en.zip" ]; then
wget https://github.com/fquirin/kaldi-adapt-lm/releases/download/v1.0.0/sequitur_g2p_zamia_en.zip
fi
unzip -u sequitur_g2p_zamia_en.zip -d sequitur
elif [ "$MODEL_LANG" = "de" ]; then
if [ ! -f "sequitur_g2p_zamia_de.zip" ]; then
wget https://github.com/fquirin/kaldi-adapt-lm/releases/download/v1.0.0/sequitur_g2p_zamia_de.zip
fi
unzip -u sequitur_g2p_zamia_de.zip -d sequitur
else
echo "No Sequitur model found for language $MODEL_LANG"
echo "See README for instructions to train your own."
fi
fi
echo ""
echo "DONE"