vad_go / install.sh
HoneyTian's picture
update
cc48e0c
raw
history blame
2.07 kB
#!/usr/bin/env bash
# bash install.sh --stage 0 --stop_stage 2
verbose=true;
stage=-1
stop_stage=0
# parse options
while true; do
[ -z "${1:-}" ] && break; # break if there are no arguments
case "$1" in
--*) name=$(echo "$1" | sed s/^--// | sed s/-/_/g);
eval '[ -z "${'"$name"'+xxx}" ]' && echo "$0: invalid option $1" 1>&2 && exit 1;
old_value="(eval echo \\$$name)";
if [ "${old_value}" == "true" ] || [ "${old_value}" == "false" ]; then
was_bool=true;
else
was_bool=false;
fi
# Set the variable to the right value-- the escaped quotes make it work if
# the option had spaces, like --cmd "queue.pl -sync y"
eval "${name}=\"$2\"";
# Check that Boolean-valued arguments are really Boolean.
if $was_bool && [[ "$2" != "true" && "$2" != "false" ]]; then
echo "$0: expected \"true\" or \"false\": $1 $2" 1>&2
exit 1;
fi
shift 2;
;;
*) break;
esac
done
work_dir="$(pwd)"
thirdparty_dir="$(pwd)/thirdparty"
pretrained_models_dir="$(pwd)/pretrained_models"
silero_vad_model_dir="${pretrained_models_dir}/silero_vad"
mkdir -p "${thirdparty_dir}"
mkdir -p "${pretrained_models_dir}"
mkdir -p "${silero_vad_model_dir}"
if [ ${stage} -le 0 ] && [ ${stop_stage} -ge 0 ]; then
$verbose && echo "stage 0: install onnxruntime"
cd "${thirdparty_dir}"
# install onnxruntime
wget https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-linux-x64-1.20.1.tgz
tar -zxvf onnxruntime-linux-x64-1.20.1.tgz
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$(pwd)/onnxruntime-linux-x64-1.20.1/include
export LIBRARY_PATH=$LIBRARY_PATH:$(pwd)/onnxruntime-linux-x64-1.20.1/lib
fi
if [ ${stage} -le 1 ] && [ ${stop_stage} -ge 1 ]; then
$verbose && echo "stage 1: download silero_vad.onnx"
cd "${silero_vad_model_dir}"
# download model
# https://github.com/snakers4/silero-vad/tree/master/src/silero_vad/data
wget https://github.com/snakers4/silero-vad/raw/refs/heads/master/src/silero_vad/data/silero_vad.onnx
fi