From 0e8b7b89418e6d3db9b890d1a6e2a1d011720531 Mon Sep 17 00:00:00 2001 From: Sauyon Lee <2347889+sauyon@users.noreply.github.com> Date: Wed, 2 Nov 2022 03:16:51 -0700 Subject: [PATCH] feat: make quickstart batchable (#3172) Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- examples/quickstart/service.py | 4 +++- examples/quickstart/train.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/quickstart/service.py b/examples/quickstart/service.py index f96f8b9fc54..86b1562b58a 100644 --- a/examples/quickstart/service.py +++ b/examples/quickstart/service.py @@ -9,7 +9,9 @@ @svc.api( - input=NumpyNdarray.from_sample(np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double)), + input=NumpyNdarray.from_sample( + np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double), enforce_shape=False + ), output=NumpyNdarray(), ) async def classify(input_series: np.ndarray) -> np.ndarray: diff --git a/examples/quickstart/train.py b/examples/quickstart/train.py index 3ab83b6f574..6ebf99083ff 100644 --- a/examples/quickstart/train.py +++ b/examples/quickstart/train.py @@ -18,5 +18,7 @@ clf.fit(X, y) # Save model to BentoML local model store - saved_model = bentoml.sklearn.save_model("iris_clf", clf) + saved_model = bentoml.sklearn.save_model( + "iris_clf", clf, signatures={"predict": {"batchable": True, "batch_dim": 0}} + ) print(f"Model saved: {saved_model}")