code: def get_model_weights(config, logger, with_clearml):
      path = ""
      if with_clearml:
          from clearml import Model
  
          if idist.get_rank() > 0:
              idist.barrier()
          else:
              model_id = config.weights_path
  
              logger.info(f"Loading trained model: {model_id}")
              model = Model(model_id)
              assert model is not None, f"{model_id}"
              path = model.get_local_copy()
              idist.barrier()
          path = idist.broadcast(path, src=0)
      else:
          path = config.weights_path
          logger.info(f"Loading {path}")
  
      assert Path(path).exists(), f"{path} is not found"
      return torch.load(path)
  
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 8 for calling a global function with example usage: get_model_weights(config, logger, with_clearml) and returns: torch