code: def setUp(self):
      os.environ["MASTER_ADDR"] = "localhost"
      os.environ["MASTER_PORT"] = "29501"
      torch.distributed.init_process_group(
          backend=torch.distributed.Backend.NCCL, rank=0, world_size=1
      )
      self.config_oss = OmegaConf.create(
          {
              "optimizer": {
                  "type": "adam_w",
                  "enable_state_sharding": True,
                  "params": {"lr": 5e-5},
              },
              "training": {
                  "batch_size": 1,
                  "find_unused_parameters": False,
              },
          }
      )
      self.config_no_oss = OmegaConf.create(
          {
              "optimizer": {
                  "type": "adam_w",
                  "enable_state_sharding": False,
                  "params": {"lr": 5e-5},
              },
              "training": {
                  "batch_size": 1,
                  "find_unused_parameters": False,
              },
          }
      )
      self.trainer = None
  
file_path: mmf/tests/trainers/test_sharded_ddp.py
imports: import os
  import unittest
  import torch
  from mmf.common.registry import registry
  from mmf.trainers.mmf_trainer import MMFTrainer
  from mmf.utils.build import build_optimizer
  from omegaconf import OmegaConf
  from tests.test_utils import SimpleModel, skip_if_no_cuda
  from tests.trainers.test_training_loop import TrainerTrainingLoopMock
  from tests.trainers.test_utils import get_config_with_defaults
label_desc: Use image node_id 1 for calling the TestShardedDDP obj's underlying member method code with example usage: obj.setUp() without return types