Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support batch inference #3099

Closed
wants to merge 25 commits into from
Closed

Conversation

qu8n
Copy link
Contributor

@qu8n qu8n commented Oct 14, 2022

What does this PR address?

BentoML supports serving models online through HTTP and gRPC but needs more support for batch and streaming inference. Integrating with Apache Spark helps bridge the gap. This PR involves allowing users to create Spark UDFs with BentoML-packaged ML models in different types of environment.

Fixes #890

Before submitting:

@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Merging #3099 (940d676) into main (2b57ccf) will decrease coverage by 0.54%.
The diff coverage is 11.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3099      +/-   ##
==========================================
- Coverage   33.45%   32.90%   -0.55%     
==========================================
  Files         106      132      +26     
  Lines        9769    10652     +883     
  Branches     1685     1771      +86     
==========================================
+ Hits         3268     3505     +237     
- Misses       6270     6914     +644     
- Partials      231      233       +2     
Impacted Files Coverage Δ
src/bentoml/_internal/service/inference_api.py 54.32% <ø> (ø)
src/bentoml/_internal/service/loader.py 38.84% <0.00%> (-0.29%) ⬇️
src/bentoml/_internal/spark.py 0.00% <0.00%> (ø)
src/bentoml/_internal/io_descriptors/pandas.py 38.25% <25.92%> (-4.70%) ⬇️
src/bentoml/_internal/io_descriptors/base.py 85.18% <100.00%> (-3.46%) ⬇️
src/bentoml/_internal/io_descriptors/multipart.py 56.32% <0.00%> (-2.02%) ⬇️
src/bentoml/_internal/utils/lazy_loader.py 78.37% <0.00%> (-1.04%) ⬇️
src/bentoml/_internal/io_descriptors/file.py 49.54% <0.00%> (-0.46%) ⬇️
... and 46 more

@qu8n qu8n mentioned this pull request Oct 15, 2022
5 tasks
@aarnphm
Copy link
Contributor

aarnphm commented Oct 15, 2022

ah next time you can also do a git rebase to update branch history 😄

Copy link
Contributor

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick comments b4 I forgot about them :)

src/bentoml/_internal/io_descriptors/base.py Outdated Show resolved Hide resolved
@@ -0,0 +1,193 @@
from __future__ import annotations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be under src/bentoml/_internal/distributed/spark.py? @sauyon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe batch, but it doesn't really matter right now.

src/bentoml/_internal/spark.py Outdated Show resolved Hide resolved
src/bentoml/_internal/spark.py Outdated Show resolved Hide resolved
src/bentoml/_internal/spark.py Outdated Show resolved Hide resolved
src/bentoml/_internal/io_descriptors/base.py Outdated Show resolved Hide resolved
Comment on lines 10 to 22
@svc.api(
input=PandasDataFrame(),
output=PandasSeries(dtype="float"),
)
async def classify1(input_series: pd.DataFrame) -> pd.Series:
return await PandasDataFrame(iris_clf_runner.predict.async_run(input_series))

@svc.api(
input=PandasSeries(),
output=PandasSeries(),
)
async def classify2(input_series: pd.Series) -> pd.Series:
return await PandasSeries(iris_clf_runner.predict.async_run(input_series))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let sname the endpoint something more helpful.

@qu8n qu8n mentioned this pull request Dec 7, 2022
@bojiang bojiang self-requested a review January 13, 2023 04:21
@aarnphm aarnphm self-requested a review January 13, 2023 08:52
@aarnphm
Copy link
Contributor

aarnphm commented Jan 13, 2023

Development now track at #3425

@aarnphm aarnphm closed this Jan 13, 2023
@Talador12
Copy link

Awesome work on this one 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Support distributed batch inferencing job on Apache Spark cluster
4 participants