forked from NVIDIA-AI-IOT/jetson-cloudnative-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_trtis.sh
executable file
·103 lines (91 loc) · 3.28 KB
/
run_trtis.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
CONTAINER_IMAGE="nvcr.io/nvidia/jetson-voice:r32.4.2"
ASR_MODEL="quartz"
show_help() {
echo " "
echo "usage: Starts the Docker container and TensorRT Inference Server"
echo " "
echo " ./scripts/docker_run_trtis.sh --container=<DOCKER_IMAGE>"
echo " --asr-model=<quartz|jasper>"
echo " "
echo "args:"
echo " "
echo " --help Show this help text and quit"
echo " "
echo " -c, --container=<DOCKER_IMAGE> Specifies the name of the Docker container"
echo " image to use (default: 'jetson-voice')"
echo " "
echo " --asr-model=<quartz|jasper> Selects Automatic Speech Recognition model"
echo " valid options are: quartz | quartz-v1 | jasper"
echo " default value is: quartz"
echo " "
}
die() {
printf '\n%s\n' "$1"
show_help
exit 1
}
# parse arguments
while :; do
case $1 in
-h|-\?|--help)
show_help # Display a usage synopsis.
exit
;;
-c|--container) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
CONTAINER_IMAGE=$2
shift
else
die 'ERROR: "--container" requires a non-empty option argument.'
fi
;;
--container=?*)
CONTAINER_IMAGE=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--container=) # Handle the case of an empty --image=
die 'ERROR: "--container" requires a non-empty option argument.'
;;
--asr-model) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
ASR_MODEL=$2
shift
else
die 'ERROR: "--asr-model" requires a non-empty option argument.'
fi
;;
--asr-model=?*)
ASR_MODEL=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--asr-model=) # Handle the case of an empty --image=
die 'ERROR: "--asr-model" requires a non-empty option argument.'
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
# validate ASR_MODEL
if [ "$ASR_MODEL" != "quartz" ] && [ "$ASR_MODEL" != "quartz-v1" ] && [ "$ASR_MODEL" != "jasper" ]; then
die "ERROR: invalid option for --asr-model=$ASR_MODEL (must be 'quartz', 'quartz-v1', or 'jasper')"
fi
echo "Container: $CONTAINER_IMAGE"
echo "ASR Model: $ASR_MODEL"
echo " "
sudo nvpmodel -m 2
sudo jetson_clocks
xhost +
# run the container
sudo xhost +si:localuser:root
sudo docker run -d --runtime nvidia -it --rm --network host -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix/:/tmp/.X11-unix \
--device /dev/bus/usb --device /dev/snd \
$CONTAINER_IMAGE \
trtserver --model-control-mode=none --model-repository=models/repository/jasper-asr-streaming-vad/