Qlaudia

← All courses

Hugging Face

  • Artificial Intelligence
  • Technology & Computing

The Hub is a web platform for hosting and discovering machine learning models, datasets, and interactive applications, backed by open-source Python libraries like `transformers` and `datasets`. Learn to navigate repositories, understand metadata and model cards, create Spaces, and collaborate with the ML community.

Sign in to enroll$1034 lessons

What you'll learn

  • CheckpointA saved snapshot of a model's state that packages together the learned weight tensors, architecture configuration, tokenizer settings, and vocabulary into a single shareable unit.
  • Model RepositoryA Git-backed, versioned storage unit on the Hugging Face Hub containing a model's weights, configuration files, tokenizer data, and metadata organized under a unique owner/name identifier.
  • Fine-Tuning WorkflowThe process of continuing training a pre-trained model on a smaller task-specific dataset to specialize it for target applications without training from scratch.
  • Pre-trained Model LoadingThe process of fetching a trained neural network and its learned weights from a remote repository and instantiating it in memory for inference or fine-tuning.
  • from_pretrained()The central class method in Transformers for loading models, tokenizers, and other components from either the Hugging Face Hub or a local directory.
  • Transformers LibraryHugging Face's open-source Python package that provides a unified API for loading pre-trained transformer models, tokenizers, and running inference or fine-tuning across PyTorch, TensorFlow, and JAX backends.
  • huggingface_hub Python SDKThe official Python client library for programmatically interacting with the Hugging Face Hub to upload files, download weights, search repositories, and manage authentication without leaving your Python environment.
  • Pipeline APIThe highest-level abstraction in the transformers library that bundles tokenization, inference, and post-processing into a single callable.
  • Model Sharing & PublishingThe process of uploading trained or fine-tuned models to the Hugging Face Hub to make them downloadable and reusable by others with a single line of code.
  • AutoModelA factory class that automatically instantiates the correct model architecture by reading the model type from a checkpoint's configuration file.
  • Open-Weight ModelA pre-trained neural network whose learned parameters have been publicly released, allowing anyone to download and run the model locally.
  • Inference APIA hosted REST service that runs predictions on publicly available Hub models without requiring hardware provisioning, charged per request rather than per hour of compute.
  • Model CardA structured README document at the root of a model repository that describes the model's purpose, training data, performance metrics, limitations, and responsible usage guidelines.
  • Text Generation TaskText generation is an NLP task that produces a sequence of tokens continuing or responding to a given input by training models to predict each next token based on all previously generated tokens.
  • Trainer APIA high-level class in Hugging Face transformers that encapsulates the entire training loop, handling batching, loss computation, gradient clipping, optimization, and distributed training automatically.
  • Evaluate LibraryA unified interface for computing machine learning metrics consistently and reproducibly with canonical, versioned implementations and a distributed-friendly design.
  • Local Model CachingThe mechanism that stores downloaded model files and configuration artifacts on disk to avoid repeated network requests when loading the same models.
  • TokenizerA tokenizer is the component that splits raw text into discrete token units and maps them bidirectionally to integer IDs that neural language models operate on.
  • Gradio IntegrationAn open-source Python library that converts functions into interactive web applications, serving as the primary SDK for building shareable ML demos on Hugging Face Spaces.
  • Dataset RepositoryA versioned Git-backed storage unit on the Hugging Face Hub that holds all files comprising a published dataset, including raw or processed data, metadata, and documentation.
  • Gated ModelsA Hub repository where model weights require prior approval from the author before download, enforced through access control and HTTP 403 responses until conditions are met.
  • Datasets LibraryA Python package for loading, caching, transforming, and streaming machine learning datasets using memory-mapped Apache Arrow storage and zero-copy slicing.
  • Model Tags & MetadataMachine-readable labels embedded in a model's README file that power the Hub's search, filtering, and recommendation features.
  • LoRA AdapterA parameter-efficient fine-tuning technique that trains only small, low-rank weight matrices injected into specific model layers while keeping the original weights frozen.
  • Text Classification TaskText classification is an NLP task that assigns one or more predefined category labels to an input text sequence by learning a mapping from raw text to discrete class probabilities.
  • Access TokensLong, randomly generated strings tied to a Hugging Face account that authenticate programmatic requests to the Hub and can be scoped to read or write permissions.
  • AutoTokenizerA factory class that automatically loads the exact tokenizer associated with a given model checkpoint, ensuring input text is tokenized using the algorithm the model was trained with.
  • Embeddings & Feature ExtractionThe process of converting text into fixed dense vector representations that encode meaning and can be used directly in downstream machine learning tasks.
  • SpacesHugging Face Spaces is a hosting platform that automatically builds and deploys interactive machine-learning applications as public web apps from Git repositories without requiring server management or deployment configuration.
  • Dataset StreamingA loading mode that fetches and decodes dataset examples incrementally as they are iterated rather than downloading the entire dataset to disk beforehand.
  • bitsandbytes IntegrationGPU acceleration library integrated into Hugging Face transformers that enables loading and running large language models in 4-bit or 8-bit quantized form with minimal code changes.
  • PEFT LibraryA Hugging Face library providing fine-tuning methods that update only a small subset of a model's parameters to reduce memory and compute costs.
  • Inference EndpointsA managed deployment service that provisions a dedicated cloud instance with a private URL to serve a specific Hub model with predictable latency and configurable throughput.
  • QuantizationQuantization is the process of representing model weights using lower-precision numerical formats than standard floating point to reduce memory footprint and enable inference on resource-constrained hardware.

About this course

Hugging Face Overview

What Is Hugging Face?

Hugging Face is an AI company and open-source community that has built one of the most widely used ecosystems for machine learning (ML). At its centre is the Hugging Face Hub — a web-based platform where researchers, engineers, and hobbyists can host, discover, and share three core types of ML artifacts: models, datasets, and Spaces (interactive applications). Think of it as a GitHub for machine learning, but purpose-built for the unique needs of the field: storing large binary files, running model inference, previewing datasets, and launching live demos.

Beyond the Hub itself, Hugging Face maintains a suite of open-source Python libraries — most notably transformers, datasets, tokenizers, diffusers, and huggingface_hub — that make it straightforward to download and use artifacts from the Hub in your own code. The platform and the libraries reinforce each other: artifacts on the Hub are designed to be consumed directly by the libraries, and the libraries make it trivial to push your own work back to the Hub.


Why Does Hugging Face Exist?

Training large ML models from scratch is expensive and time-consuming. A researcher who has already trained a state-of-the-art language model should be able to share it so that others can reuse it rather than rediscovering the same result independently. Hugging Face solves a concrete logistical problem: how do you store a 10 GB model file, version it, document it, and let anyone download or run it with a single line of code?

Before platforms like the Hub, sharing models meant uploading weight files to personal servers or Google Drive links buried in README files — fragile, undiscoverable, and impossible to version. The Hub gives every artifact a persistent URL, a structured metadata card, version control via Git and Git LFS (Large File Storage), and an optional browser-based inference widget so you can try the model without writing any code.


The Three Pillars of the Hub

Models Pre-trained weights Model cards Inference widgets Version control Datasets Structured data files Dataset cards Data viewer Versioned splits Spaces Live web apps Gradio / Streamlit GPU-backed compute Shareable demos Hugging Face Hub

The three core artifact types hosted on the Hugging Face Hub, each with its own storage, metadata, and browsing interface.

Models

A model repository on the Hub stores the weight files, configuration files, and tokenizer files needed to load a trained neural network. Each repository is a Git repository under the hood, with large binary files managed via Git LFS. Every model should have a model card — a README.md file that documents what the model does, how it was trained, its intended uses, limitations, and evaluation results. Model cards are the primary mechanism for transparency and reproducibility.

Models on the Hub span nearly every ML task: text classification, translation, image generation, speech recognition, code generation, and more. You can filter by task, framework (PyTorch, TensorFlow, JAX), language, and licence.

Datasets

A dataset repository stores raw data files (CSV, Parquet, JSON, audio, image archives, etc.) along with a dataset card that describes the data's provenance, structure, intended uses, and any known biases. The Hub's built-in dataset viewer lets you browse rows of tabular data or preview images and audio directly in the browser — no download required.

The datasets Python library can stream or download any Hub dataset in a single function call:

from datasets import load_dataset
ds = load_dataset("imdb")

Spaces

Spaces are hosted web applications that typically demonstrate a model or dataset. They run on Hugging Face's infrastructure and are built with frameworks like Gradio or Streamlit. A Space lets a researcher ship an interactive demo of their model without managing servers. Users can fork a Space, modify it, and redeploy it — making Spaces a collaborative playground for applied ML.


The Open-Source Library Ecosystem

The Hub is the distribution layer; the libraries are the consumption layer. The key libraries are:

LibraryPurpose
transformersLoad and run pre-trained models for NLP, vision, audio, and multimodal tasks
datasetsDownload, stream, and process datasets from the Hub
tokenizersFast, Rust-backed tokenization used by transformers
diffusersDiffusion models for image and audio generation
huggingface_hubPython client for interacting with the Hub API (uploading, downloading, searching)

These libraries follow a consistent design principle: a repository ID of the form username/repository-name is all you need to identify and load any artifact. For example:

from transformers import pipeline
classifier = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")

This single call downloads the model weights, configuration, and tokenizer from the Hub, caches them locally, and returns a ready-to-use inference object.


Organisations, Access Control, and the Community

The Hub supports both personal accounts and organisations — shared namespaces where teams can collaborate on repositories. Repositories can be public (free, open to anyone), private (visible only to authorised users), or gated (publicly visible but requiring a request to access, commonly used for datasets with legal constraints or powerful models requiring an agreement).

The community layer includes likes, comments on model/dataset cards, and a Discussions tab on every repository — a lightweight issue tracker where users can report bugs, ask questions, or propose changes. This social layer is what makes the Hub feel like a community rather than just a file server.


How Everything Fits Together

A typical workflow on the Hub looks like this:

  1. Discover a pre-trained model or dataset by searching the Hub.
  2. Load it locally using the appropriate library (transformers, datasets, etc.).
  3. Fine-tune or process it on your own data.
  4. Push your artifact back to the Hub under your account.
  5. Document it with a model or dataset card.
  6. Demo it by creating a Space that loads your model.

This cycle — discover, reuse, improve, share — is the core loop that Hugging Face is designed to accelerate. The platform lowers the barrier to entry for newcomers (pre-trained models are immediately usable) while giving experts a structured way to share their contributions with the broader community.


Scope of This Course

This course focuses on the Hub itself — how repositories are structured, how metadata works, how to navigate and use models and datasets, how Spaces function, and how the Hub's access-control and collaboration features work. The individual libraries (transformers, datasets, etc.) are introduced where they illuminate how Hub artifacts are consumed, but their internal mechanics are treated as separate topics.

Hugging Face — Qlaudia