---
title: "Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker"
description: "BART-large-CNN can be fine-tuned for dialogue summarization on the SAMSum dataset with distributed data-parallel training on Amazon SageMaker, using the Hugging Face estimator and the Transformers Deep Learning Containers."
url: "https://swe.quest/articles/distributed-training-train-bart-t5-for-summarization-using-transformers-and-3537d2d4192f64f6"
canonical: "https://huggingface.co/blog/sagemaker-distributed-training-seq2seq"
source: "Hugging Face"
published: "2021-04-08"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["model-training","cloud","llms","python"]
---

# Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2021-04-08, 9 min read, How-to. Original: [https://huggingface.co/blog/sagemaker-distributed-training-seq2seq](https://huggingface.co/blog/sagemaker-distributed-training-seq2seq)

## Summary

BART-large-CNN can be fine-tuned for dialogue summarization on the SAMSum dataset with distributed data-parallel training on Amazon SageMaker, using the Hugging Face estimator and the Transformers Deep Learning Containers. Enabling smdistributed data parallelism takes one \`distribution\` parameter, and the job reuses the stock run\_summarization.py example script pulled from Git. On 2 ml.p3dn.24xlarge instances (16 GPUs, total batch size 64), three epochs take about 24 minutes and cost roughly $28, reaching validation ROUGE-1 of about 42.6. The walkthrough ends by downloading the model from S3, generating a model card with metrics, and pushing it to the Hugging Face Hub for hosted inference.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- Transformer models
- AWS IAM and S3 basics ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

Amazon SageMaker, Hugging Face Transformers, BART, SAMSum, SageMaker Data Parallelism, Hugging Face Hub

## Related posts

- [The Partnership: Amazon SageMaker and Hugging Face](https://swe.quest/articles/the-partnership-amazon-sagemaker-and-hugging-face-bdc6f1a55662e5fc.md): Hugging Face · 2021-03-23 · Medium · 14 min read · Model training, ML platforms, Cloud platforms, Python
  Hugging Face and AWS partner, making AWS Hugging Face's preferred cloud and introducing Hugging Face Deep Learning Containers plus a HuggingFace Estimator in the SageMaker Python SDK for training Transformers models.
- [Deploy Hugging Face models easily with Amazon SageMaker](https://swe.quest/articles/deploy-hugging-face-models-easily-with-amazon-sagemaker-e09e9e34ef94ffa8.md): Hugging Face · 2021-07-08 · Medium · 9 min read · Inference & serving, Cloud platforms, ML platforms, Python
  Hugging Face Inference Deep Learning Containers and the SageMaker Hugging Face Inference Toolkit let Transformers models be deployed as SageMaker endpoints with a few lines of Python, using transformers pipelines for zero-code pre- and post-processing.
- [Introducing the Hugging Face LLM Inference Container for Amazon SageMaker](https://swe.quest/articles/introducing-the-hugging-face-llm-inference-container-for-amazon-sagemaker-49df0e101e3d8d72.md): Hugging Face · 2023-05-31 · Medium · 8 min read · Inference & serving, LLMs, Cloud platforms, Python
  Hugging Face's LLM Inference Deep Learning Container for Amazon SageMaker is built on Text Generation Inference (TGI), which provides tensor parallelism, continuous batching, flash-attention, bitsandbytes quantization, safetensors loading and SSE token streaming.
- [How to deploy and fine-tune DeepSeek models on AWS](https://swe.quest/articles/how-to-deploy-and-fine-tune-deepseek-models-on-aws-e64f345de2597515.md): Hugging Face · 2025-01-30 · Medium · 8 min read · Inference & serving, Cloud platforms, LLMs, Python
  DeepSeek-R1's distilled Llama and Qwen models can be deployed on AWS through Hugging Face Inference Endpoints, Bedrock Marketplace, SageMaker with Hugging Face LLM DLCs (TGI v3) on GPUs or Neuron, and EC2 Inferentia via the Hugging Face Neuron AMI.
- [Productizing Large Language Models](https://swe.quest/articles/productizing-large-language-models-5be0923873af50a1.md): Replit · 2022-09-21 · Medium · 6 min read · Inference & serving, LLMs, AI for coding, Evaluation, Kubernetes
  Replit runs transformer models from ~100M parameters (search, spam) through 1-10B (GhostWriter code autocomplete) to 100B+ in production, and shares lessons on making them usable.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
