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","`","."]
code: def __init__(
      self,
      mode="english_to_german",
      output_max_length=20,
      input_max_length=64,
      num_beams=1,
      early_stopping=True,
  ):
      super().__init__()
      self.model = (
          transformers.T5ForConditionalGeneration.from_pretrained(
              "t5-base"
          )
      )
      self.model.eval()
      self.tokenizer = T5Tokenizer(mode, max_length=output_max_length)
      self.mode = mode
      self.output_max_length = output_max_length
      self.input_max_length = input_max_length
      self.num_beams = num_beams
      self.early_stopping = early_stopping
  
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 1 to create a new T5ForTextToText object from inherited base classes: torch.nn with example: obj = T5ForTextToText(mode, output_max_length, input_max_length, num_beams, early_stopping)