// What's Next · Done · The Associate Track
Working with Hugging Face
Completed Nov 04, 2026 · 2 hrs
Hugging Face is a community platform for sharing models and datasets. The notes cover running models locally or through inference providers, and building pipelines for text classification, summarization, and document Q&A, plus Auto classes for more control.
Hugging Face Hub
- Hub: a centralized place to find the best models, datasets, and applications for a project.
- Model card: provides a model's name, uploader, tasks, modalities, languages, license, intended use, training details, and evaluation results.
- Dataset card: holds dataset metadata such as how it was compiled, its license, and the number of rows.
- Dataset viewer: lets you preview rows, while Data Studio enables SQL queries using WHERE and LIKE.
Running models
- Local hardware: runs inference on your own computer or cloud environment, free but slow for large models without GPUs.
- Inference provider: a partner organization giving remote access to high-performance machines through the API.
- InferenceClient: configures the environment for the inference API, taking a provider and an API key from an environment variable.
Transformers library
- pipeline: a convenient class for quickly running local inference for models and tasks on Hugging Face.
- AutoModelForSequenceClassification: downloads a model for sequence classification using from_pretrained.
- AutoTokenizer: loads the tokenizer paired with a model so text is processed as it was during training.
- Custom pipeline: combines a task, model, and tokenizer for full control over tasks like sentiment analysis.
Datasets
- datasets: a Python package to access, download, use, and share datasets with minimal code.
- load_dataset: downloads a dataset by path and optional split such as train, test, or validate.
- Apache Arrow: a columnar data format used by most Hugging Face datasets for faster querying.
- .filter() and .select(): methods for filtering rows with a lambda and selecting rows by index, returning a new dataset.
NLP tasks
- text-classification: assigns predefined categories to text, as in sentiment analysis and grammatical correctness.
- zero-shot-classification: assigns predefined categories to text even when the model was not trained for them.
- summarization: reduces text to a smaller version, either extractive or abstractive.
- question-answering: generates answers to a question from a document passed as context.
PDF processing
- pypdf: a lightweight library for reading PDF files.
- PdfReader: loads a PDF by path and exposes pages and extract_text() for document Q&A.
// Module notes
The Hub and the community
Read the card before you download anything. The Hub is the centralized place to find models, datasets, and applications, and each entry carries the metadata that decides whether it is worth using: browse, filter by task, then open the model card.
- Model cards carry the model name, uploader, supported tasks and modalities, languages, license, intended use, training details, and evaluation results.
Compare models with those evaluation results, and check the license before you build on one.
Running models
Inference simply means prediction, and there are two ways to run it: on your own local hardware, or through an inference provider on the API.
- Local hardware is free but slow for large models without GPUs.
- An inference provider is a partner organization with high-performance machines; you send a request with the model and inputs, and the result comes back.
- The InferenceClient configures the environment, taking a provider and an API key from an environment variable.
Switch to a provider when the model outgrows your hardware, and keep the API key in an environment variable rather than in code.
Datasets
Pull a dataset in one call. The Hub hosts community-curated sets, each with a card, a viewer, and Data Studio for SQL queries; install the datasets package and use load_dataset with a path and an optional split such as train, test, or validate.
- Dataset cards hold metadata like how it was compiled, its license, and the number of rows.
- The viewer previews rows, while Data Studio runs SQL with WHERE and LIKE.
- Datasets use Apache Arrow columnar storage, which queries faster than row-based formats.
Manipulate rows with .filter() and .select() rather than pandas operations, since Arrow datasets behave differently.
Text classification and summarization
The task name changes with the kind of category: text classification assigns predefined labels, and there is a pipeline for each variant.
- Sentiment analysis labels emotional tone.
- Grammatical correctness labels text Acceptable or Unacceptable.
- QNLI checks whether a premise answers a question, for question-premise entailment.
- zero-shot-classification assigns dynamic categories the model was not trained for.
Summarization reduces text to a smaller version: extractive selects key sentences, while abstractive generates new text. Set min_new_tokens and max_new_tokens to control length, and prefer extractive when accuracy matters.
Auto classes and document Q&A
Pipelines are fast and simple, but Auto classes give more control over every step.
- AutoModelForSequenceClassification and AutoTokenizer load a model and its paired tokenizer with from_pretrained, so text is processed as it was during training.
- A custom pipeline then combines a task, model, and tokenizer, as in sentiment analysis.
For document Q&A, pypdf's PdfReader loads a PDF by path, exposes pages, and extract_text() pulls the text; a question-answering pipeline takes that text as context plus a question. Watch the tokenizer pairing, since the wrong one changes how the model reads your input.
In plain terms
Hugging Face is like a public library for AI: the Hub is the shelves where you borrow models and datasets, a pipeline is the front desk that hands you an answer in one visit, and Auto classes let you open the book and work through the pages yourself. You can run a model on your own machine or pay an inference provider to run it for you, then feed it text to classify, summarize, or question. Read the card first, because the license and the evaluation results decide whether a model is worth your time.
Worth sitting with
- What does a model card's evaluation result actually measure, and what does it leave out?
- When does running a model locally stop being cheaper than an inference provider once you count hardware and time?
- Why does the tokenizer have to match the model, and what breaks when it does not?
// Where this fits
The concepts above are the ones this module turns on, and the notes below explain each in turn. The course page carries the whole track, and the certificate page carries the plan it belongs to.