docstr: Load datasets. Called after prepare data.
docstr_tok: ["Load","datasets",".","Called","after","prepare","data","."]
code: def get_dataloader(
      self, mode: str, batch_size: int, shuffle: bool = False
  ) -> DataLoader:
      "Load datasets. Called after prepare data."
  
      # We test on dev set to compare to benchmarks without having to submit to GLUE server
      mode = "dev" if mode == "test" else mode
  
      cached_features_file = self._feature_file(mode)
      logger.info(
          "Loading features from cached file %s", cached_features_file
      )
      features = torch.load(cached_features_file)
      all_input_ids = torch.tensor(
          [f.input_ids for f in features], dtype=torch.long
      )
      all_attention_mask = torch.tensor(
          [f.attention_mask for f in features], dtype=torch.long
      )
      all_token_type_ids = torch.tensor(
          [f.token_type_ids for f in features], dtype=torch.long
      )
      if self.hparams.glue_output_mode == "classification":
          all_labels = torch.tensor(
              [f.label for f in features], dtype=torch.long
          )
      elif self.hparams.glue_output_mode == "regression":
          all_labels = torch.tensor(
              [f.label for f in features], dtype=torch.float
          )
  
      return DataLoader(
          TensorDataset(
              all_input_ids,
              all_attention_mask,
              all_token_type_ids,
              all_labels,
          ),
          batch_size=batch_size,
          shuffle=shuffle,
      )
  
imports: import argparse
  import glob
  import logging
  import os
  import time
  from argparse import Namespace
  import numpy
  import torch
  from lightning_base import BaseTransformer, add_generic_args, generic_train
  from torch.utils.data import DataLoader, TensorDataset
  from transformers import glue_compute_metrics
  from transformers import glue_convert_examples_to_features
  from transformers import glue_output_modes, glue_tasks_num_labels
  from transformers import glue_processors
label_desc: Use image node_id 5 for calling the GLUETransformer obj's underlying member method code with example usage: obj.get_dataloader(mode, batch_size, shuffle) and returns: DataLoader