-
Notifications
You must be signed in to change notification settings - Fork 6.9k
feat: Automated model approval pipeline #4528
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
base: main
Are you sure you want to change the base?
feat: Automated model approval pipeline #4528
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
||
def lambda_handler(event, context): | ||
# Initialize the SageMaker client | ||
sagemaker_client = boto3.client('sagemaker') |
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.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
A Boto3 client is initialized from a Lambda handler. To speed up your Boto3 client initialization and minimize the operational cost of your Lambda function, we recommend that you create the client at the level of the module that contains the handler, and then reuse it between invocations.
else: | ||
approval_description = "Model values for the following checks does not meet threshold: " | ||
for reason in reasons: | ||
approval_description+= f"{reason} " |
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.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
It appears that you are concatenating a string inside a loop. Concatenating immutable sequences will always results in a new object. This means that building up a sequence by repeated concatenation will have a quadratic runtime cost in the total sequence length. For efficiency and to get a linear runtime cost, consider appending values to a list and concatenating that list using str.join() or bytes.join() method.
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 looks good
Issue #, if available:
Description of changes:
We have added an example in the sagemaker-pipelines directory under automated-model-approval. This is related to an already approved blog, which will be submitted shortly. The folder contains a pipeline being triggered by a lambda function when a new model enters the model registry. The pipeline has two steps. The first, evaluates compliance with some internal thresholds for model quality, bias and explainability metrics. The second, updates the model status and description based on these checks.
This work stems from the challenges faced a public sector customer. This is an example governance pipeline that customers will be able to expand based on their internal processes and requirements.
Testing done:
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.black-nb -l 100 {path}/{notebook-name}.ipynb
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.