liveBook · Manning

DALL-E

As explained in Build a Text-to-Image Generator (from Scratch)

A text-to-image generative model that produces images conditioned on natural-language descriptions.

DALL-E is a transformer-based generative model that converts natural-language descriptions into images. It treats text-to-image generation as sequence-to-sequence translation: words become a sequence of discrete image tokens, which are reconstructed into an image. section 12.0 section 12.1.1

The generation pipeline proceeds through three connected stages:

  • Text encoding tokenizes the prompt and passes it through a pretrained BART encoder, producing contextual text embeddings. section 12.1.1
  • Image-token prediction uses a transformer-based BART decoder to autoregressively predict visual tokens conditioned on the encoded prompt. section 12.1.1
  • Image reconstruction sends the predicted tokens to a VQGAN decoder, which converts them into patches and assembles the final image. section 12.0

Training uses paired image–caption data. VQGAN encodes images as discrete tokens, while the transformer learns their correspondence with text through cross-entropy loss. At inference, the process reverses: a prompt produces image tokens, and the decoder reconstructs the result. section 12.1.1 section 1.2.2

Incremental image formation

A prompt such as “panda with top hat reading a book” demonstrates how the generated image develops as the model predicts 32, 64, and then 128 of its eventual 256 image tokens. section 12.0

Figure 12.1 Eight steps for building a text-to-image generator from scratch. This chapter focuses on the last step: replicating a transformer-based text-to-image generator such as DALL-E.

Use the eight-step implementation overview to situate transformer-based text-to-image generation within a complete from-scratch workflow. section 12.0

How Build a Text-to-Image Generator (from Scratch) covers it

How deep it goes
Traces training and inference through BART and VQGAN components, including tokenization, prediction, reconstruction, and cross-entropy supervision.
Examples
Uses paired image–caption datasets and the prompt “panda with top hat reading a book” with staged token visualizations.
What it assumes
Introduces the required BART, transformer, token, and VQGAN roles while relying on sequence-to-sequence generation concepts.
What you can do after
Build it from scratch with PyTorch by implementing text encoding, autoregressive image-token prediction, and VQGAN reconstruction.
How it connects
Connects transformers, BART, VQGAN, VQ-VAE, CLIP, and sequence-to-sequence generation.

Also explained in

Compare how 4 books explain DALL-E →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Text-to-Image Generator (from Scratch). The section links point to the parts of the book it draws on.