---
title: "Getting Started with Hugging Face Transformers for IPUs with Optimum"
description: "Optimum Graphcore lets Hugging Face Transformers models be fine-tuned on Graphcore IPUs with minimal code changes, starting with an IPU-optimized BERT."
url: "https://swe.quest/articles/getting-started-with-hugging-face-transformers-for-ipus-with-optimum-3d978b21929278d8"
canonical: "https://huggingface.co/blog/graphcore-getting-started"
source: "Hugging Face"
published: "2021-11-30"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["model-training","hardware","python"]
---

# Getting Started with Hugging Face Transformers for IPUs with Optimum

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2021-11-30, 6 min read, How-to. Original: [https://huggingface.co/blog/graphcore-getting-started](https://huggingface.co/blog/graphcore-getting-started)

## Summary

Optimum Graphcore lets Hugging Face Transformers models be fine-tuned on Graphcore IPUs with minimal code changes, starting with an IPU-optimized BERT. The walkthrough covers enabling the Poplar SDK and PopART on an IPU-POD16 in Graphcloud, installing PopTorch and optimum\[graphcore\], and running the run\_qa.py example to fine-tune bert-base-uncased on SQuAD v1.1 via the IPUTrainer class with an ipu\_config.json. Three epochs ran in about 368 seconds at roughly 721 samples/s, reaching 80.66 exact match and 88.28 F1.

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)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- PyTorch basics
- Hugging Face Transformers
- BERT fine-tuning ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

Optimum Graphcore, Graphcore IPU, Poplar SDK, PopTorch, BERT, SQuAD, IPUTrainer, Hugging Face Transformers

## Related posts

- [Deep Dive: Vision Transformers On Hugging Face Optimum Graphcore](https://swe.quest/articles/deep-dive-vision-transformers-on-hugging-face-optimum-graphcore-597be81d9fc267ef.md): Hugging Face · 2022-08-18 · Medium · 12 min read · Computer vision, Model training, Hardware, Python
  A step-by-step walkthrough of fine-tuning a pre-trained ViT model (google/vit-base-patch16-224-in21k) for multi-label disease classification on the NIH ChestX-ray14 dataset using Hugging Face Optimum Graphcore on IPUs.
- [Hugging Face ❤️ TorchTPU: TPUs, Natively](https://swe.quest/articles/hugging-face-torchtpu-tpus-natively-25e58a9bb63cbf24.md): Hugging Face · 2026-10-20 · Medium · 6 min read · Inference & serving, Hardware, Python, Machine learning
  TorchTPU is a native PyTorch backend that makes TPU an ordinary device, replacing the lazy-tensor torch\_xla path and making Optimum TPU unnecessary for running Hugging Face models.
- [Getting Started with Transformers on Habana Gaudi](https://swe.quest/articles/getting-started-with-transformers-on-habana-gaudi-edc0b7eeb1b053a5.md): Hugging Face · 2022-04-26 · Medium · 4 min read · Model training, Hardware, Cloud platforms
  Fine-tuning BERT for text classification on Habana Gaudi accelerators takes a few steps on AWS: launch an EC2 DL1 instance (8 Gaudi processors) from the Habana Deep Learning AMI, raise EBS storage to 50GB, and pull the Habana PyTorch container.
- [Training a language model with 🤗 Transformers using TensorFlow and TPUs](https://swe.quest/articles/training-a-language-model-with-transformers-using-tensorflow-and-tpus-7d72fd7dce30644b.md): Hugging Face · 2023-04-27 · Medium · 8 min read · Model training, Hardware, Python, LLMs
  Training a RoBERTa-base masked language model from scratch on WikiText with TensorFlow on TPUs, end to end: training a Unigram tokenizer with 🤗 tokenizers, tokenizing and chunking text into fixed 128-token sequences, sharding into TFRecords stored in Google Cloud Storage, and training under TPUStrategy with XLA-compatible Transformers models.
- [Accelerated Inference with Optimum and Transformers Pipelines](https://swe.quest/articles/accelerated-inference-with-optimum-and-transformers-pipelines-9ff6245f88a35ca0.md): Hugging Face · 2022-05-10 · Medium · 12 min read · Inference & serving, Python, Performance engineering, Machine learning
  Optimum 1.2 adds inference support via ONNX Runtime with ORTModelForXxx classes that drop into Hugging Face Transformers pipelines in place of AutoModelForXxx.

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)
