Skip to content

Transformers-Tutorials

A collection of Jupyter notebook demos showing how to use Hugging Face Transformers models in PyTorch.

Stars
11.8k
Forks
1.7k
Licence
MIT
Language
Jupyter Notebook
Last update
2 months ago
Type
Learning resource

What it is

This repository is a set of tutorial notebooks by Niels Rogge, a Hugging Face contributor, that demonstrate the Transformers library. Each demo covers a specific model such as BERT, DETR, CLIPSeg, or Donut, showing how to run inference or fine-tune it on a dataset. The README says all demos are implemented in PyTorch and links each notebook to a Google Colab badge for running it without local setup.

  • Run an object detection model like DETR on an image using the inference notebook
  • Fine-tune BERT for named entity recognition or multi-label text classification
  • Try zero-shot image segmentation with CLIPSeg
  • Visualize self-attention maps of a DINO vision transformer
  • Run Donut for document image classification or document visual question answering

Great for

  • Developers learning how to use Hugging Face Transformers models in PyTorch
  • Students who want runnable examples for BERT, DETR, or vision transformers
  • Engineers who want a starting point for fine-tuning a model on their own dataset
  • People looking for document AI examples such as Donut or LayoutLM-style models

Not ideal for

  • Complete beginners to Python or machine learning, since the README recommends the Hugging Face course first for background
  • People who need a production-ready library or service, since this is a set of demos rather than a maintained package
  • Users who need TensorFlow or JAX examples, since the README says the demos are PyTorch
Step-by-step guide: how to use Transformers-TutorialsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Python · Jupyter Notebook or Google Colab · PyTorch · Hugging Face Transformers library

    Clone the repository

    git clone https://github.com/NielsRogge/Transformers-Tutorials
  2. 2

    Run it

    • Open the README and pick a demo, such as BERT or DETR.
    • Click the Open In Colab badge next to the demo to run it in your browser.
    • Or clone the repo and open the notebook locally in Jupyter.
    • Run the cells in order to see the model output.
  3. 3

    Get the most out of it

    • Read the Hugging Face course linked in the README first if you are new to Transformers
    • Start with an inference notebook before trying a fine-tuning notebook
    • Use the linked Hugging Face vision ecosystem overview notebook for a computer vision orientation
    • Adapt the fine-tuning notebooks to your own dataset, as the demos are designed as templates

Downloads

Strengths

  • Covers many different model families in one place, from text to vision to audio
  • Each demo links to a Colab notebook, so it can be run without local setup
  • Written by a Hugging Face contributor and linked to the official course and libraries

Trade-offs

  • The README is truncated in the provided text, so the full list of demos and their status is not confirmed here
  • Notebooks are tutorials, not a tested library, so code may depend on specific library versions
  • The README points to a free course for background, so it assumes some prior familiarity with Transformers

How it compares

ProjectStarsTypeLevelUpdatedBest for
Transformers-Tutorials (this)11.8kLearning resourceintermediate2 months agoDevelopers learning how to use Hugging Face Transformers models in PyTorch
annotated_deep_learning_paper_implementations67.6kLearning resourceintermediate4 days agoStudents learning how transformers, GANs, or optimizers work internally
nlp-tutorial14.9kLearning resourceintermediate2.7 years agoStudents who want to see how classic NLP models work in code
LoRA13.9kLibraryintermediate1.9 years agoMachine learning engineers adapting RoBERTa, DeBERTa or GPT-2 style models in PyTorch
Made-With-ML49.9kLearning resourceintermediate8 months agoSoftware engineers who want to learn how ML models get deployed and maintained
pytorch-tutorial32.5kLearning resourceintermediate3.2 years agoResearchers or engineers who already know Python and want to learn PyTorch

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.