Part 9 of 12
Read Hugging Face Model Cards and Licenses with a Bot
GuideBy Bot Tutorials · Published · Facts last verified Nov 3, 2026
Part 9: check a model's license, gating, files and sizes from the Hub with a tested script before you download, and use a bot to read the card.
The Hugging Face Hub hosts a huge number of models, and most come with a model card: a README that says what the model is for, how it was trained, its limits and its license. Reading the card before you download is the "parts before purchase" step for machine learning. This guide shows how to pull the key facts with a short script, then use a bot to read the rest of the card with you.
What the bot can and can't do here
It can:
- Summarize a model card you paste, including its stated limits and intended uses.
- Pull out the license name and point you to the full license text.
- Estimate memory from the file sizes, using Part 2's method.
It can't:
- Tell you whether your use is allowed under a license. That's a legal question. Read the license, and ask a qualified person if it matters.
- Know what's in a card it hasn't seen. Paste it in.
- Vouch for a model's training data or quality.
Check first, download second
Read the metadata and card, check the license and file sizes, then download. Model files can be gigabytes, and some formats can run code when loaded.
A tested metadata check
The huggingface_hub library's model_info function reads a repo's metadata without downloading weights:
"""Read a model's license and card metadata from the Hugging Face Hub before you download weights."""
import sys
from huggingface_hub import model_info
repo = sys.argv[1] if len(sys.argv) > 1 else "distilbert/distilbert-base-uncased"
info = model_info(repo, files_metadata=True)
card = info.card_data.to_dict() if info.card_data else {}
print("repo:", info.id)
print("license:", card.get("license"))
print("gated:", info.gated)
print("library:", info.library_name, "| pipeline:", info.pipeline_tag)
files = sorted((s.rfilename, s.size) for s in info.siblings if s.rfilename.endswith((".safetensors", ".bin", ".onnx")))
for name, size in files[:6]:
print(f" {name}: {size/1e6:.0f} MB" if size else f" {name}")
Real output for distilbert/distilbert-base-uncased, run on Nov 3, 2026:
repo: distilbert/distilbert-base-uncased
license: apache-2.0
gated: False
library: transformers | pipeline: fill-mask
model.safetensors: 268 MB
pytorch_model.bin: 268 MB
What each line tells you
- license: apache-2.0. The license is set in the card's metadata. Hugging Face's Licenses page explains this, and says that for
license: otherthe repo should include the license text in aLICENSEfile. - gated: False. Gated models ask you to accept conditions or share contact details before you can download. The Hub docs describe how gating works.
- library and pipeline. This model is for the
transformerslibrary and thefill-masktask, so it's not a chat model. - Files. The repo offers both
model.safetensorsandpytorch_model.bin, each about 268 MB. That's consistent with a model of roughly 67 million parameters in fp32, using Part 2's 4 bytes per parameter. Check the card for the exact count.
Prefer safetensors
Hugging Face's Safetensors docs describe it as a simple, safe format for storing tensors. The older .bin files use Python's pickle, which can run code when loaded. When a repo offers both, use safetensors. PyTorch's torch.load defaults to weights_only=True in the version we checked, which also helps, but the safer file format is the better habit.
Reading the card with a bot
Copy the model card text into the bot and ask:
Here's a Hugging Face model card (pasted). Summarize: intended uses, out-of-scope uses, known limitations and biases, training data, and license. Quote the card for each item. If the card doesn't say, write "not stated" rather than guessing.
"Not stated" is the important part. Cards vary a lot, and a bot will happily fill gaps with plausible text.
A licensing checklist
- Find the license in the metadata and read the full text, not just the name.
- Check for extra terms in the card, such as acceptable use policies.
- Check the dataset licenses too, if you're going to train or fine-tune.
- Keep a record of the repo, the commit or revision you used, and the license, alongside your project.
- Ask a professional if you plan to sell or ship something built on a model. We don't give legal advice.
Privacy
Don't send private data to a hosted model or upload it to a public repo unless you're allowed to. If you fine-tune on your own data, check that the data can be used that way, and keep the resulting model private if it might have memorized something sensitive.
Pin the revision you used
Models on the Hub can change after you download them. model_info and the download functions in huggingface_hub accept a revision, such as a commit hash. Record the revision with your project, the same way Part 3 pins library versions. If the card or license changes later, you still know what you agreed to and what you ran.
Tested vs documented
- Tested by us: the metadata script, run against the live Hub for one public model. We didn't download or run the weights.
- Documented, not tested by us: gating, license rules and safetensors behaviour, from Hugging Face's docs.
Where to go next
The final day covers exporting a model to ONNX, reading error messages and profiling, and a bot-assisted review of training code.
Safety, licensing and privacy: read this before you run anything
This series is about learning and small personal projects with machine learning libraries. A bot is a helper, not an authority.
- Check bot advice against official docs. Version numbers, install commands and compatibility tables change often. Compare every answer with the PyTorch, TensorFlow, JAX, scikit-learn, NVIDIA, Hugging Face or ONNX Runtime pages we link. If the bot and the docs disagree, the docs win.
- Work in a virtual environment. Don't install or remove packages in your system Python, and don't run
sudo pip. - Run untrusted files carefully. Pickle-based model files can run code when loaded. Only load models from sources you trust, and prefer safer formats like safetensors where the library supports them.
- Respect licenses. Datasets and model weights carry their own licenses and terms. Read the model card and license before you use, share or sell anything built on them. We don't give legal advice; ask a qualified person if it matters.
- Protect personal data. Don't paste private, customer or medical data into a bot or a training set unless you have the right to, and check the bot's own privacy settings first.
- No hardware claims you didn't measure. Treat any speed figure from a bot as a guess until you've timed it on your own machine.
- No medical, legal or financial decisions from a toy model. These guides are for learning only.
FAQ
Where does the license come from?
From the model card's metadata. Hugging Face's Licenses page explains that the license is set in the card's YAML, and that license: other needs a LICENSE file in the repo.
Why prefer safetensors?
Hugging Face's Safetensors docs describe it as a safe format for storing tensors, unlike pickle-based files, which can run code when loaded.
Was this tested?
Yes. The script read real metadata for distilbert/distilbert-base-uncased from the Hub on Nov 3, 2026. We didn't download the weights.
Sources
- Hugging Face Hub: Model Cards
- Hugging Face Hub: Licenses
- Hugging Face Hub Python library
- Hugging Face: Safetensors
- Hugging Face Transformers: Installation
- Hugging Face Transformers: Model training anatomy
More in this series
- Part 1: GPU, Driver and CUDA Compatibility: A Bot-Assisted Check · Guide
- Part 2: How Much Memory Does a Model Need? A Data Brief · Data brief
- Part 3: Pin Versions and Build Reproducible ML Environments · Walkthrough
- Part 4: NumPy and pandas Basics with a Bot: Cheat Sheet · Cheat sheet
- Part 5: Your First scikit-learn Model, Built with a Bot · Walkthrough
- Part 6: PyTorch on the CPU: First Steps with a Bot · Guide
- Part 7: TensorFlow and Keras Install Requirements, Explained · Explainer
- Part 8: JAX on the CPU: Field Notes with a Bot · Field notes
- Part 9: Read Hugging Face Model Cards and Licenses with a Bot (you are here) · Guide
- Part 10: Export a Model to ONNX and Run It: A Deep Dive · Deep dive
- Part 11: Read ML Error Messages and Profile Code: Cheat Sheet · Cheat sheet
- Part 12: Review Your Training Code with a Bot: Checklist · Checklist
See the ML Libraries with a Bot series hub · Latest on Bot Tutorials
Bot advice can be wrong. We cite official docs; check them yourself before acting, especially for anything involving money, safety or your data.