code: def run_batch(self, samples_list, try_cuda=True, training=True):
      # convert samples to input tensors
      (
          tokens_tensor,
          attention_mask_tensor,
          bert_spans_tensor,
          spans_mask_tensor,
          spans_ner_label_tensor,
          sentence_length,
      ) = self._get_input_tensors_batch(samples_list, training)
  
      output_dict = {
          "ner_loss": 0,
      }
  
      if training:
          self.bert_model.train()
          ner_loss, ner_logits, spans_embedding = self.bert_model(
              input_ids=tokens_tensor.to(self._model_device),
              spans=bert_spans_tensor.to(self._model_device),
              spans_mask=spans_mask_tensor.to(self._model_device),
              spans_ner_label=spans_ner_label_tensor.to(
                  self._model_device
              ),
              attention_mask=attention_mask_tensor.to(
                  self._model_device
              ),
          )
          output_dict["ner_loss"] = ner_loss.sum()
          output_dict["ner_llh"] = F.log_softmax(ner_logits, dim=-1)
      else:
          self.bert_model.eval()
          with torch.no_grad():
              (
                  ner_logits,
                  spans_embedding,
                  last_hidden,
              ) = self.bert_model(
                  input_ids=tokens_tensor.to(self._model_device),
                  spans=bert_spans_tensor.to(self._model_device),
                  spans_mask=spans_mask_tensor.to(self._model_device),
                  spans_ner_label=None,
                  attention_mask=attention_mask_tensor.to(
                      self._model_device
                  ),
              )
          _, predicted_label = ner_logits.max(2)
          predicted_label = predicted_label.cpu().numpy()
          last_hidden = last_hidden.cpu().numpy()
  
          predicted = []
          pred_prob = []
          hidden = []
          for i, sample in enumerate(samples_list):
              ner = []
              prob = []
              lh = []
              for j in range(len(sample["spans"])):
                  ner.append(predicted_label[i][j])
                  # prob.append(F.softmax(ner_logits[i][j], dim=-1).cpu().numpy())
                  prob.append(ner_logits[i][j].cpu().numpy())
                  lh.append(last_hidden[i][j])
              predicted.append(ner)
              pred_prob.append(prob)
              hidden.append(lh)
          output_dict["pred_ner"] = predicted
          output_dict["ner_probs"] = pred_prob
          output_dict["ner_last_hidden"] = hidden
  
      return output_dict
  
imports: import os
  import sys
  import torch
  from torch import nn
  import torch.nn.functional
  from torch.nn import CrossEntropyLoss
  from allennlp.nn.util import batched_index_select
  from allennlp.nn import util
  from allennlp.modules import FeedForward
  import numpy
  from transformers import BertTokenizer, BertPreTrainedModel, BertModel
  from transformers import AlbertTokenizer, AlbertPreTrainedModel, AlbertModel
  import os
  import json
  import logging
label_desc: Use image node_id 5 for calling the EntityModel obj's underlying member method code with example usage: obj.run_batch(samples_list, try_cuda, training) and returns: output_dict