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

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn to unleash the power of AI creativity KEY FEATURES ● Understand the core concepts related to generative AI. ● Different types of generative models and their applications. ● Learn how to design generative AI neural networks using Python and TensorFlow. DESCRIPTION This book researches the intricate world of generative Artificial Intelligence, offering readers an extensive understanding of various components and applications in this field. The book begins with an in-depth analysis of generative models, providing a solid foundation and exploring their combination nuances. It then focuses on enhancing TransVAE, a variational autoencoder, and introduces the Swin Transformer in generative AI. The inclusion of cutting edge applications like building an image search using Pinecone and a vector database further enriches its content. The narrative shifts to practical applications, showcasing GenAI's impact in healthcare, retail, and finance, with real-world examples and innovative solutions. In the healthcare sector, it emphasizes AI's transformative role in diagnostics and patient care. In retail and finance, it illustrates how AI revolutionizes customer engagement and decision making. The book concludes by synthesizing key learnings, offering insights into the future of generative AI, and making it a comprehensive guide for diverse industries. Readers will find themselves equipped with a profound understanding of generative AI, its current applications, and its boundless potential for future innovations. WHAT YOU WILL LEARN ● Acquire practical skills in designing and implementing various generative AI models. ● Gain expertise in vector databases and image embeddings, crucial for image search and data retrieval. ● Navigate challenges in healthcare, retail, and finance using sector specific insights. ● Generate images and text with VAEs, GANs, LLMs, and vector databases. ● Focus on both traditional and cutting edge techniques in generative AI. WHO THIS BOOK IS FOR This book is for current and aspiring emerging AI deep learning professionals, architects, students, and anyone who is starting and learning a rewarding career in generative AI

Author(s): Zonunfeli Ralte, Indrajit Kar
Publisher: BPB Publications
Year: 2024

Language: English
Pages: 348

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