liveBook · Manning

Min-DALL-E

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

A compact Transformer-based text-to-image model that predicts discrete image tokens autoregressively from text.

min-DALL-E is a compact Transformer-based text-to-image model that converts prompts into discrete image tokens and reconstructs them as images. It approximates DALL-E with a BART encoder, an autoregressive BART decoder, and a VQGAN decoder rather than predicting pixels directly. section 12.0 section 12.1.2

Trace generation through four connected stages:

  • Tokenize the prompt and encode it with pretrained BART into dense text embeddings. section 12.1.1
  • Start with a beginning-of-sequence token and have the trained BART decoder predict 256 image tokens autoregressively, one at a time. section 12.1.2 section 12.5
  • Represent each token as a learned-codebook image patch instead of a raw continuous pixel array, reducing the transformer’s prediction space. section 12.1.2
  • Pass the completed sequence to the pretrained VQGAN decoder, which reconstructs and stitches the patches into a color image. section 12.1.1

Prompt-to-image trace

For “panda with top hat reading a book,” the decoder progressively generates image tokens; visualizations after 32, 64, and 128 tokens show the image taking shape before all 256 tokens are decoded. section 12.0

Figure 12.3 The image generation process in min-DALL-E to generate an image from a text prompt

Follow the prompt, token-generation, and VQGAN reconstruction stages in the end-to-end inference diagram. section 12.1.2

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

How deep it goes
Traces training and inference through tokenization, encoding, autoregressive prediction, and VQGAN reconstruction, stopping short of proprietary DALL-E internals.
Examples
Uses the “panda with top hat reading a book” prompt and intermediate outputs after 32, 64, and 128 image tokens.
What it assumes
Assumes familiarity with Transformers and visual tokenization while developing the complete text-to-image pipeline incrementally.
What you can do after
Builds and operates a PyTorch text-to-image generator while understanding encoding, decoding, detokenization, and sampling.
How it connects
Connects autoregressive Transformers, BART, VQGAN, discrete image tokens, image tokenization, and text-to-image generation.

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.