forked from pytorch/serve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
torchserve_sanity.sh
executable file
·64 lines (42 loc) · 1.33 KB
/
torchserve_sanity.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
#!/bin/bash
set -euxo pipefail
source scripts/install_utils
cleanup()
{
stop_torchserve
rm -rf model_store
rm -rf logs
}
install_pytest_suite_deps
run_backend_pytest
run_backend_python_linting
run_model_archiver_UT_suite
./scripts/install_from_src_ubuntu
run_model_archiver_IT_suite
mkdir -p model_store
start_torchserve
models=("fastrcnn" "fcn_resnet_101" "my_text_classifier" "resnet-18")
model_inputs=("examples/object_detector/persons.jpg" "examples/image_segmenter/fcn/persons.jpg" "examples/text_classification/sample_text.txt" "examples/image_classifier/kitten.jpg")
handlers=("object_detector" "image_segmenter" "text_classification" "image_classifier")
for i in ${!models[@]};
do
model=${models[$i]}
input=${model_inputs[$i]}
handler=${handlers[$i]}
register_model "$model"
run_inference "$model" "$input"
#skip unregistering resnet-18 model to test snapshot feature with restart
if [ "$model" != "resnet-18" ]
then
unregister_model "$model"
fi
echo "$handler default handler is stable."
done
stop_torchserve
# restarting torchserve
# this should restart with the generated snapshot and resnet-18 model should be automatically registered
start_torchserve
run_inference resnet-18 examples/image_classifier/kitten.jpg
stop_torchserve
cleanup
echo "CONGRATULATIONS!!! YOUR BRANCH IS IN STABLE STATE"