From 99286e7bd42494028af236cdeba66bd8af86c750 Mon Sep 17 00:00:00 2001 From: sauyon <2347889+sauyon@users.noreply.github.com> Date: Tue, 1 Nov 2022 15:27:57 -0700 Subject: [PATCH 1/3] make quickstart batchable --- examples/quickstart/service.py | 2 +- examples/quickstart/train.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/quickstart/service.py b/examples/quickstart/service.py index f96f8b9fc5..c2e356cc37 100644 --- a/examples/quickstart/service.py +++ b/examples/quickstart/service.py @@ -9,7 +9,7 @@ @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 3ab83b6f57..985103e956 100644 --- a/examples/quickstart/train.py +++ b/examples/quickstart/train.py @@ -18,5 +18,5 @@ 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}") From 2a7bf268ee31a30ecb6880e126de84492bdd7048 Mon Sep 17 00:00:00 2001 From: sauyon <2347889+sauyon@users.noreply.github.com> Date: Tue, 1 Nov 2022 18:49:43 -0700 Subject: [PATCH 2/3] format --- examples/quickstart/service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/quickstart/service.py b/examples/quickstart/service.py index c2e356cc37..86b1562b58 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), enforce_shape=False), + 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: From 4eab9cc919f2a628bed5b10ba39936cd1d9e9a42 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Wed, 2 Nov 2022 03:05:41 -0700 Subject: [PATCH 3/3] fix: format Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- examples/quickstart/train.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/quickstart/train.py b/examples/quickstart/train.py index 985103e956..6ebf99083f 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, signatures={"predict": {"batchable": True, "batch_dim": 0}}) + saved_model = bentoml.sklearn.save_model( + "iris_clf", clf, signatures={"predict": {"batchable": True, "batch_dim": 0}} + ) print(f"Model saved: {saved_model}")