code: def run_test(
      test_dataloader,
      jiant_model: JiantModel,
      task,
      device,
      local_rank,
      verbose=True,
      return_preds=True,
  ):
      if not local_rank == -1:
          return
      jiant_model.eval()
      evaluation_scheme = evaluate.get_evaluation_scheme_for_task(
          task=task
      )
      eval_accumulator = evaluation_scheme.get_accumulator()
  
      for step, (batch, batch_metadata) in enumerate(
          maybe_tqdm(
              test_dataloader,
              desc=f"Eval ({task.name}, Test)",
              verbose=verbose,
          )
      ):
          batch = batch.to(device)
  
          with torch.no_grad():
              model_output = wrap_jiant_forward(
                  jiant_model=jiant_model,
                  batch=batch,
                  task=task,
                  compute_loss=False,
              )
          batch_logits = model_output.logits.detach().cpu().numpy()
          eval_accumulator.update(
              batch_logits=batch_logits,
              batch_loss=0,
              batch=batch,
              batch_metadata=batch_metadata,
          )
      output = {
          "accumulator": eval_accumulator,
      }
      if return_preds:
          output[
              "preds"
          ] = evaluation_scheme.get_preds_from_accumulator(
              task=task,
              accumulator=eval_accumulator,
          )
      return output
  
imports: from typing import Dict
  from dataclasses import dataclass
  import torch
  import jiant.tasks.evaluate
  import jiant.utils.torch_utils
  from jiant.proj.main.components.container_setup import JiantTaskContainer
  from jiant.proj.main.modeling.primary import JiantModel, wrap_jiant_forward
  from jiant.shared.constants import PHASE
  from jiant.shared.runner import complex_backpropagate, get_train_dataloader_from_cache, get_eval_dataloader_from_cache
  from jiant.utils.display import maybe_tqdm
  from jiant.utils.python.datastructures import InfiniteYield, ExtendedDataClassMixin
label_desc: Use image node_id 2 for calling a global function with example usage: run_test(test_dataloader, jiant_model, task, device, local_rank, verbose, return_preds) and returns: output