class_docstr: General Task for Sequence2Sequence.
  
  Args:
      max_source_length: The maximum length to pad / truncate input sequences to.
      max_target_length: The maximum length to pad / truncate target sequences to.
      padding: The type of padding to apply. One of: "longest" or ``True``, "max_length", "do_not_pad" or
          ``False``.
      loss_fn: Loss function for training
      optimizer: Optimizer to use for training.
      lr_scheduler: The LR scheduler to use during training.
      metrics: Metrics to compute for training and evaluation. Changing this argument currently has no effect
      learning_rate: Learning rate to use for training, defaults to `3e-4`
      num_beams: Number of beams to use in validation when generating predictions. Defaults to `4`
      enable_ort: Enable Torch ONNX Runtime Optimization: https://onnxruntime.ai/docs/#onnx-runtime-for-training
code: def __init__(
      self,
      backbone: str = "t5-small",
      tokenizer_kwargs: Optional[Dict[str, Any]] = None,
      max_source_length: int = 128,
      max_target_length: int = 128,
      padding: Union[str, bool] = "max_length",
      loss_fn: LOSS_FN_TYPE = None,
      optimizer: OPTIMIZER_TYPE = "Adam",
      lr_scheduler: LR_SCHEDULER_TYPE = None,
      metrics: METRICS_TYPE = None,
      learning_rate: Optional[float] = None,
      num_beams: Optional[int] = None,
      enable_ort: bool = False,
      output_transform: Optional[OutputTransform] = None,
  ):
      os.environ["TOKENIZERS_PARALLELISM"] = "TRUE"
      # disable HF thousand warnings
      warnings.simplefilter("ignore")
      # set os environ variable for multiprocesses
      os.environ["PYTHONWARNINGS"] = "ignore"
      super().__init__(
          loss_fn=loss_fn,
          optimizer=optimizer,
          lr_scheduler=lr_scheduler,
          metrics=metrics,
          learning_rate=learning_rate,
          output_transform=output_transform,
      )
  
      self.collate_fn = TextSeq2SeqCollate(
          backbone=backbone,
          tokenizer_kwargs=tokenizer_kwargs,
          max_source_length=max_source_length,
          max_target_length=max_target_length,
          padding=padding,
      )
      self.model = self.backbones.get(backbone)()
      self.enable_ort = enable_ort
      self.max_source_length = max_source_length
      self.max_target_length = max_target_length
      self.num_beams = num_beams
      self._initialize_model_specific_parameters()
  
imports: import os
  import warnings
  from typing import Any, Dict, Iterable, List, Optional, Type, Union
  import torch
  from pytorch_lightning import Callback
  from pytorch_lightning.utilities import rank_zero_info
  from torch import Tensor
  from torch.nn import Module
  from flash.core.data.io.input import DataKeys, ServeInput
  from flash.core.data.io.input_transform import InputTransform
  from flash.core.data.io.output import Output
  from flash.core.data.io.output_transform import OutputTransform
  from flash.core.model import Task
  from flash.core.registry import ExternalRegistry, FlashRegistry
  from flash.core.serve import Composition
  from flash.core.utilities.imports import _TOPIC_TEXT_AVAILABLE, requires
  from flash.core.utilities.providers import _HUGGINGFACE
  from flash.core.utilities.types import INPUT_TRANSFORM_TYPE, LOSS_FN_TYPE, LR_SCHEDULER_TYPE, METRICS_TYPE, OPTIMIZER_TYPE
  from flash.text.input import TextDeserializer
  from flash.text.ort_callback import ORTCallback
  from flash.text.seq2seq.core.collate import TextSeq2SeqCollate
label_desc: Use image node_id 1 to create a new Seq2SeqTask object from inherited base classes: Task with example: obj = Seq2SeqTask(backbone, tokenizer_kwargs, max_source_length, max_target_length, padding, loss_fn, optimizer, lr_scheduler, metrics, learning_rate, num_beams, enable_ort, output_transform)