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: Load new model version should not reload loaded existing model version(s) #388

Merged
merged 7 commits into from
Aug 20, 2024

Conversation

kthui
Copy link
Contributor

@kthui kthui commented Aug 14, 2024

What does the PR do?

It is requested that any model version(s) already loaded should not be reloaded upon adding and loading new version(s), if the already loaded version(s) are not modified. This is a small optimization to the model load/unload logic to avoid reloading unchanged model version(s) unload a load request.

Checklist

  • PR title reflects the change and is of format <commit_type>: <Title>
  • Changes are described in the pull request.
  • Related issues are referenced.
  • Populated github labels field
  • Added test plan and verified test passes.
  • Verified that the PR passes existing CI.
  • Verified copyright is correct on all changed files.
  • Added succinct git squash message before merging ref.
  • All template sections are filled out.
  • Optional: Additional screenshots for behavior/output changes with before/after.

Commit Type:

Check the conventional commit type
box here and add the label to the github PR.

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • revert
  • style
  • test

Related PRs:

triton-inference-server/server#7527

Where should the reviewer start?

Start with the changes to model_lifecycle to see why the small twist to the logic enables the previously reloaded model version to be updated, and then move towards model_config_utils and model_repository_manager to see how those changes support the decision to update vs reload.

Test plan:

New tests on not reloading already loaded model version upon loading other model versions is added. See the tests on server PR.

  • CI Pipeline ID: 17511909 17650341

Caveats:

N/A

Background

Previously, the model (all versions) will always be reloaded if there is a change in the model directory beyond the model config. This will cause unnecessary reload of unmodified model version(s), which this change makes model directory change detection more granular and decides if a model version should be reloaded or updated based on the model file(s) of the version.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

N/A

src/model_config_utils.cc Outdated Show resolved Hide resolved
@kthui kthui requested a review from nnshah1 August 16, 2024 22:13
Copy link
Contributor

@GuanLuo GuanLuo left a comment

Choose a reason for hiding this comment

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

Overall LGTM, have a few comments.

// model files
mtime.second = std::max(mtime.second, GetModifiedTime(full_path));
model_timestamps_.clear();
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

raise exception and try catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did a quick test on L0_lifecycle, the test currently expects any error related to retrieving timestamp to remain hidden and simply set the failed timestamp to 0. To translate it into this ModelTimestamp object, setting timestamp to 0 is the same as initializing the object using the default constructor, which is leaving the model_timestamps_ object empty. Thus, if an exception is raised here, the caller catching the exception will simply re-initialize ModelTimestamp object using the default constructor (to remain aligned with the current logic of setting the timestamp to 0). In this case, raising an exception is redundant and can be handled by the constructor in one or two lines, or with a helper function specifically for keeping everything empty.

Another approach is we can change the test cases to accept the behavior change that failure to determine timestamp will fail the model load.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think to get this feature out quickly, we can retain the existing error handling on reading timestamps, and file another ticket for enhancing the error handling at a later time. @GuanLuo @rmccorm4 what do you think?

Copy link
Contributor

@rmccorm4 rmccorm4 Aug 19, 2024

Choose a reason for hiding this comment

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

Retaining existing error behavior for the cherry-pick and enhancing in a follow-up sounds fine to me. If we really intend to do it - please put in a // DLIS-XXXX: blah blah so it doesn't get lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Can be addressed as follow-up, but I do think an exception should be raised, and it is fine to have the caller catch the exception and then initialize a timestamp with default constructor (if not failing). This is from the stand point where if the user initializes a timestamp with a path, the user is expecting the returned timestamp to carry correct timestamp w.r.t. the given path, not 0. And thus an error should be raised programmatically and it is up to the user to decide how to handle the error.

@kthui kthui requested a review from GuanLuo August 19, 2024 21:19
@kthui kthui merged commit ae99d04 into main Aug 20, 2024
1 check passed
@kthui kthui deleted the jacky-load-new-model-version branch August 20, 2024 19:26
kthui added a commit that referenced this pull request Aug 20, 2024
…version(s) (#388)

* Do not reload unmodified loaded model version

* Track model directory timestamps more granularly to detect updates to model version files

* Rename model config util config change require reload function

* Re-organize ModelTimestamp() and throw exception

* Revert "Re-organize ModelTimestamp() and throw exception"

This reverts commit 41e57e5.

* Break constructor into multiple functions

* Comment on should raise an exception when failed to create timestamp
yinggeh pushed a commit that referenced this pull request Aug 21, 2024
…version(s) (#388)

* Do not reload unmodified loaded model version

* Track model directory timestamps more granularly to detect updates to model version files

* Rename model config util config change require reload function

* Re-organize ModelTimestamp() and throw exception

* Revert "Re-organize ModelTimestamp() and throw exception"

This reverts commit 41e57e5.

* Break constructor into multiple functions

* Comment on should raise an exception when failed to create timestamp
nv-kmcgill53 pushed a commit that referenced this pull request Aug 21, 2024
…version(s) (#388) (#390)

* Do not reload unmodified loaded model version

* Track model directory timestamps more granularly to detect updates to model version files

* Rename model config util config change require reload function

* Re-organize ModelTimestamp() and throw exception

* Revert "Re-organize ModelTimestamp() and throw exception"

This reverts commit 41e57e5.

* Break constructor into multiple functions

* Comment on should raise an exception when failed to create timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feat A new feature
Development

Successfully merging this pull request may close these issues.

4 participants