1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Hugging Face

Connected

Exercise

Building a text generation pipeline

Hugging Face pipelines make it simple to use machine learning models for a variety of tasks. In this exercise, you'll build a text generation pipeline using the gpt2 model and customize the output by adjusting its parameters.

Feel free to experiment with different prompts in the pipeline, such as "What if …?", "How to …?", or any other creative idea you'd like to explore.

Instructions

100 XP
  • Complete the missing code to build a text generation pipeline using the "gpt2" model.
  • Provide a custom sentence of your choice as the input prompt; keep it short to prevent timeouts.
  • Configure the pipeline to generate up to 10 tokens and produce 2 outputs.