Skip to content

This repository contains resources, labs, and notes from a comprehensive Generative AI course, covering topics such as Natural Language Processing, Large Language Models, and Responsible AI. It aims to help Data Scientists and enthusiasts learn and grow in the field of Generative AI.

Notifications You must be signed in to change notification settings

ruslanmv/Generative-AI-Course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Generative AI Course Repository

This repository is dedicated to sharing my personal journey and notes on Generative AI. As a professional Data Scientist, I've created this repository to provide resources, labs, and notes for other Data Scientists and enthusiasts looking to learn and grow in the field of Generative AI.

Repository Structure

The repository is organized into folders corresponding to each section of the course. Within each folder, you will find relevant labs, notes, and resources related to that particular topic.

Course Outline: Generative AI

  1. Introduction to Generative AI

    • What is Generative AI?
    • Different types of Generative AI (Variational Autoencoders, Generative Adversarial Networks)
    • Applications of Generative AI (text generation, image generation, music generation)
    • Responsible AI and Governance
    • Bias and Fairness in AI Models
    • Explainability and Interpretability
    • Legal and Ethical Considerations
  2. Natural Language Processing (NLP)

    • Text Preprocessing:
      • Tokenization
      • Stemming
      • Lemmatization
      • Stop word removal
    • Feature Extraction Techniques:
      • Bag-of-words (BoW)
      • Term Frequency-Inverse Document Frequency (TF-IDF)
      • n-grams
    • Word Embeddings:
      • Word2Vec
      • GloVe
      • FastText
    • Recurrent Neural Networks (RNNs):
      • Understanding RNNs
      • LSTMs
      • GRUs
  3. Large Language Models (LLMs)

    • LLM architecture:
      • Transformer architecture (high-level view)
      • Tokenization
      • Attention mechanisms (self-attention, scaled dot-product attention)
      • Text generation strategies (greedy decoding, beam search, top-k sampling, nucleus sampling)
    • Building an instruction dataset:
      • Techniques for generating high-quality instruction datasets
      • Data filtering and cleaning methods
      • Exploring prompt templates for LLMs
    • Pre-training models:
      • Understanding the concept of pre-training for LLMs (high-level overview, not hands-on experience)
      • Data pipelines and challenges in pre-training LLM
      • Scaling laws and their impact on LLM performance
    • Supervised Fine-Tuning:
      • Fine-tuning pre-trained LLMs for specific tasks
      • Techniques for Supervised Fine-Tuning (SFT)
      • Parameter-efficient fine-tuning methods (LoRA, QLoRA)
      • Axolotl and DeepSpeed libraries for fine-tuning
    • Reinforcement Learning from Human Feedback (RLHF):
      • Preference datasets
      • Proximal Policy Optimization
      • Direct Preference Optimization (DPO)
    • Evaluation:
      • Traditional metrics (perplexity, BLEU score)
      • General benchmarks (Language Model Evaluation Harness, Open LLM Leaderboard)
      • Task-specific benchmarks
      • Human evaluation
    • Quantization:
      • Base techniques
      • GGUF and llama.cpp
      • GPTQ and EXL2
      • AWQ
  4. Retrieval Augmented Generation (RAG)

    • Building a Vector Storage:
      • Ingesting documents
      • Splitting documents
      • Embedding models
      • Vector databases
    • Retrieval Augmented Generation:
      • Orchestrators
      • Retrievers
      • Memory
    • Evaluation
  5. Deployment in Production

    • LLM APIs
    • Open-source LLMs (Hugging Face Hub)
    • Prompt engineering techniques
    • Structuring outputs
    • IBM WatsonX.ai:
      • Using Prompt Lab in Watson.ai
      • Load an LLM from Watson.ai
    • Integration of Watson Assistant with Watsonx.ai
  6. Diffusion Models -Introduction to Diffusion Models

    • Fine-Tuning and Guidance
    • Advanced Diffusion Models and Techniques
  7. Multi-Modal Large Language Models (LLMs)

  • Demystifying Multi-Modal LLMs
    • Applications of Multi-Modal LLMs
    • Understanding the Technology
    • Architecture of Multi-Modal LLMs
    • Challenges and Considerations
    • Bias and Fairness
    • Future of Multi-Modal LLMs
    • Potential Advancements
  • Creating a Multimodal Model: Combining LLM with Images
    • Choosing a Multi-Modal LLM
    • Loading Image Data
    • Initializing the Multi-Modal LLM
    • Building a Multi-Modal Vector Store/Index
    • Retrieving Information
    • Optional: Query Engine

πŸ“ Notebooks

A list of notebooks related to Generative AI.

Data Preparation

Notebook Description
Documents -> Dataset Given Documents generate Instruction/QA dataset for finetuning LLMs
Topic -> Dataset Given a Topic generate a dataset to finetune LLMs
Alpaca Dataset Generation The original implementation of generating instruction dataset followed in the alpaca paper

Fine-tuning

Notebook Description
Fine-tune Llama 2 with SFT Step-by-step guide to supervised fine-tune Llama 2 in Google Colab.
Fine-tune CodeLlama using Axolotl End-to-end guide to the state-of-the-art tool for fine-tuning.
Fine-tune Mistral-7b with SFT Superd fine-tune Mistral-7b in a free-tier Google Colab with TRL.
Fine-tune Mistral-7b with DPO Boost the performance of supervised fine-tuned models with DPO.
Fine-tune Llama 3 with ORPO Cheaper and faster fine-tuning in a single stage with ORPO.
Gemma Finetuning Notebook to Finetune Gemma Models
Mistral-7b Finetuning Notebook to Finetune Mistral-7b Model
Mixtral Finetuning Notebook to Finetune Mixtral-7b Models
Llama2 Finetuning Notebook to Finetune Llama2-7b Model
Alpaca_+TinyLlama+_RoPE_Scaling TinyLlama: 3.9x faster, 74% less memory use.
Alpaca_+_Phi_3_3_8b Phi-3 (3.8B): 2x faster, 50% less memory use.
DPO_Zephyr DPO Zephyr: 1.9x faster, 43% less memory use.
ORPO_Unsloth ORPO: 1.9x faster, 43% less memory use.
Alpaca_+_Gemma_7b Gemma (7B): 2.4x faster, 71% less memory use.
Alpaca_+_Mistral_7b Mistral (7B): 2.2x faster, 73% less memory use.
Alpaca_+_Llama_3_8b Llama 3 (8B): 2x faster, 60% less memory use

Quantization

Notebook Description
Introduction to Quantization Large language model optimization using 8-bit quantization.
4-bit Quantization using GPTQ Quantize your own open-source LLMs to run them on consumer hardware.
Quantization with GGUF and llama.cpp Quantize Llama 2 models with llama.cpp and upload GGUF versions to the HF Hub.
ExLlamaV2: The Fastest Library to Run LLMs Quantize and run EXL2 models and upload them to the HF Hub.
AWQ Quantization Quantize LLM using AW.
GGUF Quantization Quantize LLM to GGUF format.

Inference

Notebook Description
LLM Inference with Llama CPP Python (Llama 2.13b Chat) Inference with CPP Llama

Tools

Notebook Description
LLM AutoEval Automatically evaluate your LLMs using RunPod
LazyMergekit Easily merge models using MergeKit in one click.
LazyAxolotl Fine-tune models in the cloud using Axolotl in one click.
AutoQuant Quantize LLMs in GGUF, GPTQ, EXL2, AWQ, and HQQ formats in one click.
Model Family Tree Visualize the family tree of merged models.
ZeroSpace Automatically create a Gradio chat interface using a free ZeroGPU.

Other

Notebook Description
Improve ChatGPT with Knowledge Graphs Augment ChatGPT's answers with knowledge graphs.
Decoding Strategies in Large Language Models A guide to text generation from beam search to nucleus sampling

Transformers Basic

Notebook Description
How to Train a Model Learn the basics of training a model with transformers.
How to Generate Text Explore text generation techniques using transformers.
Reformer Architecture Dive into the Reformer architecture and its applications.
Encoder-Decoder Basics Understand the fundamentals of encoder-decoder models in transformers.
Warm Starting Encoder-Decoder Learn how to warm start encoder-decoder models for better performance.
Training Decision Transformers Train decision transformers for various tasks.
TF Serving for Deployment Deploy transformer models using TF Serving.
Fine-Tuning Whisper Models Fine-tune Whisper models for speech recognition tasks.
TF Serving for Vision Deploy transformer models for vision tasks using TF Serving.
Vertex AI Vision Explore Vertex AI Vision for computer vision tasks.
Introducing Contrastive Search Learn about contrastive search and its applications.
CLIPSeg Zero-Shot Learning Implement zero-shot learning with CLIPSeg.
PyTorch XLA Use PyTorch XLA for accelerated training.
Fine-Tuning Wav2Vec2 for English ASR Fine-tune Wav2Vec2 models for English automatic speech recognition.
Fine-Tuning XLSR Wav2Vec2 ASR Fine-tune XLSR Wav2Vec2 models for automatic speech recognition.
Constrained Beam Search Implement constrained beam search for sequence generation.
Fine-Tuning SegFormer Fine-tune SegFormer models for image segmentation tasks.
FastAI Hub Explore the FastAI Hub for transformer-based models.
Getting Started with Embeddings Learn the basics of embeddings and their applications.
Sentiment Analysis on Twitter Perform sentiment analysis on Twitter data using transformers.
TF XLA Generate Use TF XLA for accelerated generation tasks.
Training Sentence Transformers Train sentence transformers for various NLP tasks.
Federated Learning with Flower Implement federated learning with Flower.
GraphML Classification Perform graph classification using GraphML and transformers.
Hugging Face INT8 Demo Explore Hugging Face's INTo for efficient inference.

Transformers Advanced

Notebook Description
Annotated Diffusion Explore annotated diffusion techniques in transformers.
Audio Classification Classify audio data using transformer-based models.
Autoformer Transformers Are Effective Investigate the effectiveness of autoformer transformers.
Automatic Mask Generation Generate masks automatically using transformer-based models.
Benchmark Benchmark various transformer models for performance.
Causal Language Modeling Flax Implement causal language modeling using Flax and transformers.
Image Captioning BLIP Generate image captions using BLIP and transformers.
Image Captioning Pix2Struct Explore image captioning using Pix2Struct and transformers.
Image Classification TF Classify images using TensorFlow and transformers.
Image Classification Classify images using transformer-based models.
Image Classification Albumentations Use Albumentations with transformers for image classification.
Image Classification Kornia Utilize Kornia with transformers for image classification.
Image Similarity Measure image similarity using transformer-based models.
Language Modeling TF Implement language modeling using TensorFlow and transformers.
Language Modeling Explore language modeling using transformer-based models.
Language Modeling From Scratch TF Build language models from scratch using TensorFlow and transformers.
Language Modeling From Scratch Implement language modeling from scratch using transformers.
Masked Language Modeling Flax Explore masked language modeling using Flax and transformers.
Multiple Choice TF Implement multiple choice tasks using TensorFlow and transformers.
Multiple Choice Explore multiple choice tasks using transformer-based models.
Multivariate Informer Forecast multivariate time series data using informer and transformers.
Multi-Lingual Speech Recognition Recognize speech in multiple languages using transformers.
Nucleotide Transformer DNA Sequence Modeling Model DNA sequences using nucleotide transformers.
Nucleotide Transformer DNA Sequence Modeling with PEFT Use PEFT with nucleotide transformers for DNA sequence modeling.
ONNX Export Export transformer models to ONNX format.
Patch TSMixer Implement patch-based TSMixer using transformers.
Patch TST Explore patch-based TST using transformers.
Protein Folding Predict protein structures using transformer-based models.
Protein Language Modeling TF Implement protein language modeling using TensorFlow and transformers.
Protein Language Modeling Explore protein language modeling using transformer-based models.
Question Answering TF Implement question answering using TensorFlow and transformers.
Question Answering Explore question answering using transformer-based models.
Question Answering ORT Use ORT with transformers for question answering.
Segment Anything Segment objects using transformer-based models.
Semantic Segmentation TF Implement semantic segmentation using TensorFlow and transformers.
Semantic Segmentation Explore semantic segmentation using transformer-based models.
Speech Recognition Recognize speech using transformer-based models.
Summarization TF Implement summarization using TensorFlow and transformers.
Summarization Explore summarization using transformer-based models.
Summarization ORT Use ORT with transformers for summarization.
Text Classification TF Implement text classification using TensorFlow and transformers.
Text Classification Explore text classification using transformer-based models.
Text Classification Flax Use Flax with transformers for text classification.
Text Classification ORT Use ORT with transformers for text classification.
Text Classification Quantization Inc Implement text classification with quantization using Inc.
Text Classification Quantization ORT Use ORT with transformers for text classification with quantization.
Time-Series Transformers Explore time-series forecasting using transformer-based models.
Time Series Datasets Load and explore time series datasets using transformers.
Tokenizer Training Train tokenizers using transformer-based models.
Token Classification TF Implement token classification using TensorFlow and transformers.
Token Classification Explore token classification using transformer-based models.
TPU Training TF Train models using TPUs and TensorFlow with transformers.
Translation TF Implement machine translation using TensorFlow and transformers.
Translation Explore machine translation using transformer-based models.
Video Classification Classify videos using transformer-based models.
Zero-Shot Object Detection with OWLViT Implement zero-shot object detection using OWLViT and transformers.
Video Classification Classify videos using transformer-based models.
Zero-Shot Object Detection with OWLViT Implement zero-shot object detection using OWLViT and transformers.

Accelerate Examples

Notebook Description
Simple CV Example Explore computer vision tasks using accelerate.
Simple NLP Example Explore natural language processing tasks using accelerate.

Idefics

Notebook Description
Finetune Image Captioning PEFT Finetune image captioning models using PEFT.

Contributing


I'm thrilled to have you contribute to this repository! If you're interested in adding new content, fixing bugs, or improving the existing materials. Thank you for helping to make this repository a valuable resource for the Generative AI community!

About the Author


I'm Ruslan Magana Vsevolodovna, a professional Data Scientist with a passion for Generative AI. You can learn more about me and my work at ruslanmv.com.

Thank you for visiting this repository, and I hope you find the resources helpful in your Generative AI journey!

About

This repository contains resources, labs, and notes from a comprehensive Generative AI course, covering topics such as Natural Language Processing, Large Language Models, and Responsible AI. It aims to help Data Scientists and enthusiasts learn and grow in the field of Generative AI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages