Share your work on the Hub
What you’ll learn
Section titled “What you’ll learn”This lesson closes Phase 1 by turning your work outward: you publish a model on the Hugging Face Hub so anyone (including future you) can load it with the same from_pretrained call you have used on other people’s models all track. The source curriculum is the Hugging Face LLM Course, Chapter 4, freely available and Apache-2.0 licensed at huggingface.co/learn/llm-course/chapter4.
You will authenticate with notebook_login(); push a model and tokenizer with the push_to_hub API (during training via TrainingArguments, or directly on the objects); compare that to the two lower-level routes (the huggingface_hub library and the git/git-lfs workflow); see what a usable model repo contains and why weights are tracked by git-lfs; and write a model card, the README.md that documents intended use, training data, and limitations and is the real deliverable.
Where this fits
Section titled “Where this fits”This is lesson 4 of 12, the close of Phase 1 (the Transformers library). It completes the run-adapt-share arc: lesson 2 ran models, lesson 3 adapted one, and this lesson shares it. It connects directly back to lesson 3 (you publish what you fine-tuned) and forward to Phase 2, which turns to the data and tokenizers that everything so far has quietly depended on.
Before you start
Section titled “Before you start”Prerequisites: lesson 3 of this track (fine-tuning with the Trainer), since the most natural thing to share is the model you trained there, and push_to_hub=True in TrainingArguments is the bridge. You will need a free Hugging Face account (create one at huggingface.co/join) to actually upload. Install with pip install transformers huggingface_hub.
About the math
Section titled “About the math”None, and almost no new modeling. This is a workflow lesson: authentication, uploading, and documentation. The code is short calls (notebook_login(), push_to_hub(...)) rather than computation, and the one conceptual idea (git-lfs for large files) is explained, not derived.
By the end, you’ll be able to
Section titled “By the end, you’ll be able to”The single capability this lesson builds: push a fine-tuned model and its tokenizer to the Hub with a model card, and explain why sharing matters. Concretely, you will be able to:
- Authenticate to the Hub with
notebook_login()(orhf auth login) - Push a model and tokenizer with the
push_to_hubAPI (and viaTrainingArguments) - Compare the three upload routes (
push_to_hub, thehuggingface_hublibrary, git/git-lfs) - Identify what a usable model repo contains and why git-lfs is used for weights
- Write a model card that documents intended use, training data, and limitations
Time and difficulty
Section titled “Time and difficulty”- Read time: about 10 minutes
- Practice time: about 10 minutes (push a real model and tokenizer, write a minimal model card, plus flashcards)
- Difficulty: standard (a workflow lesson; short calls, but you do need a free Hub account)