Zhaoqi 970d88ee18 New folder structure (#4694)
* Deleted 17 duplicate notebooks (#4685)

* Updated README, removed broken links and fixed markdown (#4687)

* New Folder Structure Implementation - Archived remaining geospatial example notebooks (#4691)

* Archived remaining geospatial example notebooks

* Removed geospatial from README.md

* Archived remaining workshop notebooks (#4692)

* Archived outdated example notebooks between 1-90 views (#4693)

---------

Co-authored-by: jsmul <jsmul@amazon.com>
2024-07-09 11:48:53 -04:00
2022-08-31 15:49:20 -07:00
2022-08-31 15:49:20 -07:00
2024-06-19 19:36:10 -04:00
2023-10-23 08:30:00 -07:00
2023-10-23 08:30:00 -07:00
2024-07-09 11:48:53 -04:00
2024-07-09 11:48:53 -04:00
2024-07-09 11:48:53 -04:00
2024-07-02 12:40:33 -04:00
2024-06-27 13:54:23 -04:00
2023-11-29 18:35:09 -08:00
2024-03-28 15:26:42 -07:00
2023-05-10 11:55:25 -07:00
2022-04-19 13:35:13 -05:00
2020-11-13 15:36:52 -08:00
2020-11-13 15:36:52 -08:00
2021-05-06 07:56:17 -07:00
2024-07-09 11:48:53 -04:00
2021-05-24 17:11:35 -07:00

SageMaker

Amazon SageMaker Examples

Example Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using Amazon SageMaker.

📚 Read this before you proceed further

Amazon SageMaker examples are divided in two repositories:

  • SageMaker example notebooks is the official repository, containing examples that demonstrate the usage of Amazon SageMaker. This repository is entirely focussed on covering the breadth of features provided by SageMaker, and is maintained directly by Amazon SageMaker team.

  • Sagemaker Example Community repository is another SageMaker repository which contains additional examples and reference solutions, beyond the examples showcased in the official repository. This repository is maintained by community of engineers and solution architects at AWS.

Planning to submit a PR to this repository? Read this first:

  • This repository will only accept notebooks/examples which demonstrate a feature of SageMaker, not yet covered anywhere in this repository. PR submitters are requested to check this before submitting the PR to avoid getting it rejected.

  • If you still would like to contribute your example, please submit a PR to Sagemaker Example Community repository instead.

🛠️ Setup

The quickest setup to run example notebooks includes:

💻 Usage

These example notebooks are automatically loaded into SageMaker Notebook Instances. They can be accessed by clicking on the SageMaker Examples tab in Jupyter or the SageMaker logo in JupyterLab.

Although most examples utilize key Amazon SageMaker functionality like distributed, managed training or real-time hosted endpoints, these notebooks can be run outside of Amazon SageMaker Notebook Instances with minimal modification (updating IAM role definition and installing the necessary libraries).

As of February 7, 2022, the default branch is named "main". See our announcement for details and how to update your existing clone.

📓 Examples

Introduction to Ground Truth Labeling Jobs

These examples provide quick walkthroughs to get you up and running with the labeling job workflow for Amazon SageMaker Ground Truth.

Introduction to Applying Machine Learning

These examples provide a gentle introduction to machine learning concepts as they are applied in practical use cases across a variety of sectors.

SageMaker Automatic Model Tuning

These examples introduce SageMaker's hyperparameter tuning functionality which helps deliver the best possible predictions by running a large number of training jobs to determine which hyperparameter values are the most impactful.

  • TensorFlow Tuning shows how to use SageMaker hyperparameter tuning with the pre-built TensorFlow container and MNIST dataset.
  • HuggingFace Tuning shows how to use SageMaker hyperparameter tuning with the pre-built HuggingFace container and 20_newsgroups dataset.
  • Keras BYO Tuning shows how to use SageMaker hyperparameter tuning with a custom container running a Keras convolutional network on CIFAR-10 data.
  • Analyzing Results is a shared notebook that can be used after each of the above notebooks to provide analysis on how training jobs with different hyperparameters performed.
  • Model tuning for distributed training shows how to use SageMaker hyperparameter tuning with Hyperband strategy for optimizing model in distributed training.

SageMaker Autopilot

These examples introduce SageMaker Autopilot. Autopilot automatically performs feature engineering, model selection, model tuning (hyperparameter optimization) and allows you to directly deploy the best model to an endpoint to serve inference requests.

Introduction to Amazon Algorithms

These examples provide quick walkthroughs to get you up and running with Amazon SageMaker's custom developed algorithms. Most of these algorithms can train on distributed hardware, scale incredibly well, and are faster and cheaper than popular alternatives.

  • k-means is our introductory example for Amazon SageMaker. It walks through the process of clustering MNIST images of handwritten digits using Amazon SageMaker k-means.
  • Factorization Machines showcases Amazon SageMaker's implementation of the algorithm to predict whether a handwritten digit from the MNIST dataset is a 0 or not using a binary classifier.
  • Latent Dirichlet Allocation (LDA) introduces topic modeling using Amazon SageMaker Latent Dirichlet Allocation (LDA) on a synthetic dataset.
  • Linear Learner predicts whether a handwritten digit from the MNIST dataset is a 0 or not using a binary classifier from Amazon SageMaker Linear Learner.
  • Neural Topic Model (NTM) uses Amazon SageMaker Neural Topic Model (NTM) to uncover topics in documents from a synthetic data source, where topic distributions are known.
  • Principal Components Analysis (PCA) uses Amazon SageMaker PCA to calculate eigendigits from MNIST.
  • Seq2Seq uses the Amazon SageMaker Seq2Seq algorithm that's built on top of Sockeye, which is a sequence-to-sequence framework for Neural Machine Translation based on MXNet. Seq2Seq implements state-of-the-art encoder-decoder architectures which can also be used for tasks like Abstractive Summarization in addition to Machine Translation. This notebook shows translation from English to German text.
  • XGBoost for regression predicts the age of abalone (Abalone dataset) using regression from Amazon SageMaker's implementation of XGBoost.
  • XGBoost for multi-class classification uses Amazon SageMaker's implementation of XGBoost to classify handwritten digits from the MNIST dataset as one of the ten digits using a multi-class classifier. Both single machine and distributed use-cases are presented.
  • BlazingText Word2Vec generates Word2Vec embeddings from a cleaned text dump of Wikipedia articles using SageMaker's fast and scalable BlazingText implementation.
  • Object detection for bird images demonstrates how to use the Amazon SageMaker Object Detection algorithm with a public dataset of Bird images.
  • Object2Vec for sentence similarity explains how to train Object2Vec using sequence pairs as input using sentence similarity analysis as the application.
  • IP Insights for suspicious logins shows how to train IP Insights on a login events for a web server to identify suspicious login attempts.
  • Semantic Segmentation shows how to train a semantic segmentation algorithm using the Amazon SageMaker Semantic Segmentation algorithm. It also demonstrates how to host the model and produce segmentation masks and probability of segmentation.
  • JumpStart Instance Segmentation demonstrates how to use a pre-trained Instance Segmentation model available in JumpStart for inference.
  • JumpStart Semantic Segmentation demonstrates how to use a pre-trained Semantic Segmentation model available in JumpStart for inference, how to finetune the pre-trained model on a custom dataset using JumpStart transfer learning algorithm, and how to use fine-tuned model for inference.
  • JumpStart Text Generation shows how to use JumpStart to generate text that appears indistinguishable from the hand-written text.
  • JumpStart Text Summarization shows how to use JumpStart to summarize the text to contain only the important information.
  • JumpStart Image Embedding demonstrates how to use a pre-trained model available in JumpStart for image embedding.
  • JumpStart Text Embedding demonstrates how to use a pre-trained model available in JumpStart for text embedding.
  • JumpStart Object Detection demonstrates how to use a pre-trained Object Detection model available in JumpStart for inference, how to finetune the pre-trained model on a custom dataset using JumpStart transfer learning algorithm, and how to use fine-tuned model for inference.
  • JumpStart Machine Translation demonstrates how to translate text from one language to another language in JumpStart.
  • JumpStart Named Entity Recognition demonstrates how to identify named entities such as names, locations etc. in the text in JumpStart.
  • JumpStart Text to Image demonstrates how to generate image conditioned on text in JumpStart.
  • JumpStart Upscaling demonstrates how to enhance image quality with Stable Diffusion models in JumpStart.
  • JumpStart Inpainting demonstrates how to inpaint an image with Stable Diffusion models in JumpStart.
  • In-context learning with AlexaTM 20B demonstrates how to use AlexaTM 20B for in-context-learning in JumpStart.

Amazon SageMaker RL

The following provide examples demonstrating different capabilities of Amazon SageMaker RL.

  • HVAC using EnergyPlus demonstrates the training of HVAC systems using the EnergyPlus environment.
  • Mountain Car Mountain car is a classic RL problem. This notebook explains how to solve this using the OpenAI Gym environment.
  • Travelling Salesman is a classic NP hard problem, which this notebook solves with AWS SageMaker RL.
  • Unity Game Agent shows how to use RL algorithms to train an agent to play Unity3D game.

Scientific Details of Algorithms

These examples provide more thorough mathematical treatment on a select group of algorithms.

Amazon SageMaker Debugger

These examples provide and introduction to SageMaker Debugger which allows debugging and monitoring capabilities for training of machine learning and deep learning algorithms. Note that although these notebooks focus on a specific framework, the same approach works with all the frameworks that Amazon SageMaker Debugger supports. The notebooks below are listed in the order in which we recommend you review them.

Amazon SageMaker Distributed Training

These examples provide an introduction to SageMaker Distributed Training Libraries for data parallelism and model parallelism. The libraries are optimized for the SageMaker training environment, help adapt your distributed training jobs to SageMaker, and improve training speed and throughput. More examples for models such as BERT and YOLOv5 can be found in distributed_training/.

Amazon SageMaker Smart Sifting

These examples provide an Introduction to Smart Sifting library. Smart Sifting is a framework to speed up training of PyTorch models. The framework implements a set of algorithms that filter out inconsequential training examples during training, reducing the computational cost and accelerating the training process. It is configuration-driven and extensible, allowing users to add custom logic to transform their training examples into a filterable format. Smart sifting provides a generic utility for any DNN model, and can reduce the training cost by up to 35% in infrastructure cost.

Amazon SageMaker Clarify

These examples provide an introduction to SageMaker Clarify which provides machine learning developers with greater visibility into their training data and models so they can identify and limit bias and explain predictions.

  • Fairness and Explainability with SageMaker Clarify shows how to use SageMaker Clarify Processor API to measure the pre-training bias of a dataset and post-training bias of a model, and explain the importance of the input features on the model's decision.
  • Amazon SageMaker Clarify Model Monitors shows how to use SageMaker Clarify Model Monitor API to schedule bias monitor to monitor predictions for bias drift on a regular basis, and schedule explainability monitor to monitor predictions for feature attribution drift on a regular basis.

Publishing content from RStudio on Amazon SageMaker to RStudio Connect

These examples show you how to run R examples, and publish applications in RStudio on Amazon SageMaker to RStudio Connect.

  • Publishing R Markdown shows how you can author an R Markdown document (.Rmd, .Rpres) within RStudio on Amazon SageMaker and publish to RStudio Connect for wide consumption.
  • Publishing R Shiny Apps shows how you can author an R Shiny application within RStudio on Amazon SageMaker and publish to RStudio Connect for wide consumption.
  • Publishing Streamlit Apps shows how you can author a streamlit application withing Amazon SageMaker Studio and publish to RStudio Connect for wide consumption.

Advanced Amazon SageMaker Functionality

These examples showcase unique functionality available in Amazon SageMaker. They cover a broad range of topics and utilize a variety of methods, but aim to provide the user with sufficient insight or inspiration to develop within Amazon SageMaker.

Amazon SageMaker Neo Compilation Jobs

These examples provide an introduction to how to use Neo to compile and optimize deep learning models.

Amazon SageMaker Processing

These examples show you how to use SageMaker Processing jobs to run data processing workloads.

Amazon SageMaker Pipelines

These examples show you how to use SageMaker Pipelines to create, automate and manage end-to-end Machine Learning workflows.

Amazon SageMaker Pre-Built Framework Containers and the Python SDK

Pre-Built Deep Learning Framework Containers

These examples show you how to train and host in pre-built deep learning framework containers using the SageMaker Python SDK.

Pre-Built Machine Learning Framework Containers

These examples show you how to build Machine Learning models with frameworks like Apache Spark or Scikit-learn using SageMaker Python SDK.

Using Amazon SageMaker with Apache Spark

These examples show how to use Amazon SageMaker for model training, hosting, and inference through Apache Spark using SageMaker Spark. SageMaker Spark allows you to interleave Spark Pipeline stages with Pipeline stages that interact with Amazon SageMaker.

Using Amazon SageMaker with Amazon Keyspaces (for Apache Cassandra)

These examples show how to use Amazon SageMaker to read data from Amazon Keyspaces.

AWS Marketplace

Create algorithms/model packages for listing in AWS Marketplace for machine learning.

These example notebooks show you how to package a model or algorithm for listing in AWS Marketplace for machine learning.

Once you have created an algorithm or a model package to be listed in the AWS Marketplace, the next step is to list it in AWS Marketplace, and provide a sample notebook that customers can use to try your algorithm or model package.

Use algorithms, data, and model packages from AWS Marketplace

These examples show you how to use model-packages and algorithms from AWS Marketplace and dataset products from AWS Data Exchange, for machine learning.

Using Amazon SageMaker for Generative AI use cases

These examples show you how to use AWS services for Generative AI use cases.

Archived

This folder houses legacy, low-viewed, and duplicate notebooks, with a 6-month grace period before deletion. If you believe a notebook has been moved into this folder in error, please submit a PR with justification.

⚖️ License

This library is licensed under the Apache 2.0 License. For more details, please take a look at the LICENSE file.

🤝 Contributing

Although we're extremely excited to receive contributions from the community, we're still working on the best mechanism to take in examples from external sources. Please bear with us in the short-term if pull requests take longer than expected or are closed. Please read our contributing guidelines if you'd like to open an issue or submit a pull request.

S
Description
使用 Amazon SageMaker 构建、训练和部署机器学习模型的 Jupyter 示例笔记本。|GitHub 镜像 11k · 🍴 7k
https://github.com/aws/amazon-sagemaker-examples Readme 702 MiB
Languages
Jupyter Notebook 94.4%
Python 4.6%
Roff 0.6%
Shell 0.2%