code: def do_eval(
      args,
      model,
      eval_dataloader,
      mm_eval_dataloader,
      device,
      is_regression=False,
  ):
      model.eval()
      if args.task_name is not None:
          metric = load_metric("glue", args.task_name)
      else:
          metric = load_metric("accuracy")
  
      for step, batch in enumerate(eval_dataloader):
          batch = to_device(batch, device)
          outputs = model(**batch)
          predictions = (
              outputs.logits.argmax(dim=-1)
              if not is_regression
              else outputs.logits.squeeze()
          )
          metric.add_batch(
              predictions=predictions, references=batch["labels"]
          )
      eval_metric = metric.compute()
  
      eval_metric1 = None
      if args.task_name == "mnli":
          metric1 = load_metric("accuracy")
          for step, batch in enumerate(mm_eval_dataloader):
              batch = to_device(batch, device)
              outputs = model(**batch)
              predictions = (
                  outputs.logits.argmax(dim=-1)
                  if not is_regression
                  else outputs.logits.squeeze()
              )
              metric1.add_batch(
                  predictions=predictions, references=batch["labels"]
              )
          eval_metric1 = metric1.compute()
      model.train()
      return eval_metric, eval_metric1
  
imports: import torch
  from torch.nn import CrossEntropyLoss, MSELoss
  import datasets
  from datasets import load_dataset, load_metric
  import copy
  import os
  import json
  import transformers
  from transformers import AutoConfig, PretrainedConfig
  import huggingface_transformer
  from huggingface_transformer.modeling_bert import BertForSequenceClassification
  import logging
  import numpy
  import math
label_desc: Use image node_id 7 for calling a global function with example usage: do_eval(args, model, eval_dataloader, mm_eval_dataloader, device, is_regression) and returns: eval_metric,  eval_metric1