-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Support for ModelBuilder In_Process Mode (1/2) #4784
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
Conversation
"IN_PROCESS mode is not supported yet for model server. It is " | ||
"supported for MMS/Transformers server in beta release." |
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.
nit: IN_PROCESS mode is only supported for MMS/Transformers server in beta release.
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.
This is better wording, I will change it thank you!
@@ -161,7 +164,7 @@ def _get_hf_metadata_create_model(self) -> Type[Model]: | |||
vpc_config=self.vpc_config, | |||
) | |||
|
|||
if not self.image_uri and self.mode == Mode.LOCAL_CONTAINER: | |||
if self.mode == Mode.LOCAL_CONTAINER or self.mode == Mode.IN_PROCESS: |
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.
nit:
LOCAL_MODES = [Mode.LOCAL_CONTAINER, Mode.IN_PROCESS]
if self.mode in LOCAL_MODES:
...
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.
Good suggestion, I've made the edit, thank you
@@ -274,7 +293,7 @@ def _build_transformers_env(self): | |||
|
|||
self.pysdk_model = self._create_transformers_model() | |||
|
|||
if self.mode == Mode.LOCAL_CONTAINER: | |||
if self.mode == Mode.LOCAL_CONTAINER or self.mode == Mode.IN_PROCESS: |
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.
nit:
if self.mode in LOCAL_MODES:
...
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.
Made the change
_PING_HEALTH_CHECK_INTERVAL_SEC = 5 | ||
|
||
_PING_HEALTH_CHECK_FAIL_MSG = ( | ||
"Container did not pass the ping health check. " |
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.
Does IN_PROCESS mode uses Container
?
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.
No it does not, I will be sure to change this, good catch.
): | ||
"""Placeholder docstring""" | ||
|
||
# self._pull_image(image=image) |
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.
Can remove this this comment
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.
Removed
def _multi_model_server_deep_ping(self, predictor: PredictorBase): | ||
"""Placeholder docstring""" | ||
response = None | ||
logger.debug("AM I HERE? PING PING") |
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.
Remove this line
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.
Removed it, thank you
) | ||
|
||
def _invoke_multi_model_server_serving(self, request: object, content_type: str, accept: str): | ||
"""Placeholder docstring""" |
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.
Update doc strings
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 docstrings are updated, good catch.
@@ -67,10 +67,18 @@ | |||
class TestModelBuilder(unittest.TestCase): | |||
@patch("sagemaker.serve.builder.model_builder._ServeSettings") | |||
def test_validation_in_progress_mode_not_supported(self, mock_serveSettings): |
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.
Can we add a test a where it is supported?
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.
Yes, I will add it. Good suggestion.
|
||
return (True, response) | ||
|
||
def _multi_model_server_deep_ping(self, predictor: PredictorBase): |
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.
is this complete?
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 have stubbed it.
else: | ||
env_vars = env | ||
|
||
self.container = client.containers.run( |
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.
Are we spinning up a docker container or using fast api for serving?
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 container will be stubbed, this is only 1/2 of the full implementation of InProcess mode. My next PR will include the FastAPI.
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.
LGTM, please ensure existing servers dont break. Please run notebook against this change to ensure backward compatibility...
Can we have this merge in a feature branch and merge to master until all complete and fully tested? cc @samruds |
Proposed split to enable to merge to mainline. 1/2 -> introduce in process mode , it should hit no-op stubs and return an empty response. Other servers should not be impacted. 2/2 - we introduce the fast API logic into the stubs. At this point the response should be a valid inference response. Other servers should not be impacted. |
Issue #, if available:
Description of changes:
Adding new mode of deployment named in_process_mode. Added in_process script to mode, made edits to transformers and model builder in order to support.
Testing done:
Integr tests run locally.
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
unique_name_from_base
to create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.