# The Partnership: Amazon SageMaker and Hugging Face

huggingface.co · Philipp Schmid · Mar 23, 2021

**Type:** Announcement

## Summary

Hugging Face and Amazon formed a strategic partnership establishing Amazon Web Services as Hugging Face's preferred cloud provider to simplify training and deploying Transformer models. To facilitate this collaboration, the teams introduced Hugging Face Deep Learning Containers optimized for PyTorch and TensorFlow in Amazon SageMaker. The integration provides an extension to the SageMaker Python SDK, enabling data science teams to configure distributed training jobs across single-node and multi-node GPU clusters. Workflows integrate directly with SageMaker Automatic Model Tuning, SageMaker Studio, and Amazon S3 for managed experiment tracking and artifact storage. The open-source containers allow trained models to be exported for inference via SageMaker or published directly to the Hugging Face Model Hub while utilizing EC2 Spot instances to reduce compute expenses.

## Context

Hugging Face and Amazon established a partnership to simplify the adoption of state-of-the-art machine learning models and accelerate natural language processing feature delivery. Data science teams needed streamlined workflows to configure, train, tune, and deploy Transformers-based NLP models on scalable cloud infrastructure without spending days on environment setup.

## Approach / What changed

Hugging Face introduced open-source Deep Learning Containers (DLCs) licensed under Apache 2.0 and integrated them directly into Amazon SageMaker. The integration includes a dedicated extension for the SageMaker Python SDK, built-in support for PyTorch and TensorFlow, compatibility with SageMaker Automatic Model Tuning, and native connectivity to Amazon S3, EC2 Spot instances, and SageMaker distributed training libraries.

## Takeaways

- Hugging Face Deep Learning Containers are open-source under Apache 2.0 and provide pre-optimized environments for PyTorch and TensorFlow across single-GPU, multi-GPU, and multi-node clusters.
- The SageMaker Python SDK extension integrates with SageMaker Automatic Model Tuning and SageMaker Studio to automate hyperparameter optimization and experiment tracking.
- SageMaker Training provisions compute only for the duration of the job with per-second billing and supports Amazon EC2 Spot instances for up to 90% cost reduction.

**Tags:** [AWS](https://yomu.fyi/topic/aws), [Deployment](https://yomu.fyi/topic/deployment), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Open Source](https://yomu.fyi/topic/open-source), [Python](https://yomu.fyi/topic/python)

[Read original post](https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face)
