code: def main():
      parser = argparse.ArgumentParser(
          description="CRAFT custom data train"
      )
      parser.add_argument(
          "--yaml",
          "--yaml_file_name",
          default="custom_data_train",
          type=str,
          help="Load configuration",
      )
      parser.add_argument(
          "--port",
          "--use ddp port",
          default="2346",
          type=str,
          help="Port number",
      )
  
      args = parser.parse_args()
  
      # load configure
      exp_name = args.yaml
      config = load_yaml(args.yaml)
  
      print("-" * 20 + " Options " + "-" * 20)
      print(yaml.dump(config))
      print("-" * 40)
  
      # Make result_dir
      res_dir = os.path.join(config["results_dir"], args.yaml)
      config["results_dir"] = res_dir
      if not os.path.exists(res_dir):
          os.makedirs(res_dir)
  
      # Duplicate yaml file to result_dir
      shutil.copy(
          "config/" + args.yaml + ".yaml",
          os.path.join(res_dir, args.yaml) + ".yaml",
      )
  
      if config["mode"] == "weak_supervision":
          # NOTE: half GPU assign train / half GPU assign supervision setting
          ngpus_per_node = torch.cuda.device_count() // 2
          mode = "weak_supervision"
      else:
          ngpus_per_node = torch.cuda.device_count()
          mode = None
  
      print(f"Total process num : {ngpus_per_node}")
  
      manager = mp.Manager()
      buffer1 = manager.list(
          [None] * config["test"]["custom_data"]["test_set_size"]
      )
  
      buffer_dict = {"custom_data": buffer1}
      torch.multiprocessing.spawn(
          main_worker,
          nprocs=ngpus_per_node,
          args=(
              args.port,
              ngpus_per_node,
              config,
              buffer_dict,
              exp_name,
              mode,
          ),
      )
  
imports: import argparse
  import os
  import shutil
  import time
  import multiprocessing
  import yaml
  import numpy
  import torch
  import torch.nn
  import torch.optim
  import wandb
  from config.load_config import load_yaml, DotDict
  from data.dataset import SynthTextDataSet, CustomDataset
  from loss.mseloss import Maploss_v2, Maploss_v3
  from model.craft import CRAFT
  from eval import main_eval
  from metrics.eval_det_iou import DetectionIoUEvaluator
  from utils.util import copyStateDict, save_parser
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types