Amazon SageMaker Example Notebooks
Welcome to Amazon SageMaker. This site highlights example Jupyter notebooks for a variety of machine learning use cases that you can run in SageMaker.
This site is based on the SageMaker Examples repository on GitHub. To run these notebooks, you will need a SageMaker Notebook Instance or SageMaker Studio. Refer to the SageMaker developer guide’s Get Started page to get one of these set up.
On a Notebook Instance, the examples are pre-installed and available from the examples menu item in JupyterLab. On SageMaker Studio, you will need to open a terminal, go to your home folder, then clone the repo with the following:
git clone https://github.com/aws/amazon-sagemaker-examples.git
Introduction
We recommend the following notebooks as a broad introduction to the capabilities that SageMaker offers. To explore in even more depth, we provide additional notebooks covering even more use cases and frameworks.
Training
- SageMaker V3 Distributed Local Training Example
- SageMaker V3 JumpStart E2E Training Example
- PyTorch’s example to demonstrate Amazon SageMaker Heterogeneous Cluster for model training
- Managed Spot Training for XGBoost (V3)
- Regression with Amazon SageMaker XGBoost algorithm (V3 - sagemaker-core)
- Train a PyTorch model with MNIST dataset
- Building your own algorithm container
- Horovod Distributed Training with SageMaker TensorFlow script mode (SageMaker Python SDK V3)
- Getting Started with AWS Batch for SageMaker Training jobs
- Optional: Delete AWS Batch Resources
Model Customization
- CPT Training on HyperPod
- SageMaker V3 Custom Distributed Training Example
- Direct Preference Optimization (DPO) Training with SageMaker
- Fine-tune LLM with PyTorch FSDP and QLora on Amazon SageMaker AI using ModelTrainer
- Multi-Turn RL (Agentic RFT) Example - Fine-tuning with SageMaker
- Nova Data Mixing
- Recipe Override with ModelTrainer.from_recipe
- Recipe Override with SFTTrainer
- RLAIF Example - Finetuning with Sagemaker
- RLVR Example - Finetuning with Sagemaker
- Continued Finetuning (or) Finetuning on Model Artifacts
- Iterative Training (Resume from Checkpoint)
- Serverless Fine-Tuning and Deployment (End-to-End)
- Part 2: Model Evaluation
- SFTTrainer Example - Finetuning with Sagemaker
- Finetuning with Jumpstart base model
- Continued Finetuning (or) Finetuning on Model Artifacts
- Finetuning with Serverful Compute (TrainingJobCompute)
- Training Monitoring
- Fine-Tuning with HyperPod
- Fine-Tuning with Serverful Training Jobs (SMTJ)
- Import Fine-tuned LLaMA 3 models on SageMaker JumpStart to private model hub (SageMaker Python SDK v3)
- Appendix
Evaluation
Inference
- Deploy Models to Bedrock with BedrockModelBuilder
- SageMaker V3 In-Process Mode Example
- SageMaker V3 Inference Pipeline - ModelBuilder vs Core
- SageMaker V3 Local Container Mode Example
- SageMaker V3 Model Optimization Example
- A/B Testing with Amazon SageMaker
- Faster autoscaling on Amazon SageMaker realtime endpoints with inference components (Application Autoscaling)
- Amazon SageMaker Asynchronous Inference using the SageMaker Python SDK
- Leverage deployment guardrails to update a SageMaker Inference endpoint using linear traffic shifting
- Contents
- Introduction
- Setup
- Step 1: Create and deploy the models
- Step 2: Invoke Endpoint
- Step 3: Create CloudWatch alarms to monitor Endpoint performance
- Step 4: Update Endpoint with deployment configurations
- Cleanup
- Amazon Augmented AI(A2I) Integrated with AWS Marketplace ML Models
- Package a machine learning model for listing on the AWS Marketplace
- Notebook CI Test Results
- Amazon SageMaker Multi-Model Endpoints using TorchServe
- Running multi-container endpoints on Amazon SageMaker
- SageMaker Serverless Inference
- Development Environment and Permissions
- Shadow Variant Experiments via API
- References
MLOps
- Amazon SageMaker Feature Store: Introduction to Feature Store
- SageMaker Pipelines with MLflow
- Track an experiment while training a Pytorch model locally or in your notebook
- EMR Serverless Step in SageMaker Pipelines
- SageMaker Lineage Tracking - V3 SDK Example
- E2E ML Pipeline with Model Registry
- SageMaker V3 PyTorch Processing
- SageMaker Clarify E2E Test