1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to LLMs in Python

Connected

Exercise

Generating text

LLMs have many capabilities with text generation being one of the most popular.

You need to generate a response to a customer review found in text; it contains the same customer review for the Riverview Hotel you've seen before.

The pipeline module has been loaded for you.

Instructions

100 XP
  • Instantiate the generator pipeline specifying an appropriate task for generating text.
  • Complete the prompt by including the text and response in the f-string.
  • Complete the model pipeline by specifying a maximum length of 150 tokens and setting the pad_token_id to the end-of-sequence token.