code: def evaluation(local_rank, config, logger, with_clearml):
      rank = idist.get_rank()
      device = idist.device()
      manual_seed(config.seed + local_rank)
  
      data_loader = config.data_loader
      model = config.model.to(device)
  
      # Load weights:
      state_dict = get_model_weights(config, logger, with_clearml)
      model.load_state_dict(state_dict)
  
      # Adapt model to dist config
      model = idist.auto_model(model)
  
      # Setup evaluators
      num_classes = config.num_classes
      cm_metric = ConfusionMatrix(num_classes=num_classes)
  
      val_metrics = {
          "IoU": IoU(cm_metric),
          "mIoU_bg": mIoU(cm_metric),
      }
  
      if ("val_metrics" in config) and isinstance(
          config.val_metrics, dict
      ):
          val_metrics.update(config.val_metrics)
  
      evaluator = create_evaluator(
          model, val_metrics, config, with_clearml, tag="val"
      )
  
      # Setup Tensorboard logger
      if rank == 0:
          tb_logger = common.TensorboardLogger(
              log_dir=config.output_path.as_posix()
          )
          tb_logger.attach_output_handler(
              evaluator,
              event_name=Events.COMPLETED,
              tag="validation",
              metric_names="all",
          )
  
      # Log confusion matrix to ClearML:
      if with_clearml:
          evaluator.add_event_handler(
              Events.COMPLETED,
              compute_and_log_cm,
              cm_metric,
              evaluator.state.iteration,
          )
  
      state = evaluator.run(data_loader)
      utils.log_metrics(
          logger,
          0,
          state.times["COMPLETED"],
          "Validation",
          state.metrics,
      )
  
      if idist.get_rank() == 0:
          tb_logger.close()
  
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 9 for calling a global function with example usage: evaluation(local_rank, config, logger, with_clearml) without return types