1. Learn
  2. /
  3. Courses
  4. /
  5. Deep Learning for Text with PyTorch

Connected

Exercise

Text completion with pre-trained GPT-2 models

Back at PyBooks, your current project involves creating captivating narratives based on existing stories to engage customers and enhance their experience. To achieve this, you need a powerful text generation tool that can seamlessly generate compelling text continuations. You'll be using a pre-trained model to get the job done.

The following has been loaded for you: torch and GPT2Tokenizer,GPT2LMHeadModel from transformers.

Instructions 1/3

undefined XP
    1
    2
    3
  • Initialize the pre-trained GPT-2 tokenizer for gpt2.
  • Initialize the pre-trained GPT-2 LMHead model for gpt2.