code: def val_with_args(args):
      if not args.cfg:
          raise RuntimeError(
              "No configuration file has been specified."
          )
      cfg = Config(args.cfg)
      builder = make_default_builder(cfg)
  
      utils.show_env_info()
      utils.show_cfg_info(cfg)
      utils.set_device(args.device)
  
      model = builder.model
      if args.model_path:
          paddleseg.utils.utils.load_entire_model(
              model, args.model_path
          )
          logger.info("Params are successfully loaded.")
      val_dataset = builder.val_dataset
      postprocessor = builder.postprocessor
      runner = builder.runner
  
      try:
          evaluate(
              model,
              val_dataset,
              postprocessor=postprocessor,
              runner=runner,
              num_workers=args.num_workers,
              eval_sem=args.eval_sem,
              eval_ins=args.eval_ins,
          )
      except BaseException as e:
          if args.debug:
              import traceback
  
              logger.error(traceback.format_exc())
              import sys
              import pdb
  
              pdb.post_mortem(sys.exc_info()[2])
              exit(1)
          else:
              raise
  
imports: import argparse
  import paddleseg
  from paddleseg.utils import logger, utils
  from paddlepanseg.core import evaluate
  from paddlepanseg.cvlibs import Config, make_default_builder
label_desc: Use image node_id 2 for calling a global function with example usage: val_with_args(args) without return types