code: def main_worker(
      gpu, port, ngpus_per_node, config, buffer_dict, exp_name
  ):
      torch.distributed.init_process_group(
          backend="nccl",
          init_method="tcp://127.0.0.1:" + port,
          world_size=ngpus_per_node,
          rank=gpu,
      )
  
      # Apply config to wandb
      if gpu == 0 and config["wandb_opt"]:
          wandb.init(
              project="craft-stage1", entity="gmuffiness", name=exp_name
          )
          wandb.config.update(config)
  
      batch_size = int(config["train"]["batch_size"] / ngpus_per_node)
      config["train"]["batch_size"] = batch_size
      config = DotDict(config)
  
      # Start train
      trainer = Trainer(config, gpu)
      trainer.train(buffer_dict)
  
      if gpu == 0 and config["wandb_opt"]:
          wandb.finish()
      torch.distributed.destroy_process_group()
  
imports: import argparse
  import os
  import shutil
  import time
  import yaml
  import multiprocessing
  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
  from loss.mseloss import Maploss_v2, Maploss_v3
  from model.craft import CRAFT
  from metrics.eval_det_iou import DetectionIoUEvaluator
  from eval import main_eval
  from utils.util import copyStateDict, save_parser
label_desc: Use image node_id 2 for calling a global function with example usage: main_worker(gpu, port, ngpus_per_node, config, buffer_dict, exp_name) without return types