code: def setup_args():
      args = argparse.Namespace()
      args.global_sync_iter = 20
      args.block_momentum = 0.875
      args.block_lr = 0.5
      args.input_size = 5
      args.nb_classes = 2
      args.batch_size = 1
      args.lr = [1e-3]
      args.momentum = 0
      args.weight_decay = 0
      args.warmup_iterations = 0
      args.use_nbm = True
      args.average_sync = True
      args.global_sync_iter = 1
      args.model_parallel_size = 1
      args.distributed_backend = "gloo"
  
      args.distributed_world_size = 2
      port = random.randint(10000, 20000)
      args.distributed_init_method = "tcp://localhost:{port}".format(
          port=port
      )
      args.distributed_init_host = "localhost"
      args.distributed_port = port + 1
      args.local_world_size = args.distributed_world_size
  
      cfg = OmegaConf.create()
      cfg.optimization = OmegaConf.create()
      cfg.common = OmegaConf.create()
      cfg.distributed_training = OmegaConf.create()
      cfg.dataset = OmegaConf.create()
      cfg.bmuf = OmegaConf.create()
      cfg.optimizer = OmegaConf.create()
  
      cfg.bmuf.global_sync_iter = args.global_sync_iter
      cfg.bmuf.block_momentum = args.block_momentum
      cfg.bmuf.block_lr = args.block_lr
      cfg.dataset.batch_size = args.batch_size
      cfg.optimization.lr = args.lr
      cfg.optimizer.momentum = args.momentum
      cfg.optimizer.weight_decay = args.weight_decay
      cfg.bmuf.warmup_iterations = args.warmup_iterations
      cfg.bmuf.use_nbm = args.use_nbm
      cfg.bmuf.average_sync = args.average_sync
      cfg.common.model_parallel_size = args.model_parallel_size
      cfg.distributed_training.distributed_backend = (
          args.distributed_backend
      )
      cfg.distributed_training.distributed_world_size = (
          args.distributed_world_size
      )
      cfg.bmuf.distributed_world_size = args.distributed_world_size
      cfg.distributed_training.distributed_init_method = (
          args.distributed_init_method
      )
      cfg.distributed_training.distributed_port = args.distributed_port
  
      return cfg, args
  
imports: import argparse
  import functools
  import random
  import unittest
  from multiprocessing import Manager
  import torch
  import torch.nn
  from omegaconf import OmegaConf
  from fairseq import optim
  from fairseq.distributed import utils
label_desc: Use image node_id 4 for calling a global function with example usage: setup_args() and returns: cfg,  args