Skip to content

Commit

Permalink
Adding test for Model Instance Kind Example added to Python Backend (t…
Browse files Browse the repository at this point in the history
…riton-inference-server#5444)

* Adding test for model instance kind python backend example.
  • Loading branch information
oandreeva-nv authored Mar 8, 2023
1 parent a5d269d commit fd64af4
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions qa/L0_backend_python/examples/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ SERVER_LOG="./inference_server.log"
RET=0
rm -fr *.log python_backend/

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

# Install `validators` for Model Instance Kind example
pip3 install validators

# Install JAX
if [ "$TEST_JETSON" == "0" ]; then
pip3 install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
Expand Down Expand Up @@ -378,6 +381,39 @@ if [ "$TEST_JETSON" == "0" ]; then
wait $SERVER_PID
fi

# Example 7

# Model Instance Kind
CLIENT_LOG="./model_instance_kind.log"
mkdir -p models/resnet50/1
cp examples/instance_kind/model.py models/resnet50/1/
cp examples/instance_kind/config.pbtxt models/resnet50/
run_server
if [ "$SERVER_PID" == "0" ]; then
echo -e "\n***\n*** Failed to start $SERVER\n***"
cat $SERVER_LOG
RET=1
fi

set +e
python3 examples/instance_kind/client.py --label_file examples/instance_kind/resnet50_labels.txt > $CLIENT_LOG
if [ $? -ne 0 ]; then
echo -e "\n***\n*** Failed to verify Model instance Kind example. \n***"
RET=1
fi

grep "PASS" $CLIENT_LOG
if [ $? -ne 0 ]; then
echo -e "\n***\n*** Failed to verify Model Instance Kind example. Example failed to pass. \n***"
cat $CLIENT_LOG
RET=1
fi
set -e

kill $SERVER_PID
wait $SERVER_PID


if [ $RET -eq 0 ]; then
echo -e "\n***\n*** Example verification test PASSED.\n***"
else
Expand Down

0 comments on commit fd64af4

Please sign in to comment.