Skip to content

Commit

Permalink
torchserve 0.11.0 tests update (#271)
Browse files Browse the repository at this point in the history
Signed-off-by: sharvil10 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
sharvil10 and pre-commit-ci[bot] authored Aug 1, 2024
1 parent 3e4b6e7 commit 41af29b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pytorch/serving/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ docker container stop server

As demonstrated in the above example, models must be registered before they can be used for predictions. The best way to ensure models are pre-registered with ideal settings is to modify the included [config file](./config.properties) for the torchserve server.

> [!NOTE]
> Since torchserve 0.11.1 torchserve asks for token authentication for security. We've disabled it in the config.properties by setting `disable_token_authorization=true`. If you want to enable the authentication you can find more details in the [documentation](https://github.com/pytorch/serve/blob/master/docs/token_authorization_api.md).
> [!NOTE]
> Since torchserve 0.11.1 the model API has been disabled by default. We enable the model API by setting `enable_model_api=true` in provided config.properties.
1. Add your model to the config file

```properties
Expand Down
2 changes: 2 additions & 0 deletions pytorch/serving/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ allowed_urls=https://s3.amazonaws.com/.*,https://torchserve.pytorch.org/.*
ipex_enable=true
cpu_launcher_enable=true
cpu_launcher_args=--use_logical_core
disable_token_authorization=true
enable_model_api=true
1 change: 1 addition & 0 deletions pytorch/serving/model-store/grpc-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#
# For reference:
# https://docs.docker.com/develop/develop-images/build_enhancements/
set -e

apt-get -y update
apt-get -y install curl
Expand Down
2 changes: 2 additions & 0 deletions pytorch/serving/model-store/rest-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# For reference:
# https://docs.docker.com/develop/develop-images/build_enhancements/

set -e

apt-get -y update
apt-get -y install curl
# curl -O https://torchserve.pytorch.org/mar_files/squeezenet1_1.mar
Expand Down
4 changes: 4 additions & 0 deletions pytorch/serving/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ ipex-serving-rest-inference:
volumes:
- src: $PWD/pytorch/serving/model-store
dst: /home/model-server/model-store
- src: $PWD/pytorch/serving/wf-store
dst: /home/model-server/wf-store
env:
ENABLE_TORCH_PROFILER: 'true'
shm_size: 1g
Expand All @@ -65,6 +67,8 @@ ipex-serving-grpc-inference:
volumes:
- src: $PWD/pytorch/serving/model-store
dst: /home/model-server/model-store
- src: $PWD/pytorch/serving/wf-store
dst: /home/model-server/wf-store
env:
ENABLE_TORCH_PROFILER: 'true'
shm_size: 1g
Expand Down
4 changes: 3 additions & 1 deletion pytorch/serving/wf-store/rest-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# For reference:
# https://docs.docker.com/develop/develop-images/build_enhancements/

set -e

apt-get -y update
apt-get -y install curl

Expand All @@ -47,4 +49,4 @@ curl --fail -X POST http://127.0.0.1:8080/wfpredict/dog_breed_wf -T Dog1.jpg
curl --fail -O https://raw.githubusercontent.com/pytorch/serve/master/examples/Workflows/dog_breed_classification/model_input/Dog2.jpg
curl --fail -X POST http://127.0.0.1:8080/wfpredict/dog_breed_wf -T Dog2.jpg

rm -rf ./*.war ./Cat.jpg ./Dog1.jpg ./Dog2.jpg ../model-store/*.mar
rm -rf ./*.war ./Cat.jpg ./Dog1.jpg ./Dog2.jpg

0 comments on commit 41af29b

Please sign in to comment.