docstr: Initialize the T5 Encoder.
  
  :param max_seq_len: Maximum token length, defaults to 512
  :param encoder_path: Optional if loaded T5 on the disk, defaults to None
docstr_tok: ["Initialize","the","T5","Encoder",".",":","param","max_seq_len",":","Maximum","token","length",",","defaults","to","512",":","param","encoder_path",":","Optional","if","loaded","T5","on","the","disk",",","defaults","to","None"]
code: def __init__(self, max_seq_len=512, encoder_path=None):
      """
      Initialize the T5 Encoder.
  
      :param max_seq_len: Maximum token length, defaults to 512
      :param encoder_path: Optional if loaded T5 on the disk, defaults to None
      """
      super().__init__()
      self.max_seq_len = max_seq_len
  
      self.model_seq_len = 512
      # Initializing T5 model
      self.tokenizer = T5Tokenizer.from_pretrained(
          "t5-11b", model_max_length=self.model_seq_len
      )
  
      if encoder_path is None:
          self.model = T5EncoderModel.from_pretrained(
              "t5-11b", low_cpu_mem_usage=True
          )
      else:
          print(f"Load T5 encoder from {encoder_path}")
          hard_coded_encoder_weight_location = os.path.join(
              encoder_path, "t5xxl-encoder.bin"
          )
          hard_coded_encoder_config_location = os.path.join(
              os.path.dirname(__file__), "t5encoder.json"
          )
          self.model = T5EncoderModel.from_pretrained(
              hard_coded_encoder_weight_location,
              config=T5Config.from_json_file(
                  hard_coded_encoder_config_location
              ),
              low_cpu_mem_usage=True,
          )
  
imports: import os
  import torch
  from transformers import T5Config, T5EncoderModel, T5Tokenizer
label_desc: Use image node_id 1 to create a new T5Encoder object from inherited base classes: torch.nn with example: obj = T5Encoder(max_seq_len, encoder_path)