forked from mozilla/DeepSpeech
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tc-train-tests.sh
79 lines (60 loc) · 2.33 KB
/
tc-train-tests.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
#!/bin/bash
set -xe
source $(dirname "$0")/tc-tests-utils.sh
pyver_full=$1
tf=$2
ds=$3
if [ -z "${pyver_full}" ]; then
echo "No python version given, aborting."
exit 1
fi;
pyver=$(echo "${pyver_full}" | cut -d':' -f1)
py_unicode_type=$(echo "${pyver_full}" | cut -d':' -f2)
if [ "${py_unicode_type}" = "m" ]; then
pyconf="ucs2"
elif [ "${py_unicode_type}" = "mu" ]; then
pyconf="ucs4"
fi;
unset PYTHON_BIN_PATH
unset PYTHONPATH
export PYENV_ROOT="${HOME}/ds-train/.pyenv"
export PATH="${PYENV_ROOT}/bin:${HOME}/bin:$PATH"
mkdir -p ${PYENV_ROOT} || true
mkdir -p ${TASKCLUSTER_ARTIFACTS} || true
mkdir -p /tmp/train || true
install_pyenv "${PYENV_ROOT}"
install_pyenv_virtualenv "$(pyenv root)/plugins/pyenv-virtualenv"
PYENV_NAME=deepspeech-train
PYTHON_CONFIGURE_OPTS="--enable-unicode=${pyconf}" pyenv install ${pyver}
pyenv virtualenv ${pyver} ${PYENV_NAME}
source ${PYENV_ROOT}/versions/${pyver}/envs/${PYENV_NAME}/bin/activate
if [ "${tf}" = "mozilla" ]; then
pip install --upgrade ${TENSORFLOW_WHEEL} | cat
grep -v "tensorflow" ${HOME}/DeepSpeech/ds/requirements.txt | pip install --upgrade -r /dev/stdin | cat
fi;
if [ "${tf}" = "upstream" ]; then
pip install --upgrade -r ${HOME}/DeepSpeech/ds/requirements.txt | cat
fi;
if [ "${ds}" = "deepspeech" ]; then
pip install "${DEEPSPEECH_PYTHON_PACKAGE}" | cat
python -c "import tensorflow; from deepspeech.utils import audioToInputVector"
# Since this build depends on the completion of the whole deepspeech package
# and we might get into funny situation with --config=monolithic, then let's
# be extra-cautious and leverage our dependency against the build to also
# test with libctc_decoder_with_kenlm.so that is packaged for release
download_native_client_files "/tmp/ds"
else
download_ctc_kenlm "/tmp/ds"
fi;
pushd ${HOME}/DeepSpeech/ds/
time ./bin/run-tc-ldc93s1.sh
popd
deactivate
pyenv uninstall --force ${PYENV_NAME}
cp /tmp/train/output_graph.pb ${TASKCLUSTER_ARTIFACTS}
if [ ! -z "${CONVERT_GRAPHDEF_MEMMAPPED}" ]; then
convert_graphdef=$(basename "${CONVERT_GRAPHDEF_MEMMAPPED}")
wget -P "/tmp/" "${CONVERT_GRAPHDEF_MEMMAPPED}" && chmod +x "/tmp/${convert_graphdef}"
/tmp/${convert_graphdef} --in_graph=/tmp/train/output_graph.pb --out_graph=/tmp/train/output_graph.pbmm
cp /tmp/train/output_graph.pbmm ${TASKCLUSTER_ARTIFACTS}
fi;