Build a Text-to-Image Generator (from Scratch)

you own this product
With transformers and diffusions
  • December 2025
  • ISBN 9781633435421
  • 360 pages
  • printed in black & white

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Build a Text-to-Image Generator (from Scratch)
Look inside
Build your own vision transformer and diffusion models for text-to-image generation–from scratch!

Build a Text-to-Image Generator (from Scratch) takes you step-by-step through creating your own AI models that can generate images from text. You’ll explore two methods of image generation—vision transformers and diffusion models—and learn vital AI development techniques as you go.

Build a Text-to-Image Generator (from Scratch) teaches you how to:

  • Build and train models to generate high resolution images based on text descriptions
  • Edit an existing image based on text prompts
  • Build and train a model to add captions to images
  • Build and train a vision transformer to classify images
  • Fine-tune LLMs for downstream tasks such as classification, text or image generation
  • Better differentiate real images from deepfakes

Build a Text-to-Image Generator (from Scratch) dives into the powerful models behind AI image generators. The best way to learn is to build something from scratch, and in this book you’ll build your very own diffusion model and vision transformer. As you work through each stage of development, you’ll develop an understanding of how these models can be customized, applied, and integrated for impressive multimodal AI.

about the technology

AI-generated images appear everywhere from high-end advertising to casual social media feeds. Text-to-image tools like Dall-e, Midjourney, and Flux make it easy to create AI art, but how do they work? In this book, you’ll find out by building your own text-to-image generator!

about the book

Build a Text-to-Image Generator (from Scratch) explores both transformer-based image generation and diffusion models. You’ll work hands-on to build a pair of simple generation models that can classify images, automatically add captions, reconstruct images, and enhance existing graphics. Author Mark Liu guides you every step of the way with clear explanations, informative diagrams, and eye-opening examples you can build on your own laptop.

what's inside

  • Build a vision transformer to classify images
  • Edit images using text prompts
  • Fine-tune image models

about the reader

Requires basic knowledge of generative AI models and intermediate Python skills.

about the author

Mark Liu is the founding director of the Master of Science in Finance program at the University of Kentucky. He is also the author of Learn Generative AI with PyTorch.

concepts explained in this book

  • An embedding is a numerical vector representation of an item in a feature space, encoding selected properties or relationships for computational tasks such as comparison or retrieval.
  • An encoder is a component or process that transforms input into an encoded or internal representation for subsequent processing, transmission, or decoding.
  • A latent space is a learned representational space in which numerical coordinates encode information or features inferred from observed data.
  • U-Net is an encoder-decoder neural-network architecture with downsampling and upsampling paths connected by skip connections for combining features at multiple spatial scales.
  • A codebook is an organized reference that associates codes with their meanings or with representative values used to encode data.
  • A text-to-image model is a generative machine-learning model that produces images conditioned on textual descriptions or prompts.
  • A Vision Transformer is a Transformer-based neural-network architecture that processes images as sequences of tokenized regions using attention.
  • A diffusion model is a generative model that learns to reverse a gradual noising process, generating samples through iterative denoising.

See what each chapter teaches

A practical and readable introduction with working code and clear explanations.

Andrey Lukyanenko, Meta

Empowers you to unlock creativity at the intersection of text and imagery.

Bojan Tunguz, Tabul.AI

Amazingly comprehensive, hype-free, hands-on, and code-rich guidebook.

Kirk Borne, Data Leadership Group

Successfully brings together the theoretical foundations and practical applications, from transformers to diffusion models.

Raymond Cheung, Parity Technologies
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build a Text-to-Image Generator (from Scratch) Build a Text-to-Image Generator (from Scratch) ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build a Text-to-Image Generator (from Scratch) Build a Text-to-Image Generator (from Scratch) ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build a Text-to-Image Generator (from Scratch) Build a Text-to-Image Generator (from Scratch) ebook for free