Hugging Face Transformers Amazon SageMaker Examples
Example Jupyter notebooks that demonstrate how to build, train, and deploy Hugging Face Transformers using Amazon SageMaker and the Amazon SageMaker Python SDK.
🛠️ Setup
The quickest setup to run example notebooks includes:
An AWS account
Proper IAM User and Role setup
An S3 bucket
📓 Examples
| Notebook | Type | Description |
|---|---|---|
| 01 Getting started with PyTorch | Training | Getting started end-to-end example on how to fine-tune a pre-trained Hugging Face Transformer for Text-Classification using PyTorch |
| 02 getting started with TensorFlow | Training | Getting started end-to-end example on how to fine-tune a pre-trained Hugging Face Transformer for Text-Classification using TensorFlow |
| 03 Distributed Training: Data Parallelism | Training | End-to-end example on how to use distributed training with data-parallelism strategy for fine-tuning a pre-trained Hugging Face Transformer for Question-Answering using Amazon SageMaker Data Parallelism |
| 04 Distributed Training: Model Parallelism | Training | End-to-end example on how to use distributed training with model-parallelism strategy to pre-trained Hugging Face Transformer using Amazon SageMaker Model Parallelism |
| 05 How to use Spot Instances & Checkpointing | Training | End-to-end example on how to use Spot Instances and Checkpointing to reduce training cost |
| 06 Experiment Tracking with SageMaker Metrics | Training | End-to-end example on how to use SageMaker metrics to track your experiments and training jobs |
| 07 Distributed Training: Data Parallelism | Training | End-to-end example on how to use Amazon SageMaker Data Parallelism with TensorFlow |
| 08 Distributed Training: Summarization with T5/BART | Training | End-to-end example on how to fine-tune BART/T5 for Summarization using Amazon SageMaker Data Parallelism |
| 09 Vision: Fine-tune ViT | Training | End-to-end example on how to fine-tune Vision Transformer for Image-Classification |
| 10 Deploy HF Transformer from Amazon S3 | Inference | End-to-end example on how to deploy a model from Amazon S3 |
| 11 Deploy HF Transformer from Hugging Face Hub | Inference | End-to-end example on how to deploy a model from the Hugging Face Hub |
| 12 Batch Processing with Amazon SageMaker Batch Transform | Inference | End-to-end example on how to do batch processing with Amazon SageMaker Batch Transform |
| 13 Autoscaling SageMaker Endpoints | Inference | End-to-end example on how to use autoscaling for a HF Endpoint |
| 14 Fine-tune and push to Hub | Training | End-to-end example on how to use the Hugging Face Hub as MLOps backend for saving checkpoints during training |
| 15 Training Compiler | Training | End-to-end example on how to use Amazon SageMaker Training Compiler to speed up training time |
| 16 Asynchronous Inference | Inference | End-to-end example on how to use Amazon SageMaker Asynchronous Inference endpoints with Hugging Face Transformers |
| 17 Custom inference.py script | Inference | End-to-end example on how to create a custom inference.py for Sentence Transformers and sentence embeddings |
| 18 AWS Inferentia | Inference | End-to-end example on how to AWS Inferentia to speed up inference time |
| 19 Serverless Inference | Inference | Serverless Inference example to save cost |
| 20 Automatic Speech Recognition | Inference | Example how to do speech recognition with wav2vec2 |
| 21 Image Segmentation | Inference | Example how to do image segmentation with segformer |
| 22 Accelerate AWS SageMaker Integration examples | Training | End-to-end examples on how to use AWS SageMaker integration of Accelerate |
| 23 Stable Diffusion | Inference | Example how to generate images with stable diffusion |
| 24 Train BLOOM with PEFT | Training | Example how to train BLOOM on a single GPU using PEFT & LoRA |
| 25 PyTorch FSDP model parallelism | Training | Example how to train LLMs on multi-node multi GPU with PyTorch FSDP |
| 26 Document AI Donut | Training | In this tutorial, you will learn how to fine-tune and deploy Donut-base for document-understand/document-parsing using Hugging Face Transformers and Amazon SageMaker. |
| 27 Deploy Large Language Models | Inference | Learn how to deploy LLMs with the Hugging Face LLM DLC |
| 28 Train LLMs with QLora | Training | Example on how to fine-tune LLMs using Q-Lora |
| 29 Deploy LLMs with Inferentia2 | Inference | Learn how to deploy LLMs using AWS Inferentia2 |
| 30 Evaluate LLMs with ligtheval | Inference | Learn how to evaluate LLMs using Hugging Face LightEval |
| 31 Deploy Embedding Models with TEI | Inference | Learn how to deploy Embedding models for RAG applications with Hugging Face TEI |
| 32 Train and deploy Embedding Models | Train & Inference | Learn how to train and deploy embedding models with Sentence Transformers and TEI |