class_docstr: creates a T5 model using onnx sessions (encode, decoder & init_decoder)
class_docstr_tok: ["creates","a","T5","model","using","onnx","sessions","(","encode",",","decoder","&","init_decoder",")"]
code: def __init__(self, model_or_model_path, onnx_model_sessions):
      config = AutoConfig.from_pretrained(
          model_or_model_path, use_auth_token=get_auth_token()
      )
      super().__init__(config)
  
      # monkeypatch to work for MT5
      if (
          isinstance(model_or_model_path, str)
          and "mt5" in model_or_model_path.lower()
      ) or (
          hasattr(model_or_model_path, "name_or_path")
          and "mt5" in model_or_model_path.name_or_path
      ):
          self.model_type = "mt5"
          self.config_class = MT5Config
          self._keys_to_ignore_on_load_missing = [
              r"encoder\.embed_tokens\.weight",
          ]
          self._keys_to_ignore_on_save = [
              r"encoder\.embed_tokens\.weight",
          ]
  
      assert (
          len(onnx_model_sessions) == 3
      ), "all three models should be given"
  
      (
          encoder_sess,
          decoder_sess,
          decoder_sess_init,
      ) = onnx_model_sessions
  
      self.encoder = T5Encoder(encoder_sess)
      self.decoder = T5Decoder(decoder_sess)
      self.decoder_init = T5DecoderInit(decoder_sess_init)
  
imports: from .huggingface_utils import get_auth_token
  from .ort_settings import get_onnx_runtime_sessions
  from .onnx_exporter import generate_onnx_representation, quantize, get_model_paths, saved_models_path
  from pathlib import Path
  from transformers import AutoConfig, MT5Config, T5ForConditionalGeneration
  from transformers.modeling_outputs import Seq2SeqLMOutput, BaseModelOutput
  import torch
  import functools
  import operator
label_desc: Use image node_id 1 to create a new OnnxT5 object from inherited base classes: T5ForConditionalGeneration with example: obj = OnnxT5(model_or_model_path, onnx_model_sessions)