esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

AI engineering / Beginner / 01.39

Hugging Face

The big shared library where builders find open models and datasets, and how to read a model page before you trust it.

13 min readFree

The big shared library

The last lesson, Self-Hosted Models, ended with a promise: next, Hugging Face, the big shared library of models and datasets. Here it is.

Think of a public library. You do not write every book you read. You walk in, search the shelves, check who wrote a book and what it says on the back, and borrow it. Hugging Face works like that for AI models. Most builders who use open models end up there sooner or later.

By the end you will know what lives on the Hub, what a model card is, how to read a model page in five quick looks, and how to search by task. You will also run two small Python programs that check made-up models against your needs.

Key words

Hub
The Hugging Face website where models, datasets and demo apps are stored and shared. Its full name is the Hugging Face Hub.
Repository
A folder of files with a full history of every change. Each model, dataset and demo on the Hub is one.
Model card
A short document that comes with a model. It says what the model is for, what it cannot do, and how it was made.
Licence
The rules from the owner about what you may do with a model or data, such as use it in a paid product.
Task
The kind of job a model does, such as sorting text into groups or turning speech into text.
Weights
The big files of numbers a model learned. They are the model. Downloading a model mostly means downloading its weights.
Space
A small demo app hosted on the Hub, so you can try a model in your browser.

What lives on the Hub

The Hub documentation opens with a plain claim: "The Hugging Face Hub is the reference AI platform for open ML." It says the Hub hosts over 3M models, 1M datasets, and 2M AI apps (Spaces). Those counts were on the page when this lesson was checked, on 16 November 2026. They grow, so treat them as "millions" and not as a fixed number.

The docs also explain how it is built. The Hub "hosts Git-based repositories, which are version-controlled folders that can contain all your files". Version-controlled means every change is saved, so you can see what changed and go back. If you have used Git or GitHub, this will feel familiar. If not, picture a folder that remembers every edit anyone ever made.

There are three kinds of thing on the shelves, and the docs name them: models, datasets and Spaces.

  • Models

    Trained models you can find and download, for text, images and audio. Each one has a card that tells you its limits.

  • Datasets

    Collections of data, such as sentences or pictures, that models learn from or are tested on.

  • Spaces

    Small apps that show a model working, so you can try before you download anything.

Models

The docs describe the Model Hub as the place "where the members of the Hugging Face community can host all of their model checkpoints for simple storage, discovery, and sharing". A checkpoint is a saved copy of a model at one point in its training. For you, it is simply "a model you can download".

The same page says you can download pre-trained models with the huggingface_hub client library, with Transformers, or with any of over 15 integrated libraries. "Pre-trained" means someone already did the expensive learning. You start from their result. The Self-Hosted Models lesson showed what to do with weights. The Hub is where you usually get them.

Datasets

The datasets overview says the Hub hosts "a large number of community-curated datasets for a diverse range of tasks such as translation, automatic speech recognition, and image classification". Each dataset is a Git repository too. Datasets have their own cards, and you can search and filter them by language, task and licence, like models.

Spaces

The Spaces overview says they "make it easy for you to create and deploy ML-powered demos in minutes". A Space stores its code in a Git repository, just like a model, and each new commit makes the Space rebuild and restart.

The model card

Now the most important page of any model: its card. The docs say: "Model cards are files that accompany the models and provide handy information." Under the hood a card is a simple Markdown file (plain text with light formatting marks) plus some metadata, which is facts about the model in a fixed layout. The card is the README.md file in the model's repository.

A good card should describe the model, its intended uses and potential limitations (including biases and ethical considerations), the training parameters and experiment info, which datasets were used to train it, and its evaluation results. Think of it as the label on a food packet. It does not make the food good. It lets you decide with your eyes open.

Cards have two parts with overlapping information: metadata and text descriptions. The metadata lives in a block at the very top, between two lines of three dashes. The docs call it a YAML section. YAML is a simple way to write labels and values, one per line. Here is the template the docs show.

Text
# From the Hugging Face Hub docs (Model Cards), shown without its output (not run here)
---
language: 
  - "List of ISO 639-1 code for your language"
  - lang1
  - lang2
thumbnail: "url to a thumbnail used in social sharing"
tags:
- tag1
- tag2
license: "any valid license identifier"
datasets:
- dataset1
- dataset2
base_model: "base model Hub identifier"
---

Those lines look dull, but they do real work. The docs say the metadata supports discovery: it lets users filter models on the Hub, displays the model's license, and links the datasets used to train it. If your model is a fine-tune, an adapter or a quantized version of another model, the base_model field says which. Fine-tuning and quantization have their own lessons. For now, base_model answers "what was this built from?"

Licences

A licence is the owner's permission slip. It says what you may and may not do. The Hub docs tell you to add one to any repo you create, so others know the permissions you want to give for your code or data. They also tell you the other side: "Remember to seek out and respect a project's license if you're considering using their code or data."

The licence goes in the card's metadata, in the license field, using an identifier. The docs list many, for example apache-2.0, mit and cc-by-4.0. The same list includes names such as cc-by-nc-4.0, where "nc" stands for non-commercial in the full name, Creative Commons Attribution Non Commercial 4.0. In plain words, a non-commercial licence does not let you put the thing inside a paid product.

Some models do not fit a standard identifier. The docs say you can then set the licence to other and give a name and a link, as in this example from their page.

Text
# From the Hugging Face Hub docs (Model Cards), shown without its output (not run here)
# Example from https://huggingface.co/coqui/XTTS-v1
---
license: other
license_name: coqui-public-model-license
license_link: https://coqui.ai/cpml
---

The Hub shows the licence on the model page and lets people filter by it. That makes it easy to find the licence. It does not tell you what the licence means for your product. This lesson cannot do that either, and nothing here is legal advice. For a real product, read the licence text itself, and ask a lawyer if the stakes are high.

How to read a model page

Here is a quick routine you can run on any model page. It takes a couple of minutes, and it saves hours of building on the wrong thing.

  1. 1

    Task

    What job is it for? The card's pipeline_tag "indicates the type of task the model is intended for", and the docs say it is displayed on the model page. A model for turning speech into text will not write you a poem.

  2. 2

    Size

    How big are the files? Big weights need big memory and time to load. Size is your own check against your own machine or budget. The Hub's download-stats page notes that a repo can hold several weight files, for example when a model is split into shards, or saved in different formats.

  3. 3

    Licence

    Is it shown on the page, and does it allow what you plan to do? If it says other, open the link and read it.

  4. 4

    Downloads

    How many people fetched it? The docs say the count is done on the server, and every HTTP request to the chosen query files, including GET and HEAD, counts as a download. So the number is a rough sign of interest. It is not a score for quality, and it does not tell you the model fits your job.

  5. 5

    Files

    Look in the repository. Since it is a Git repo, you can see the files and their history. Check that the weights are there, that the card has real content, and that the formats suit the tool you plan to use.

The libraries around the Hub

Hugging Face also makes code libraries that talk to the Hub. They are not installed here, so nothing below is run. Each line comes from the docs.

  • Transformers

    The docs say it "acts as the model-definition framework for state-of-the-art machine learning models in text, computer vision, audio, video, and multimodal models, for both inference and training".

  • huggingface_hub

    The Model Hub page names it as a client library for downloading pre-trained models.

  • datasets

    The Hub overview says this library lets you programmatically use datasets from the Hub, even streaming ones too large for your computer.

Worked example: checking cards in plain Python

Two small programs follow. Both use made-up model cards. None of these models exist, and the names, sizes and licences are invented for practice. They are not real Hub entries, and no network is used.

First, a parser. A real card header is lines of "key: value" between two lines of three dashes, with lists written as dashed lines. This function reads that into a Python dictionary (a table of labels and values) using only string splitting. I added a size_mb line to my made-up header because I need a size to compare. On the real Hub you read file sizes yourself.

Python
# A made-up model card header, written like the front matter on a real card.
card_text = """---
license: apache-2.0
pipeline_tag: text-classification
language:
  - en
  - fr
tags:
  - sentiment
  - small
size_mb: 250
---
# tiny-mood-reader
A made-up model card for practice."""


def parse_header(text):
    lines = text.split("\n")
    end = lines.index("---", 1)  # the line that closes the header
    header = {}
    key = None
    for line in lines[1:end]:
        if line.startswith("  - "):  # an item of the list above it
            header[key].append(line[4:].strip())
        else:
            name, _, value = line.partition(":")
            key = name.strip()
            value = value.strip()
            header[key] = value if value else []
    return header


info = parse_header(card_text)
for key, value in info.items():
    print(key, "->", value)
print("languages:", len(info["language"]))

Output

license -> apache-2.0
pipeline_tag -> text-classification
language -> ['en', 'fr']
tags -> ['sentiment', 'small']
size_mb -> 250
languages: 2

Read the output. Each label became a key. language and tags became lists because their value was empty on the first line and dashed lines followed. The parser counted 2 languages, en and fr. It is a toy: real YAML has many more rules, so use a real YAML library for real cards.

Second, a checker. It holds four made-up entries and three needs that I set myself: the task, a maximum size and a list of licences I treat as fine for commercial use. That last list is my own field, and the Hub does not provide it. It is not legal advice. For each entry it prints PASS, or FAIL with every reason.

Python
# Every entry below is MADE UP. None of these models exist.
cards = [
    "license: apache-2.0\npipeline_tag: text-classification\nsize_mb: 250",
    "license: cc-by-nc-4.0\npipeline_tag: text-classification\nsize_mb: 90",
    "license: mit\npipeline_tag: image-classification\nsize_mb: 120",
    "license: mit\npipeline_tag: text-classification\nsize_mb: 4000",
]
names = ["tiny-mood-reader", "quick-feelings", "pic-sorter", "big-mood-reader"]

# My own needs. Setting these is my job, not the Hub's.
NEED_TASK = "text-classification"
MAX_SIZE_MB = 500
COMMERCIAL_OK = {"apache-2.0", "mit", "cc-by-4.0"}  # my own list, not legal advice


def parse_simple(text):
    header = {}
    for line in text.split("\n"):
        name, _, value = line.partition(":")
        header[name.strip()] = value.strip()
    return header


for name, text in zip(names, cards):
    info = parse_simple(text)
    problems = []
    if info["pipeline_tag"] != NEED_TASK:
        problems.append("wrong task (" + info["pipeline_tag"] + ")")
    if int(info["size_mb"]) > MAX_SIZE_MB:
        problems.append("too big (" + info["size_mb"] + " MB)")
    if info["license"] not in COMMERCIAL_OK:
        problems.append("licence not on my commercial list (" + info["license"] + ")")
    if problems:
        print("FAIL", name, "-", "; ".join(problems))
    else:
        print("PASS", name)

Output

PASS tiny-mood-reader
FAIL quick-feelings - licence not on my commercial list (cc-by-nc-4.0)
FAIL pic-sorter - wrong task (image-classification)
FAIL big-mood-reader - too big (4000 MB)

One entry passed. Three failed, each for a different reason: a licence not on my list, the wrong task, and a file of 4000 MB when my limit is 500 MB. Notice the checker collects all the problems for an entry instead of stopping at the first. That makes it easy to see why something failed. Real cards have fields this toy ignores, so use it as a habit, not a gate.

Recap

Quick check

A model page shows a non-commercial licence. You are building a paid product. What do you do?

Next: inference engineering, making a model answer fast and cheap.

Sources

How is this lesson?

Last updated on 16 November 2026

Learn with me

Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.