Learn Python Generative AI: Journey from autoencoders to transformers to large language models 9789355518972

Learn to unleash the power of AI creativity KEY FEATURES ● Understand the core concepts related to generative AI. ● Diff

129 105 7MB

English Pages 348 Year 2024

Report DMCA / Copyright

DOWNLOAD FILE

Learn Python Generative AI: Journey from autoencoders to transformers to large language models
 9789355518972

Table of contents :
Table of Contents

1. Introducing Generative AI

Introduction

Structure

Objectives

Overview of generative models

Discriminative vs. generative models

Types of discriminative and generative models

Strengths and weaknesses

Class imbalance scenario

Generative modeling framework

Sample Space

Probability density function

Maximum likelihood

KL divergence

GMM code using TensorFlow probability

Conclusion

2. Designing Generative Adversarial Networks

Introduction

Structure

Objectives

Generative Adversarial Networks

Types of GANs available

Architecture of a GAN

Equation

Discriminator loss

Generator loss

Vanilla GAN


Outline crucial factors in GAN architecture design

Major challenges in designing GANs architecture

Architecture of Deep Convolutional GANs

Architecture of Wasserstein GANs

Architecture of Conditional GANs

Architecture of CycleGANs

Architecture of progressive GANs

Architecture of StyleGANs

Architecture of Pix2Pix

Conclusion

Multiple choice questions

Answers

3. Training and Developing Generative Adversarial Networks

Introduction

Structure

Objectives

Generative Adversarial Training

Generating MNIST data: Basic GAN implementation

Issues during training a GANs

Mode collapse

Vanishing gradients

Oscillation

Unstability

Evaluation

Case study: Common practical implementation of GANs for augmentation and balancing classes

Conclusion

4. Architecting Auto Encoder for Generative AI

Introduction

Structure

Objectives

Auto Encoders

Regularization

Creating a bottleneck

Key distinctions with autoencoders

Autoencoders

GANs

Importance of regularization in auto encoders

Cifar10

Anomaly detection using auto encoder

Autoencoders with convolutional layers

Architecture

Capturing spatial information

CNN versus ANN Autoencoders

Conclusion

5. Building and Training Generative Autoencoders

Introduction

Structure

Objectives

Latent space

Difference between GANs latent space and AE latent space

Key distinctions with autoencoders latent space

Adding color to a grayscale image using autoencoders

Coding advanced auto encoders

Multi modal auto encoders

Loss in autoencoders

Mean squared error loss

Binary cross-entropy loss

Categorical cross-entropy loss

Kullback-leibler divergence loss

Huber loss

Challenges in training auto encoders and mitigation

AE vs. VAE

Conclusion

6. Designing Generative Variation Auto Encoder

Introduction

Structure

Objectives

Story of VAE

VAE vs AE

Math behind the latent space

Deterministic Autoencoder

Stochastic Variational Autoencoder

Key distinctions with autoencoder latent space

Can the VAE Latent space be stochastic as well as deterministic

Dirichlet distribution

Importance of the latent space when designing a VAE

Vanilla VAE architecture

The ELBO

The reparameterization trick

Challenges in Vanilla VAE

Types of VAE

Conclusion

7. Building Variational Autoencoders for Generative AI

Introduction

Structure

Objectives

Key focus areas in VAE research

Building a VAE with Dirichlet distribution: Non-CNN Approach

Building a VAE with Dirichlet distribution: CNN Approach

Difference between two networks

VAE with Non Dirichlet distribution

KL divergence

Common loss function sin VAE

Common issues and possible solutions while training VAE

Missing data handling during generation

Optimization techniques

Conclusion

8. Fundamental of Designing New Age Generative Vision Transformer

Introduction

Structure

Objectives

The evolution

The birth of transformers

Overview of transformer architectures

Applications in NLP

Generative transformers and language modeling

Transformer in computer vision

Difference between VAE, GANs, and Transformers

Transformers

Generative Adversarial Networks

Variational autoencoders

Differences and applications

Vision Transformer

Understanding self-attention

NLP vs vision

NLP transformer

Self-attention mechanism

Feed-forward neural networks

Vision transformer

Patch embeddings

Positional embeddings

Transformer encoder

Architectural attention

Dot product attention

Scaled dot product attention

Additive attention

Multi-head attention

Cross attention

Compute attention scores

Compute cross-attention output

When to use which architectural attention

Functional attention

Hard attention

Equation: Sampling-based hard attention

Soft attention

Equation: Soft attention

Global attention

Equation: Global attention

Local attention

Equation: local attention

When to use which functional attention

Hard attention

Soft attention

Global attention

Local attention

Conclusion

9. Implementing Generative Vision Transformer

Introduction

Structure

Objectives

STL dataset

Key features of the STL-10 dataset

Developing a VAE model on STL dataset

Implementation of VAE architecture with TensorFlow

Outputs

Pytorch

Transition from VAE to Generative Transformer Model: Keras Vit Library

Implementing a ViT model from scratch

Outputs

Implementing a ViT model pre trained with ViT model

Outputs

Training Pretrained ViT vs ViT scratch

Pretrained Vision Transformer

Advantages

Disadvantages

Training a VIT model from scratch

Advantages

Disadvantages

Examining the loss curve

Optimization of ViT models

Conclusion

10. Architectural Refactoring for Generative Modeling

Introduction

Structure

Objectives

STL dataset

Exploring the combination process: Outline

Refactoring TransVAE and improving

Cyclic Learning Rate Schedule

LearningRateScheduler

EarlyStopping

Weight decay: L2 regularization

Improved Encoder Decoder

SWIN-Transformer

Implementation of SWIN Transformer: VAE

Improving the models

Conclusion

11. Major Technical Roadblocks in Generative AI and Way Forward

Introduction

Structure

Objectives

Challenges and hurdles in Generative AI

NLP based generative models

Large language models and image-based foundation models

Embedding in language models

Embedding in image

Generative AI and embeddings

Vector data bases and image embeddings

Vector databases

Image embeddings

Building an image search using pinecone and vector database

Conclusion

12. Overview and Application of Generative AI Models

Introduction

Structure

Objectives

GenAI in hospital

GenAI in dental

GenAI in radiology

GenAI in retail

GenAI in finance

GenAI in corporate finance

GenAI in insurance

Conclusion

13. Key Learnings

Introduction

Structure

Objectives

Key learning from all the chapters

Chapter 1: Introducing Generative AI

Chapter 2: Designing Generative Adversarial Networks

Chapter 3: Training and Developing Generative Adversarial Networks

Chapter 4: Architecting Auto Encoder for Generative AI

Chapter 5: Building and Training Generative Autoencoders

Chapter 6: Designing Generative VAE

Chapter 7: Building Variational AutoEncoders for Generative AI

Chapter 8: Designing New Age Generative Vision Transformer for Generative Learning

Chapter 9: Implementing Generative Vision Transformers

Chapter 10: Architectural Refactoring Combining Encoder-decoder and Transformers for Generative Modeling

Chapter 11: Major Technical Roadblocks in Generative AI

Chapter 12: Overview of Applications of Generative AI Models

Index

Polecaj historie