WEBVTT

1
00:00:00.000 --> 00:00:02.585
Part 9 of ML Libraries with a Bot.

2
00:00:02.585 --> 00:00:06.691
Read Hugging Face Model Cards and Licenses
with a Bot.

3
00:00:06.691 --> 00:00:13.077
The Hugging Face Hub hosts a huge number
of models, and most come with a model
card:

4
00:00:13.077 --> 00:00:19.160
a README that says what the model is for,
how it was trained, its limits and its

5
00:00:19.160 --> 00:00:19.768
license.

6
00:00:19.768 --> 00:00:26.154
Reading the card before you download is
the "parts before purchase" step for
machine

7
00:00:26.154 --> 00:00:26.839
learning.

8
00:00:27.667 --> 00:00:30.174
What the bot can and cannot do.

9
00:00:30.174 --> 00:00:36.644
Summarize a model card you paste,
including its stated limits and intended
uses.

10
00:00:36.644 --> 00:00:41.901
Pull out the license name and point you to
the full license text.

11
00:00:41.901 --> 00:00:46.673
Estimate memory from the file sizes, using
Part 2's method.

12
00:00:46.673 --> 00:00:50.960
Tell you whether your use is allowed under
a license.

13
00:00:50.960 --> 00:00:52.901
That's a legal question.

14
00:00:52.901 --> 00:00:57.672
Read the license, and ask a qualified
person if it matters.

15
00:00:57.672 --> 00:01:00.665
Know what's in a card it hasn't seen.

16
00:01:00.665 --> 00:01:01.635
Paste it in.

17
00:01:01.635 --> 00:01:05.275
Vouch for a model's training data or
quality.

18
00:01:05.875 --> 00:01:11.365
Read the metadata and card, check the
license and file sizes, then download.

19
00:01:11.365 --> 00:01:16.567
Model files can be gigabytes, and some
formats can run code when loaded.

20
00:01:17.167 --> 00:01:24.064
The huggingface_hub library's model_info
function reads a repo's metadata without

21
00:01:24.064 --> 00:01:31.132
downloading weights: Real output for
distilbert/distilbert-base-uncased, run on
Nov

22
00:01:31.132 --> 00:01:31.813
3, 2026:

23
00:01:32.583 --> 00:01:34.169
license: apache-2.0.

24
00:01:34.169 --> 00:01:37.499
The license is set in the card's metadata.

25
00:01:37.499 --> 00:01:43.841
Hugging Face's Licenses page explains
this, and says that for license: other the

26
00:01:43.841 --> 00:01:49.312
repo should include the license text in a
LICENSE file. gated: False.

27
00:01:49.312 --> 00:01:55.733
Gated models ask you to accept conditions
or share contact details before you can

28
00:01:55.733 --> 00:01:56.447
download.

29
00:01:56.447 --> 00:02:01.283
The Hub docs describe how gating works.
library and pipeline.

30
00:02:02.042 --> 00:02:08.434
Hugging Face's Safetensors docs describe
it as a simple, safe format for storing

31
00:02:08.434 --> 00:02:09.073
tensors.

32
00:02:09.073 --> 00:02:14.906
The older .bin files use Python's pickle,
which can run code when loaded.

33
00:02:14.906 --> 00:02:18.182
When a repo offers both, use safetensors.

34
00:02:18.182 --> 00:02:24.814
PyTorch's torch.load defaults to
weights_only=True in the version we
checked, which

35
00:02:24.814 --> 00:02:29.449
also helps, but the safer file format is
the better habit.

36
00:02:30.208 --> 00:02:36.519
Copy the model card text into the bot and
ask: "Not stated" is the important part.

37
00:02:36.519 --> 00:02:41.983
Cards vary a lot, and a bot will happily
fill gaps with plausible text.

38
00:02:42.583 --> 00:02:48.669
Find the license in the metadata and read
the full text, not just the name.

39
00:02:48.669 --> 00:02:54.106
Check for extra terms in the card, such as
acceptable use policies.

40
00:02:54.106 --> 00:02:59.786
Check the dataset licenses too, if you're
going to train or fine-tune.

41
00:02:59.786 --> 00:03:05.953
Keep a record of the repo, the commit or
revision you used, and the license,

42
00:03:05.953 --> 00:03:07.819
alongside your project.

43
00:03:08.500 --> 00:03:13.433
Don't send private data to a hosted model
or upload it to a public repo unless

44
00:03:13.433 --> 00:03:14.571
you're allowed to.

45
00:03:14.571 --> 00:03:19.631
If you fine-tune on your own data, check
that the data can be used that way, and

46
00:03:19.631 --> 00:03:24.690
keep the resulting model private if it
might have memorized something sensitive.

47
00:03:25.417 --> 00:03:30.873
Models on the Hub can change after you
download them. model_info and the download

48
00:03:30.873 --> 00:03:35.589
functions in huggingface_hub accept a
revision, such as a commit hash.

49
00:03:35.589 --> 00:03:41.045
Record the revision with your project, the
same way Part 3 pins library versions.

50
00:03:41.045 --> 00:03:46.704
If the card or license changes later, you
still know what you agreed to and what you

51
00:03:46.704 --> 00:03:46.974
ran.

52
00:03:47.708 --> 00:03:49.353
Tested vs documented.

53
00:03:49.353 --> 00:03:55.696
Tested by us: the metadata script, run
against the live Hub for one public model.

54
00:03:55.696 --> 00:03:58.672
We didn't download or run the weights.

55
00:03:58.672 --> 00:04:05.172
Documented, not tested by us: gating,
license rules and safetensors behaviour,
from

56
00:04:05.172 --> 00:04:06.738
Hugging Face's docs.

57
00:04:07.417 --> 00:04:13.669
The final day covers exporting a model to
ONNX, reading error messages and

58
00:04:13.669 --> 00:04:18.232
profiling, and a bot-assisted review of
training code.

59
00:04:18.917 --> 00:04:24.961
Before you run anything: check every bot
answer against the official docs, work in
a

60
00:04:24.961 --> 00:04:30.860
virtual environment, load model files only
from sources you trust, respect dataset

61
00:04:30.860 --> 00:04:36.113
and model licenses, and keep personal data
out of bots and training sets.

62
00:04:36.113 --> 00:04:38.631
Every source is linked on the page.

