AI Hints
Home›Fine-Tuning LLMs Tutorial›Setup, the Hub and pipeline()
Fine-Tuning LLMs · Lesson 8 of 120

The Hugging Face Hub

Models you can download.

⏱ 2 min read▶ Video at 12:03🎓 Free
Watch this lesson in the Fine-Tuning LLMs courseWatch on YouTube ↗Full Fine-Tuning LLMs course

The Hugging Face Hub is where we'll find our models. Think of it as a giant library, where every book is a model, ready to borrow.

  • A giant library
  • Every book is a model
  • Ready to borrow

Model names

Every model on the Hub has a name, in two parts. First the owner, then a slash, then the model. For example, Hugging Face TB slash Small LM two, one three five M. The first time you use a model, it downloads, and is saved on your computer. After that, it loads from there.

keyvalue
Formatowner/model
ExampleHuggingFaceTB/SmolLM2-135M
First usedownloads it
After thatloads from your disk

The model card

Every model has a page, called a model card. Read it before you use a model. It tells you what the model was trained on, what it's good at, and its licence. The licence says what you're allowed to do with it, like use it in a business.

keyvalue
Model cardthe model's web page
Training datawhat it learned from
Good atwhat it's for
Licencewhat you may do with it

Look inside a model's settings

Every model comes with a config. It describes the model's shape. Auto config loads it, without loading the weights. We print a few settings. Run it. It's a llama style model, with thirty layers. Each token becomes a list of five hundred and seventy six numbers. It knows about forty nine thousand tokens. And it can read over eight thousand tokens at once.

app.pypython
from transformers import AutoConfig

config = AutoConfig.from_pretrained("HuggingFaceTB/SmolLM2-135M")
print("Model type:   ", config.model_type)
print("Layers:       ", config.num_hidden_layers)
print("Hidden size:  ", config.hidden_size)
print("Vocabulary:   ", config.vocab_size)
print("Max context:  ", config.max_position_embeddings)
Output
Model type:    llama
Layers:        30
Hidden size:   576
Vocabulary:    49152
Max context:   8192

Summary

Let's recap. Models on the Hub are named owner slash model. Always read the model card, and its licence. And the config describes the model's shape. Next, let's actually use a model, with pipeline.

Key takeaways
  • owner/model
  • Read the model card
  • AutoConfig
Next up: Your First Model: pipeline() — text in, text out