ap.Abhishek Patel

Search

Search notes, essays, projects, the library and the AI course. Use arrow keys to choose and Enter to open.

Module 11

Hugging Face: Pre-Trained Models in Production

The Hugging Face Hub holds hundreds of thousands of free, ready-trained models and datasets. In this module you learn to find, judge, download and run them on your own machine, from a three-label email sorter to an instruction-tuned Gemma chat model, and you finish by building a handbook Q&A system that reads a PDF and answers with page numbers.

By the end of this module you can

  • read a model card for task, licence, size and language, and download only the files you need with the hf CLI
  • run gated, instruction-tuned open models like Gemma with the right chat template, and estimate whether they fit in memory
  • open up a pipeline into tokenizer, model and post-processing using AutoTokenizer and the AutoModelFor classes
  • choose between running a model locally and calling it through an Inference Provider, and explain the cost and privacy trade-off
  • build a PDF question-answering system with PyPDF, embeddings and an extractive reader that says "I don't know" honestly

Lessons

4 in this module
  1. 01The Hub, datasets, inference providers and CLIYou can find a suitable model on the Hugging Face Hub, judge it from its model card, download only what you need with the hf CLI, test it on your own data with the datasets library, and decide when to call it through an Inference Provider instead.28 min
  2. 02Instruction-tuned open models like GemmaYou can tell base and instruction-tuned models apart, get access to a gated model like Gemma, check its licence, estimate the memory it needs, and run it with the correct chat template to draft replies.28 min
  3. 03AutoModels, AutoTokenizers and AutoClassesYou can rebuild a pipeline by hand with AutoTokenizer and the right AutoModelFor class, read the logits it returns, turn them into labels and confidences, and avoid the head, truncation and tokenizer mix-ups that break production jobs.28 min
  4. 04Document Q&A pipelines with PyPDFYou can build a question-answering system over a PDF that extracts text with PyPDF, chunks it with page numbers, retrieves the closest chunks with embeddings, and uses an extractive reader to quote the answer or honestly say it is not there.30 min