Duration
Generative AI, from GANs to CLIP, with Python and Pytorch
2 days
What you'll learn
- How to code generative A.I architectures from scratch using Python and Pytorch
- How generative architectures work, in great depth, from GANs to multimodal A.I, understanding every little detail in the process
- In addition to the coding, every section begins with an in-depth review of the key concepts related to these architectures
- Examples: We will code a generative network that produces human faces, and also combine two advanced networks to transform text prompts into amazing images.
- Examples: We will learn to edit the clothes of a person in a picture by combining a segmentation architecture with the Stable Diffusion generative model
Prerequisites
- Basic knowledge of python. It's enough with the very basics, as we will code every little thing together, line by line
- Access to an internet connection, as we will use the free online Google Colab service to code together
Course Outline
The generative AI revolution
- The roadmap, from basic to advanced and beyond
- The generative revolution: coming home
- The present and future of AI is generative
- Applications of generative AI
- Latent spaces and representation learning
- Navigating latent spaces
- GANS: Generative Adversarial Networks
- Benefits and possibilities of Generative AI
- Coming home: generative AI and human nature
Coding a basic generative architecture
- Understanding the battle between generator and discriminator
- Understanding Cross Entropy in depth
- Understanding the equation to calculate the discriminator loss
- Understanding the equation to calculate the generator loss
- Coding: importing libraries and declaring a visualization function
- Coding: hyperparameters and the DataLoader
- Coding: the generator class
- Coding: the discriminator class
- Coding: the optimizer and testing the generator
- Coding: the loss values of generator and discriminator
- Coding: main training loop, discriminator part
- Coding: main training loop, generator and stats
- Coding: running the training
- Coding: results and conclusions
Coding an advanced generative architecture
- Challenges and issues of the basic GAN
- The Wasserstein Loss
- The Gradient Penalty
- Coding: setting up libraries and parameters
- Coding: Login and setup of the Wandb stats library
- Coding: Beginning the generator
- Coding: Understanding convolutions
- Coding: The generator class
- Coding: The critic class
- Coding: Alternative way to initialize parameters (optional)
- Coding: Loading the CelebA dataset
- Coding: Declaring dataset, dataloader and optimizers
- Coding: the gradient penalty
- Coding: saving and loading checkpoints
- Coding: training loop - critic training
- Coding: training loop - generator training
- Coding: stats and fixing issues
- Coding: reviewing the code before running the training
- Coding: running the training
- Coding: results after a few epochs
- Coding: results after a few more epochs
- Coding: results getting better and better
- Coding: morphing between points in latent space
- Coding: more morphing
Generating images from text by combining two advanced architectures
- Multimodal generation, an incredible adventure
- Coding: importing the libraries
- Coding: helper functions and hyperparameters
- Coding: Setting up the CLIP model
- Coding: Setting up the Generative transformer model
- Coding: Setting up the latent space parameters to be optimized
- Coding: encode the text prompts through CLIP
- Coding: creating crops from the generated image
- Coding: a function to display generated images and crops
- Coding: optimizing the latent space parameters
- Coding: the training loop
- Coding: running the training
- Coding: interpolating between points in the latent space
- Coding: creating a video of the interpolations and general review
- Coding: creating variations of the code
- Coding: Davinci Sfumato: Tweaking the code to create a new kind of texture
- Coding: Davinci Sfumato: reflecting about the process
- Final greetings from the spacecraft
Editing people's clothes by combining segmentation and generative AI models
- Intro: people's clothes replacement and editing using Generative AI
- Coding: Setting up libraries and the segmentation model
- Coding: Setting up the Stable Diffusion generative model
- Coding: Loading a picture and running the segmentation process to produce masks
- Coding: Visualizing the generated masks
- Coding: Inpainting, running and experimenting with the Stable Diffusion model
- Coding: Guide the segmentation process with text prompts
- Coding: run the generative model in this alternative setup
Programme scope, delivery arrangements and suitability are confirmed during enquiry.