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

Adding model-control-mode #3165

Merged
merged 21 commits into from
Jun 11, 2024
Merged

Adding model-control-mode #3165

merged 21 commits into from
Jun 11, 2024

Conversation

udaij12
Copy link
Collaborator

@udaij12 udaij12 commented May 30, 2024

Description

Adding a model-control-mode to TorchServe #3158

Default is none which prevents users from registering and unregistering models after startup.
Can be set to enabled which allows users to use register and unregister APIs

Check documentation for how to set the model-control-mode

Tests

Setting model mode to "enabled" for all current tests.
Added a new pytest test_model_control_mode.py that covers default and model api enabled

@udaij12 udaij12 marked this pull request as ready for review May 30, 2024 21:51
@udaij12 udaij12 requested a review from lxning May 30, 2024 21:51
Copy link
Collaborator

@lxning lxning left a comment

Choose a reason for hiding this comment

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

Can you add test for the priority b/w config file vs cmd, especially for the negative test cases (eg. conflict setting)?

@lxning lxning requested a review from agunapal June 4, 2024 04:20
Copy link
Collaborator

@namannandan namannandan left a comment

Choose a reason for hiding this comment

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

Few minor comments to address. Looks good otherwise!

Copy link
Collaborator

@mreso mreso left a comment

Choose a reason for hiding this comment

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

The chosen parameter name is not reflecting the actual functionality in TorchServe. Please see comments.

docs/model_control_mode.md Show resolved Hide resolved
@@ -59,6 +59,8 @@ def start_torchserve(
no_config_snapshots=False,
gen_mar=True,
plugin_folder=None,
models=None,
mode=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The default mode is called "none" in the docs. But here None selects explicit. Better to revert the logic to no confuse people.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The logic for test is to keep enabled as default so that it does not break existing test structure for now. Will require complete test overhaul at a later date.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can just set the default value to model the old behavior to not break any test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We want TorchServe default to be model api enabled as false meaning that users will not be able to register or delete models once it starts. That change will break the tests

Copy link
Collaborator

Choose a reason for hiding this comment

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

Udai, this is not about the way people will setup TorchServe, this is only about the interface of start_torchserve which is not user facing.


cmd line: `torchserve --start --ncs --model-store model_store --model-api-enabled`

Result: Model api mode enabled
Copy link
Collaborator

Choose a reason for hiding this comment

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

Describe here the values that were set in the config file and command line and which took precedence to make it clear to the reader.


cmd line: `torchserve --start --ncs --model-store model_store`

Result: Mode is enabled (no way to enable "none" through cmd)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above: Describe here the values that were set in the config file and command line and which took precedence to make it clear to the reader.

Copy link
Collaborator

@mreso mreso left a comment

Choose a reason for hiding this comment

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

Addressed my own comments to move on with this. LGTM now

@@ -59,6 +59,8 @@ def start_torchserve(
no_config_snapshots=False,
gen_mar=True,
plugin_folder=None,
models=None,
mode=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Udai, this is not about the way people will setup TorchServe, this is only about the interface of start_torchserve which is not user facing.

Path(test_utils.MODEL_STORE).mkdir(parents=True, exist_ok=True)

test_utils.start_torchserve(
no_config_snapshots=True, models="mnist=mnist.mar", mode="none"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The interface should be

def start_torchserve(..., model_control_enabled=True):

so when you setup a test that want the new behavior you use:

test_utils.start_torchserve(..., model_control_enabled=False)

@mreso mreso enabled auto-merge June 11, 2024 03:32
@mreso mreso added this pull request to the merge queue Jun 11, 2024
Merged via the queue into master with commit 3d17a94 Jun 11, 2024
12 checks passed
@udaij12 udaij12 deleted the model_control branch June 12, 2024 18:20
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.

4 participants