Hugging FacePhilipp SchmidTutorial
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
Summary
Hugging Face and Amazon SageMaker introduced optimized Deep Learning Containers alongside a SageMaker Python SDK estimator to streamline distributed transformer model training. This workflow demonstrates fine-tuning the 400-million-parameter facebook/bart-large-cnn model for dialogue summarization on the 16,000-conversation samsum dataset. Using SageMaker Data Parallelism enabled in the distribution configuration, training executes across two ml.p3dn.24xlarge compute instances equipped with sixteen total GPUs and a cumulative batch size of 64. The HuggingFace estimator pulls the run_summarization.py script directly from GitHub, enables mixed precision with fp16, and tracks evaluation performance through ROUGE scores. Following completion, the unzipped model artifacts and a generated model card are pushed to the Hugging Face Hub using the huggingface_hub library for hosted inference.
Context
Hugging Face and Amazon SageMaker collaborated to create optimized Deep Learning Containers and an estimator in the SageMaker Python SDK to accelerate and simplify distributed training of Transformers-based models.
Approach / What changed
The workflow configures a SageMaker HuggingFace estimator with smdistributed data parallelism enabled to fine-tune facebook/bart-large-cnn on the samsum dataset using run_summarization.py across two ml.p3dn.24xlarge instances, then exports and uploads the model artifacts and model card to the Hugging Face Hub.
Takeaways
SageMaker Data Parallelism can be enabled in the HuggingFace estimator by setting the distribution parameter dictionary to enable smdistributed dataparallel.
The HuggingFace estimator includes built-in Git support, allowing training scripts and source directories to be pulled directly from specified repository branches.
Training with a per-device batch size of 4 across two ml.p3dn.24xlarge instances (16 GPUs total) yields a total effective batch size of 64.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.