-
Notifications
You must be signed in to change notification settings - Fork 778
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
refactor(sdk&framework): [Broken] framework runners #2288
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2288 +/- ##
==========================================
- Coverage 47.64% 44.98% -2.67%
==========================================
Files 105 106 +1
Lines 8196 8448 +252
==========================================
- Hits 3905 3800 -105
- Misses 4291 4648 +357
|
we are removing |
@@ -3,6 +3,7 @@ | |||
from typing import TYPE_CHECKING | |||
|
|||
import numpy as np | |||
from torch._C import device |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be in the conditional import try
block?
MODULE_NAME = "bentoml.easyocr" | ||
|
||
|
||
@inject | ||
def load( | ||
tag: str, | ||
tag: t.Union[str, Tag], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make a type alias TagLike
?
@@ -403,11 +377,8 @@ def load_runner( | |||
*, | |||
predict_fn_name: str = "predict", | |||
device_id: str = "CPU:0", | |||
predict_kwargs: t.Optional[t.Dict[str, t.Any]] = None, | |||
partial_kwargs: t.Optional[t.Dict[str, t.Any]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also update in the doctoring below
@@ -8,6 +8,11 @@ | |||
from types import FunctionType | |||
from functools import reduce | |||
|
|||
if sys.version_info[0] == 3 and sys.version_info[1] >= 8: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
from .. import external_typing as ext | ||
from ..models import ModelStore | ||
|
||
CatBoostModel = t.Union[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great refactoring 👍
@@ -95,9 +89,7 @@ def load( | |||
tag: t.Union[str, Tag], | |||
model_params: t.Optional[t.Dict[str, t.Union[str, int]]] = None, | |||
model_store: "ModelStore" = Provide[BentoMLContainer.model_store], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw that we removed model_store
inject from load_runner
, should we also do that for save
and load
?
I think it makes more sense to just use public API under bentoml.models
in our framework modules - I don't think allowing user to customize model_store for each save
or load
call is a valid use case, given that 1.0 will bring in a pretty powerful export/import feature that @sauyon is working on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that in another PR
|
||
@property | ||
def default_name(self) -> str: | ||
return Tag.from_taglike(self._tag).name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to do self._tag = Tag.from_taglike(tag)
in __init__
?
name: t.Optional[str] = None, | ||
): | ||
super().__init__(name) | ||
self._tag = tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
def run(self, *args: t.Any, **kwargs: t.Any) -> t.Any: | ||
return self._impl.run(*args, **kwargs) | ||
|
||
@final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
bentoml/_internal/runner/runner.py
Outdated
INIT = 0 | ||
SETTING = 1 | ||
SET = 2 | ||
SHUTIING_DOWN = 3 | ||
SHUTDOWN = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related in this PR, suggest renaming the two states above:
UNINITILIZED = 0
INITIALIZING = 1
READY = 2
And should it also have an ERROR
state? in case _setup
failed in runner_app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names reflect our setup
and shutdown
API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SET -> READY
* refactor(sdk): runner * refactor(sdk): simpler runner creation * refactor(frameworks): many fixes * fix resources_quota * fi * fix for <py38 * fix runner * fix it * remove model_store in integration tests * remove runner args * mod default model_store for integration tests * try fix keras * fix picklable_model tests * fix detectron * review * fix picklable_model * append Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
* refactor(sdk): runner * refactor(sdk): simpler runner creation * refactor(frameworks): many fixes * fix resources_quota * fi * fix for <py38 * fix runner * fix it * remove model_store in integration tests * remove runner args * mod default model_store for integration tests * try fix keras * fix picklable_model tests * fix detectron * review * fix picklable_model * append
Description
Motivation and Context
How Has This Been Tested?
Checklist:
make format
andmake lint
script have passed(instructions).