Skip to content

Commit fd64af4

Browse files
authored
Adding test for Model Instance Kind Example added to Python Backend (#5444)
* Adding test for model instance kind python backend example.
1 parent a5d269d commit fd64af4

File tree

1 file changed

+39
-3
lines changed
  • qa/L0_backend_python/examples

1 file changed

+39
-3
lines changed

qa/L0_backend_python/examples/test.sh

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ SERVER_LOG="./inference_server.log"
3737
RET=0
3838
rm -fr *.log python_backend/
3939

40-
# Install torch
41-
# Skip torch install on Jetson since it is already installed.
40+
# Install torch
41+
# Skip torch and torchvision install on Jetson since it is already installed.
4242
if [ "$TEST_JETSON" == "0" ]; then
4343
pip3 uninstall -y torch
44-
pip3 install torch==1.13.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html
44+
pip3 install torch==1.13.0+cu117 -f https://download.pytorch.org/whl/torch_stable.html torchvision==0.14.0+cu117
4545
fi
4646

47+
# Install `validators` for Model Instance Kind example
48+
pip3 install validators
49+
4750
# Install JAX
4851
if [ "$TEST_JETSON" == "0" ]; then
4952
pip3 install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
@@ -378,6 +381,39 @@ if [ "$TEST_JETSON" == "0" ]; then
378381
wait $SERVER_PID
379382
fi
380383

384+
# Example 7
385+
386+
# Model Instance Kind
387+
CLIENT_LOG="./model_instance_kind.log"
388+
mkdir -p models/resnet50/1
389+
cp examples/instance_kind/model.py models/resnet50/1/
390+
cp examples/instance_kind/config.pbtxt models/resnet50/
391+
run_server
392+
if [ "$SERVER_PID" == "0" ]; then
393+
echo -e "\n***\n*** Failed to start $SERVER\n***"
394+
cat $SERVER_LOG
395+
RET=1
396+
fi
397+
398+
set +e
399+
python3 examples/instance_kind/client.py --label_file examples/instance_kind/resnet50_labels.txt > $CLIENT_LOG
400+
if [ $? -ne 0 ]; then
401+
echo -e "\n***\n*** Failed to verify Model instance Kind example. \n***"
402+
RET=1
403+
fi
404+
405+
grep "PASS" $CLIENT_LOG
406+
if [ $? -ne 0 ]; then
407+
echo -e "\n***\n*** Failed to verify Model Instance Kind example. Example failed to pass. \n***"
408+
cat $CLIENT_LOG
409+
RET=1
410+
fi
411+
set -e
412+
413+
kill $SERVER_PID
414+
wait $SERVER_PID
415+
416+
381417
if [ $RET -eq 0 ]; then
382418
echo -e "\n***\n*** Example verification test PASSED.\n***"
383419
else

0 commit comments

Comments
 (0)