code: def create_syncbn_process_group(group_size: int) -> List[int]:
      """
      Creates process groups to be used for syncbn of a give ``group_size`` and returns
      process group that current GPU participates in.
  
      Args:
          group_size (int): number of GPU's to collaborate for sync bn. group_size should
              be >=2 else, no action is taken.
      """
      assert (
          group_size > 1
      ), f"Invalid group size {group_size} to convert to sync batchnorm."
  
      world_size = torch.distributed.get_world_size()
      assert world_size >= group_size
      assert world_size % group_size == 0
  
      group = None
      for group_num in range(world_size // group_size):
          group_ids = range(
              group_num * group_size, (group_num + 1) * group_size
          )
          cur_group = torch.distributed.new_group(ranks=group_ids)
          if torch.distributed.get_rank() // group_size == group_num:
              group = cur_group
              # can not drop out and return here,
              # every process must go through creation of all subgroups
  
      assert group is not None
      return group
  
imports: from dataclasses import dataclass
  from typing import Any, Dict, Iterable, List, Literal, Mapping, Optional, Tuple, TypedDict, Union
  import pytorch_lightning
  import torch
  from hydra.core.config_store import ConfigStore
  from hydra.utils import instantiate
  from iopath.common.file_io import g_pathmgr
  from omegaconf import MISSING, OmegaConf
  from pytorch_lightning.utilities import rank_zero_info
  from pytorchvideo_trainer.datamodule.transforms import MixVideoBatchWrapper
  from pytorchvideo_trainer.module.lr_policy import get_epoch_lr, LRSchedulerConf, set_lr
  from pytorchvideo_trainer.module.optimizer import construct_optimizer
  from torch import nn
  from torch.optim.lr_scheduler import _LRScheduler
  from torchrecipes.core.conf import ModuleConf
  from torchrecipes.utils.config_utils import get_class_name_str
label_desc: Use image node_id 1 for calling a global function with example usage: create_syncbn_process_group(group_size) and returns: group