class_docstr: A training module for NER. See BaseTransformer for the core options.
docstr: Load datasets. Called after prepare data.
docstr_tok: ["Load","datasets",".","Called","after","prepare","data","."]
code: def get_dataloader(
      self, mode: int, batch_size: int, shuffle: bool = False
  ) -> DataLoader:
      "Load datasets. Called after prepare data."
      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
      )
      if features[0].token_type_ids is not None:
          all_token_type_ids = torch.tensor(
              [f.token_type_ids for f in features], dtype=torch.long
          )
      else:
          all_token_type_ids = torch.tensor(
              [0 for f in features], dtype=torch.long
          )
          # HACK(we will not use this anymore soon)
      all_label_ids = torch.tensor(
          [f.label_ids for f in features], dtype=torch.long
      )
      return DataLoader(
          TensorDataset(
              all_input_ids,
              all_attention_mask,
              all_token_type_ids,
              all_label_ids,
          ),
          batch_size=batch_size,
      )
  
imports: import argparse
  import glob
  import logging
  import os
  from argparse import Namespace
  from importlib import import_module
  import numpy
  import torch
  from seqeval.metrics import accuracy_score, f1_score, precision_score, recall_score
  from torch.nn import CrossEntropyLoss
  from torch.utils.data import DataLoader, TensorDataset
  from lightning_base import BaseTransformer, add_generic_args, generic_train
  from utils_ner import TokenClassificationTask
label_desc: Use image node_id 5 for calling the NERTransformer obj's underlying member method code with example usage: obj.get_dataloader(mode, batch_size, shuffle) and returns: DataLoader