class_docstr: GLUE Dataset in a text-to-text format.
code: def collate_fn(self, batch):
      enc_query = [item["text_enc"] for item in batch]
      dec_input = [item["text_dec"] for item in batch]
      labels = [item["labels"] for item in batch]
  
      max_enc_query_length = (
          max([len(item) for item in enc_query]) if enc_query else 0
      )
      max_dec_input_length = (
          max([len(item) for item in dec_input]) if dec_input else 0
      )
      max_label_length = (
          max([len(item) for item in labels]) if labels else 0
      )
      if self.pad_to_max_length:
          assert max_enc_query_length <= self.max_seq_length
          assert max_dec_input_length <= self.max_seq_length_decoder
          assert max_label_length <= self.max_seq_length_decoder
          max_enc_query_length = self.max_seq_length
          max_dec_input_length = self.max_seq_length_decoder
          max_label_length = self.max_seq_length_decoder
  
      loss_mask = [
          ([1] * (len(item))) + ([0] * (max_label_length - len(item)))
          for item in labels
      ]
      enc_query = [
          item
          + [self.tokenizer.pad_id] * (max_enc_query_length - len(item))
          for item in enc_query
      ]
      dec_input = [
          item
          + [self.tokenizer.pad_id] * (max_dec_input_length - len(item))
          for item in dec_input
      ]
      labels = [
          item
          + [self.tokenizer.pad_id] * (max_label_length - len(item))
          for item in labels
      ]
  
      enc_query = torch.LongTensor(enc_query)
      dec_input = torch.LongTensor(dec_input)
      labels = torch.LongTensor(labels)
      loss_mask = torch.LongTensor(loss_mask)
  
      enc_mask = (enc_query != self.tokenizer.pad_id).long()
      dec_mask = (dec_input != self.tokenizer.pad_id).long()
  
      return {
          "text_enc": enc_query,
          "text_dec": dec_input,
          "labels": labels,
          "loss_mask": loss_mask,
          "enc_mask": enc_mask,
          "dec_mask": dec_mask,
      }
  
imports: import os
  import pickle
  from typing import Dict, List, Optional, Union
  import numpy
  import torch
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.glue_benchmark.data_processors import ColaProcessor, MnliMismatchedProcessor, MnliProcessor, MrpcProcessor, QnliProcessor, QqpProcessor, RteProcessor, Sst2Processor, StsbProcessor, WnliProcessor, XNLIProcessor
  from nemo.core.classes import Dataset
  from nemo.core.neural_types import CategoricalValuesType, ChannelType, MaskType, NeuralType, RegressionValuesType
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling the TextToTextGLUEDataset obj's underlying member method code with example usage: obj.collate_fn(batch) and returns: dict