class_docstr: A T5 model trained to generate text from text.
  
  For more information, please see the T5 paper, "Exploring the Limits of
  Transfer Learning with a Unified Text-to-Text Transformer".
  Appendix D contains information about the various tasks supported
  by T5.
  
  For usage information, see HuggingFace Transformers documentation section
  on text-to-text with T5:
  https://huggingface.co/transformers/usage.html.
  
  Args:
      mode (string): Name of the T5 model to use.
      output_max_length (int): The max length of the sequence to be generated.
          Between 1 and infinity.
      input_max_length (int): Max length of the input sequence.
      num_beams (int): Number of beams for beam search. Must be between 1 and
          infinity. 1 means no beam search.
      early_stopping (bool): if set to `True` beam search is stopped when at
          least `num_beams` sentences finished per batch. Defaults to `True`.
class_docstr_tok: ["A","T5","model","trained","to","generate","text","from","text",".","For","more","information",",","please","see","the","T5","paper",",","``","Exploring","the","Limits","of","Transfer","Learning","with","a","Unified","Text-to-Text","Transformer","''",".","Appendix","D","contains","information","about","the","various","tasks","supported","by","T5",".","For","usage","information",",","see","HuggingFace","Transformers","documentation","section","on","text-to-text","with","T5",":","https",":","\/\/huggingface.co\/transformers\/usage.html",".","Args",":","mode","(","string",")",":","Name","of","the","T5","model","to","use",".","output_max_length","(","int",")",":","The","max","length","of","the","sequence","to","be","generated",".","Between","1","and","infinity",".","input_max_length","(","int",")",":","Max","length","of","the","input","sequence",".","num_beams","(","int",")",":","Number","of","beams","for","beam","search",".","Must","be","between","1","and","infinity",".","1","means","no","beam","search",".","early_stopping","(","bool",")",":","if","set","to","`","True","`","beam","search","is","stopped","when","at","least","`","num_beams","`","sentences","finished","per","batch",".","Defaults","to","`","True","`","."]
docstr: Load trained LSTM model by name or from path.
  
  Args:
      name_or_path (str): Name of the model (e.g. "t5-en-de") or model saved via `save_pretrained`.
docstr_tok: ["Load","trained","LSTM","model","by","name","or","from","path",".","Args",":","name_or_path","(","str",")",":","Name","of","the","model","(","e.g",".","``","t5-en-de","''",")","or","model","saved","via","`","save_pretrained","`","."]
code: def from_pretrained(cls, name_or_path):
      """Load trained LSTM model by name or from path.
  
      Args:
          name_or_path (str): Name of the model (e.g. "t5-en-de") or model saved via `save_pretrained`.
      """
      if name_or_path in TEXTATTACK_MODELS:
          t5 = cls(TEXTATTACK_MODELS[name_or_path])
          return t5
      else:
          config_path = os.path.join(
              name_or_path, "t5-wrapper-config.json"
          )
          with open(config_path, "r") as f:
              config = json.load(f)
          t5 = cls.__new__(cls)
          for key in config:
              setattr(t5, key, config[key])
          t5.model = (
              transformers.T5ForConditionalGeneration.from_pretrained(
                  name_or_path
              )
          )
          t5.tokenizer = T5Tokenizer(
              t5.mode, max_length=t5.output_max_length
          )
          return t5
  
file_path: TextAttack/textattack/models/helpers/t5_for_text_to_text.py
imports: import json
  import os
  import torch
  import transformers
  from textattack.model_args import TEXTATTACK_MODELS
  from textattack.models.tokenizers import T5Tokenizer
label_desc: Use image node_id 4 for calling the T5ForTextToText obj's underlying member method code with example usage: obj.from_pretrained(cls, name_or_path) and returns: t5, t5