BaşlayınÜcretsiz Başlayın

Using a pipeline for summarization

Run a summarization pipeline using the "cnicu/t5-small-booksum" model from the Hugging Face hub.

A long_text about the Eiffel Tower has been provided and the pipeline module from transformers is already imported.

Bu egzersiz

Introduction to LLMs in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Load the model pipeline for a summarization task using the model "cnicu/t5-small-booksum".
  • Generate the output by passing the long_text to the pipeline; limit the output to 50 tokens.
  • Access and print the summarized text only from the output.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Load the model pipeline
summarizer = ____(____, ____)

# Pass the long text to the model
output = ____(____, ____)

# Access and print the summarized text
print(____)
Kodu Düzenle ve Çalıştır