From 34e5a0b2c80ffaa541f5531bcd98a6b3c21369fd Mon Sep 17 00:00:00 2001 From: allegroai Date: Sun, 6 Mar 2022 03:14:06 +0200 Subject: [PATCH] Fix routing --- clearml_serving/serving/main.py | 3 +++ examples/pytorch/readme.md | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/clearml_serving/serving/main.py b/clearml_serving/serving/main.py index 96f8127..2b67327 100644 --- a/clearml_serving/serving/main.py +++ b/clearml_serving/serving/main.py @@ -79,6 +79,9 @@ router = APIRouter( ) +# cover all routing options for model version `/{model_id}`, `/{model_id}/123`, `/{model_id}?version=123` +@router.post("/{model_id}/{version}") +@router.post("/{model_id}/") @router.post("/{model_id}") async def serve_model(model_id: str, version: Optional[str] = None, request: Dict[Any, Any] = None): try: diff --git a/examples/pytorch/readme.md b/examples/pytorch/readme.md index 2ea4a26..13d4579 100644 --- a/examples/pytorch/readme.md +++ b/examples/pytorch/readme.md @@ -17,14 +17,14 @@ The output will be a model created on the project "serving examples", by the nam 2. Create model endpoint: `clearml-serving --id model add --engine triton --endpoint "test_model_pytorch" --preprocess "examples/pytorch/preprocess.py" --name "train pytorch model" --project "serving examples" - --input-size 28 28 1 --input-name "INPUT__0" --input-type float32 + --input-size 1 28 28 --input-name "INPUT__0" --input-type float32 --output-size -1 10 --output-name "OUTPUT__0" --output-type float32 ` Or auto update `clearml-serving --id model auto-update --engine triton --endpoint "test_model_pytorch_auto" --preprocess "examples/pytorch/preprocess.py" --name "train pytorch model" --project "serving examples" --max-versions 2 - --input-size 28 28 1 --input-name "INPUT__0" --input-type float32 + --input-size 1 28 28 --input-name "INPUT__0" --input-type float32 --output-size -1 10 --output-name "OUTPUT__0" --output-type float32` Or add Canary endpoint