Skip to content

This repository contains all the code examples, projects, and resources used in "The Complete Hugging Face Blueprint" book. The book provides a comprehensive guide to using Hugging Face's ecosystem for natural language processing, computer vision, and other machine learning tasks.

Notifications You must be signed in to change notification settings

jkmaina/huggingface_book

Repository files navigation

The Complete Hugging Face Blueprint

Book Cover

Code repository for the book The Complete Hugging Face Blueprint by James Karanja Maina.

Overview

This repository contains all the code examples, projects, and resources used in "The Complete Hugging Face Blueprint" book. The book provides a comprehensive guide to using Hugging Face's ecosystem for natural language processing, computer vision, and other machine learning tasks.

Repository Structure

The repository is organized by chapters, with each chapter containing lesson files that correspond to specific sections in the book:

  • Chapter 1-25: Individual chapter folders containing Python scripts for each lesson
  • Models: Various fine-tuned models created throughout the book
    • bert-sentiment-imdb: BERT model fine-tuned for sentiment analysis on IMDB dataset
    • legal-gpt2: GPT-2 model fine-tuned on legal texts
    • pokemon_fine_tuned: Stable Diffusion model fine-tuned on Pokemon images
    • vit-beans-classifier: Vision Transformer model for classifying bean images
    • And many more!
  • Utilities: Helper functions and common code used across chapters
  • Images: Image files used in examples and demonstrations

Key Projects

Throughout the book, you'll build several practical projects:

  1. Text Classification: Fine-tuning models for sentiment analysis and text categorization
  2. Language Generation: Creating specialized language models for specific domains
  3. Image Classification: Building and training vision models for image recognition tasks
  4. Text-to-Image Generation: Working with diffusion models like Stable Diffusion
  5. Model Optimization: Techniques for pruning and optimizing transformer models
  6. Model Deployment: Methods for serving models in production environments

Getting Started

Prerequisites

  • Python 3.8 or higher
  • PyTorch
  • Transformers library
  • Datasets library
  • Diffusers library (for image generation chapters)

Environment Setup

The repository includes a virtual environment (hf-env) with all necessary dependencies. To create a similar environment:

python -m venv hf-env
source hf-env/bin/activate  # On Windows: hf-env\Scripts\activate
pip install -r requirements.txt

Chapter Highlights

  • Chapter 1-7: Fundamentals of Hugging Face ecosystem and transformer models
  • Chapter 8-13: Advanced NLP tasks and model fine-tuning
  • Chapter 14-19: Computer vision and multimodal models
  • Chapter 20-25: Diffusion models, deployment, and production considerations

Models and Datasets

The code examples use a combination of:

  • Pre-trained models from the Hugging Face Hub
  • Custom fine-tuned models created during the lessons
  • Public datasets for training and evaluation
  • Synthetic data generated for specific examples

Additional Resources

License

This project contains code examples for educational purposes. Please refer to the book for usage rights and restrictions.

Author

James Karanja Maina


Happy learning with Hugging Face!

About

This repository contains all the code examples, projects, and resources used in "The Complete Hugging Face Blueprint" book. The book provides a comprehensive guide to using Hugging Face's ecosystem for natural language processing, computer vision, and other machine learning tasks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages