Two of the most useful things a language model can do with a long text are summarize it and answer questions about it. A summarizer condenses an article into a few sentences that keep the main message. A question answering tool takes a passage and a question, then finds the part of the passage that answers it.
The lessons start with a summarization pipeline built with Hugging Face Transformers in just a few lines of code, then go deeper into how pretrained Transformer models produce a summary. The last lesson looks inside the question answering pipeline, so you see how a model turns a question and a context into an answer.
Watch the lessons in order and code along in Google Colab or a Jupyter notebook. Once both parts work, combine them into one small app: paste in an article, show its summary, and let the user ask questions about it.
Install Hugging Face Transformers, load a pretrained summarization pipeline, generate a summary and customize it with parameters such as maximum length.
VideoBuild a summarization pipeline for your own English texts and see how a pretrained Transformer model condenses them.
VideoSee how the question answering pipeline works: tokenize a question with its context, run the model and extract the answer from the context.
Video