code: def create_evaluator(model, metrics, config, with_clearml, tag="val"):
      model_output_transform = config.get(
          "model_output_transform", lambda x: x
      )
      with_amp = config.get("with_amp", True)
      prepare_batch = data.prepare_image_mask
  
      @torch.no_grad()
      def evaluate_step(engine, batch):
          model.eval()
          with autocast(enabled=with_amp):
              x, y = prepare_batch(
                  batch, device=config.device, non_blocking=True
              )
              y_pred = model(x)
              y_pred = model_output_transform(y_pred)
              return y_pred, y
  
      evaluator = Engine(evaluate_step)
  
      for name, metric in metrics.items():
          metric.attach(evaluator, name)
  
      if idist.get_rank() == 0 and (not with_clearml):
          common.ProgressBar(
              desc=f"Evaluation ({tag})", persist=False
          ).attach(evaluator)
  
      return evaluator
  
imports: import os
  from functools import partial
  from pathlib import Path
  import fire
  import torch
  import dataflow
  import utils
  import vis
  from py_config_runner import ConfigObject, get_params, InferenceConfigSchema, TrainvalConfigSchema
  import ignite.distributed
  from ignite.contrib.engines import common
  from ignite.engine import Engine, Events
  from ignite.handlers import Checkpoint
  from ignite.metrics import ConfusionMatrix, IoU, mIoU
  from ignite.utils import manual_seed, setup_logger
label_desc: Use image node_id 5 for calling a global function with example usage: create_evaluator(model, metrics, config, with_clearml, tag) and returns: evaluator, y_pred,  y