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.