Text Generation

Initialize a HappyTextGeneration() object to perform text generation

Initialization Arguments:

  1. model_type (string): Specify the model name in all caps, such as “ROBERTA” or “ALBERT”
  2. model_name(string): below is a URL that contains potential models: MODELS
  3. use_auth_token (string): Specify the authentication token to load private models.
  4. trust_remote_code (bool): Allow for custom Python files to be used from the model_name location.

Example 1.0:

from happytransformer import HappyGeneration
# --------------------------------------#
happy_gen = HappyGeneration("GPT2", "gpt2")  # default
# happy_gen = HappyGeneration("GPT2", "gpt2-large")  # Good for Google Colab
# happy_gen = HappyGeneration("GPT2", "gpt2-xl")  # Best performance 
# happy_gen_private = HappyGeneration("GPT2", "ericfillion/gpt2", use_auth_token="123abc")

Courses

Create a text generation web app. Also learn how to fine-tune GPT-Neo

Tutorials

Text generation with training (GPT-Neo)


Table of contents