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

Enable Triton for SageMaker MME mode #4181

Merged
merged 18 commits into from May 9, 2022

Conversation

nskool
Copy link
Contributor

@nskool nskool commented Apr 7, 2022

[Currently work-in-progress, uses references to personal repo (github.com/nskool). Will be removed before PR is marked Ready for review]

  1. Detect SM SME or MME mode via serve script. Accordingly, set model repository.
  2. Detect path regex and parse input request
  3. Adds implementation for SageMaker LOAD, LIST, GET, UNLOAD and INVOKE APIs as per: https://docs.aws.amazon.com/sagemaker/latest/dg/mms-container-apis.html
  4. Add error-out if ensemble is used in MME mode
  5. Add validation tests in L0_sagemaker/ folder for MME APIs.

@nskool nskool marked this pull request as ready for review April 28, 2022 23:23
@nskool nskool changed the title [WIP] Enable Triton for SageMaker MME mode Enable Triton for SageMaker MME mode May 5, 2022
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.

Sorry for not reviewing it sooner, left some comments. Let me know when it is ready to go through CI

@@ -103,6 +125,9 @@ class SagemakerAPIServer : public HTTPAPIServer {
const std::string model_version_str_;

static const std::string binary_mime_type_;

// Maintain list of loaded models
std::unordered_map<std::string, std::string> sagemaker_models_list;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add "_" suffix to indicate that it is a member variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there can be concurrent read / write to this object (concurrent calls to different endpoint APIs), should avoid race condition with mutex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

src/sagemaker_server.cc Show resolved Hide resolved
src/sagemaker_server.cc Show resolved Hide resolved
src/sagemaker_server.cc Outdated Show resolved Hide resolved
src/sagemaker_server.cc Outdated Show resolved Hide resolved
src/sagemaker_server.cc Outdated Show resolved Hide resolved
DIR* dir;
struct dirent* ent;
int dir_count = 0;
if ((dir = opendir(repo_path.c_str())) != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not be portable to other platform like Windows? Should the CMakeLists.txt be updated to disallow building with SM endpoint on Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like it depends on the compiler being used for Windows: https://stackoverflow.com/questions/5530933/dirent-h-in-visual-studio-2010-or-2008. Is there a list of supported compilers for Windows? But SageMaker is linux-only so we could disable it, could you point how to disable the SM endpoint build on Windows?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like by default the SageMaker endpoint will not be built on Windows (ref), but you may add an explicit check here to disallow specifying SageMaker endpoint when WIN32 is true

src/sagemaker_server.cc Show resolved Hide resolved
src/sagemaker_server.cc Outdated Show resolved Hide resolved
@nskool
Copy link
Contributor Author

nskool commented May 6, 2022

Sorry for not reviewing it sooner, left some comments. Let me know when it is ready to go through CI

Thanks for the review! I have made changes as per the comments, if they look good, could you enable the CI?

@GuanLuo
Copy link
Contributor

GuanLuo commented May 6, 2022

Just triggered the CI, will also take another look of the PR at the meanwhile

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.

The CI is looking good, tag @CoderHam @tanmayv25 for awareness

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

Successfully merging this pull request may close these issues.

None yet

2 participants