Skip to content

Conversation

bigbernnn
Copy link

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.

  • [ x ] I have read the CONTRIBUTING doc and adhered to the example notebook best practices
  • [ x ] I have updated any necessary documentation, including READMEs
  • [ x ] I have tested my notebook(s) and ensured it runs end-to-end
  • [ x ] I have linted my notebook(s) and code using 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.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@bigbernnn bigbernnn changed the title Sm pipeline automated model approval feat: Automated model approval pipeline Jan 17, 2024
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: SageMakerNotebooksProd-USWEST2-amazon-sagemaker-examples-pr
  • Commit ID: 2f19a30
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: SageMakerNotebooksProd-USWEST2-sagemaker-examples-link-check
  • Commit ID: 2f19a30
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: SageMakerNotebooksProd-USWEST2-sagemaker-examples-grammar
  • Commit ID: 2f19a30
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: SageMakerNotebooksProd-USWEST2-sagemaker-examples-code-formatting
  • Commit ID: 2f19a30
  • Result: FAILED
  • Build Logs (available for 30 days)

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')
Copy link
Collaborator

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.

Learn more

else:
approval_description = "Model values for the following checks does not meet threshold: "
for reason in reasons:
approval_description+= f"{reason} "
Copy link
Collaborator

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.

Learn more

Copy link

@ayrepdc ayrepdc left a comment

Choose a reason for hiding this comment

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

This looks good

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.

3 participants