whatisgithub

What is dit?

facebookresearch/dit — explained in plain English

Analysis updated 2026-06-24

8,569PythonAudience · researcherComplexity · 4/5Setup · hard

In one sentence

DiT is a Meta AI research project that replaces the U-Net backbone in image generation models with a transformer, showing that larger transformers produce better images predictably, with pre-trained models and a Colab demo included.

Mindmap

mindmap
  root((repo))
    What It Does
      Generate AI images
      Replace U-Net design
      Scale with transformers
    Models Available
      DiT-XL 256px
      DiT-XL 512px
      Multiple sizes
    Getting Started
      Hugging Face demo
      Colab notebook
      Pre-trained weights
    Audience
      AI researchers
      Vision ML engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Generate class-conditional images from ImageNet categories using the pre-trained DiT-XL model without training anything yourself

USE CASE 2

Try transformer-based image generation in a browser using the Hugging Face Spaces demo or the included Colab notebook

USE CASE 3

Reproduce the DiT paper's benchmark results using the provided training scripts and pre-trained model weights

USE CASE 4

Compare image quality across different DiT model sizes to study how transformer scale affects generation quality

What is it built with?

PythonPyTorchCUDA

How does it compare?

facebookresearch/ditmoonshotai/kimi-climvig-sjtu/alphapose
Stars8,5698,5638,558
LanguagePythonPythonPython
Setup difficultyhardmoderatehard
Complexity4/53/54/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 30min

Sampling from pre-trained weights runs on a single GPU, training from scratch requires multiple high-end GPUs.

So what is it?

DiT is a research project from Facebook AI Research (Meta) that explores a new architecture for AI image generation. The standard approach to generating images with diffusion models used a design called U-Net as the core processing component. This project replaces U-Net with a transformer, the same type of architecture that powers large language models, and shows that it works well for images too. The key finding in the accompanying research paper is that bigger transformers produce better images in a predictable way. As the model gets deeper, wider, or processes more image patches, image quality improves consistently. The best model in the paper, called DiT-XL/2, achieved state-of-the-art results on standard image generation benchmarks at both 256x256 and 512x512 pixel resolutions. The models are class-conditional, meaning you tell them what category of image to generate (such as a dog or a mushroom from the ImageNet categories) and the model produces an image matching that class. They were trained on ImageNet, a large standard dataset used in computer vision research. The repository includes the model code, pre-trained weights that download automatically, and scripts for both sampling (generating images) and training new models. There is also a runnable demo hosted on Hugging Face Spaces and a Colab notebook, so you can try generating images in a browser without installing anything locally. Training from scratch requires multiple high-end GPUs and is aimed at researchers. The project is written in Python using PyTorch and is intended as a research codebase, released with its pre-trained models so others can reproduce and build on the results.

Copy-paste prompts

Prompt 1
Using the pre-trained DiT-XL/2 model, generate a 256x256 image of ImageNet class 207 with classifier-free guidance scale 4.0 and save it to disk
Prompt 2
Help me adapt the DiT sampling script to generate a batch of 16 images across different ImageNet classes and display them as a grid
Prompt 3
Walk me through the DiT transformer block architecture, how does it handle class conditioning differently from a standard vision transformer?
Prompt 4
Show me how to start training a small DiT-S/4 model from scratch on a custom image dataset using the training script in this repo
Prompt 5
What changes do I need to make to the DiT code to generate images at 512x512 instead of 256x256?

Frequently asked questions

What is dit?

DiT is a Meta AI research project that replaces the U-Net backbone in image generation models with a transformer, showing that larger transformers produce better images predictably, with pre-trained models and a Colab demo included.

What language is dit written in?

Mainly Python. The stack also includes Python, PyTorch, CUDA.

How hard is dit to set up?

Setup difficulty is rated hard, with roughly 30min to a first successful run.

Who is dit for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.