def set_distributed_options(self, broadcast_buffers_mode: BroadcastBuffersMode=BroadcastBuffersMode.BEFORE_EVAL, batch_norm_sync_mode: BatchNormSyncMode=BatchNormSyncMode.DISABLED, batch_norm_sync_group_size: int=0, find_unused_parameters: bool=False, bucket_cap_mb: int=25, fp16_grad_compress: bool=False):
    'Set distributed options.\n\n        Args:\n            broadcast_buffers_mode: Broadcast buffers mode. See\n                :class:`BroadcastBuffersMode` for options.\n            batch_norm_sync_mode: Batch normalization synchronization mode. See\n                :class:`BatchNormSyncMode` for options.\n            batch_norm_sync_group_size: Group size to use for synchronized batch norm.\n                0 means that the stats are synchronized across all replicas. For\n                efficient synchronization, set it to the number of GPUs in a node (\n                usually 8).\n            find_unused_parameters: See\n                :class:`torch.nn.parallel.DistributedDataParallel` for information.\n            bucket_cap_mb: See\n                :class:`torch.nn.parallel.DistributedDataParallel` for information.\n        Raises:\n            RuntimeError: If batch_norm_sync_mode is `BatchNormSyncMode.APEX` and apex\n                is not installed.\n        '
    self.broadcast_buffers_mode = broadcast_buffers_mode
    if (batch_norm_sync_group_size > 0):
        if (not (batch_norm_sync_mode == BatchNormSyncMode.APEX)):
            raise ValueError('batch_norm_sync_group_size can be > 0 only when Apex Synchronized Batch Normalization is being used.')
    self.batch_norm_sync_group_size = batch_norm_sync_group_size
    if (batch_norm_sync_mode == BatchNormSyncMode.DISABLED):
        logging.info('Synchronized Batch Normalization is disabled')
    else:
        if ((batch_norm_sync_mode == BatchNormSyncMode.APEX) and (not apex_available)):
            raise RuntimeError('apex is not installed')
        msg = f'Using Synchronized Batch Normalization using {batch_norm_sync_mode}'
        if (self.batch_norm_sync_group_size > 0):
            msg += f' and group size {batch_norm_sync_group_size}'
        logging.info(msg)
    self.batch_norm_sync_mode = batch_norm_sync_mode
    if find_unused_parameters:
        logging.info('Enabling find_unused_parameters in DDP')
    self.find_unused_parameters = find_unused_parameters
    self.ddp_bucket_cap_mb = bucket_cap_mb
    if fp16_grad_compress:
        if (get_torch_version() < [1, 8, 0]):
            raise RuntimeError('FP16 grad compression is only supported since PyTorch 1.8')
        logging.info('Enabling FP16 grad compression')
    self.fp16_grad_compress = fp16_grad_compress
    return self
Set distributed options.

Args:
    broadcast_buffers_mode: Broadcast buffers mode. See
        :class:`BroadcastBuffersMode` for options.
    batch_norm_sync_mode: Batch normalization synchronization mode. See
        :class:`BatchNormSyncMode` for options.
    batch_norm_sync_group_size: Group size to use for synchronized batch norm.
        0 means that the stats are synchronized across all replicas. For
        efficient synchronization, set it to the number of GPUs in a node (
        usually 8).
    find_unused_parameters: See
        :class:`torch.nn.parallel.DistributedDataParallel` for information.
    bucket_cap_mb: See
        :class:`torch.nn.parallel.DistributedDataParallel` for information.
Raises:
    RuntimeError: If batch_norm_sync_mode is `BatchNormSyncMode.APEX` and apex
        is not installed.
def set_distributed_options(self, broadcast_buffers_mode: BroadcastBuffersMode=BroadcastBuffersMode.BEFORE_EVAL, batch_norm_sync_mode: BatchNormSyncMode=BatchNormSyncMode.DISABLED, batch_norm_sync_group_size: int=0, find_unused_parameters: bool=False, bucket_cap_mb: int=25, fp16_grad_compress: bool=False):
    'Set distributed options.\n\n        Args:\n            broadcast_buffers_mode: Broadcast buffers mode. See\n                :class:`BroadcastBuffersMode` for options.\n            batch_norm_sync_mode: Batch normalization synchronization mode. See\n                :class:`BatchNormSyncMode` for options.\n            batch_norm_sync_group_size: Group size to use for synchronized batch norm.\n                0 means that the stats are synchronized across all replicas. For\n                efficient synchronization, set it to the number of GPUs in a node (\n                usually 8).\n            find_unused_parameters: See\n                :class:`torch.nn.parallel.DistributedDataParallel` for information.\n            bucket_cap_mb: See\n                :class:`torch.nn.parallel.DistributedDataParallel` for information.\n        Raises:\n            RuntimeError: If batch_norm_sync_mode is `BatchNormSyncMode.APEX` and apex\n                is not installed.\n        '
    self.broadcast_buffers_mode = broadcast_buffers_mode
    if (batch_norm_sync_group_size > 0):
        if (not (batch_norm_sync_mode == BatchNormSyncMode.APEX)):
            raise ValueError('batch_norm_sync_group_size can be > 0 only when Apex Synchronized Batch Normalization is being used.')
    self.batch_norm_sync_group_size = batch_norm_sync_group_size
    if (batch_norm_sync_mode == BatchNormSyncMode.DISABLED):
        logging.info('Synchronized Batch Normalization is disabled')
    else:
        if ((batch_norm_sync_mode == BatchNormSyncMode.APEX) and (not apex_available)):
            raise RuntimeError('apex is not installed')
        msg = f'Using Synchronized Batch Normalization using {batch_norm_sync_mode}'
        if (self.batch_norm_sync_group_size > 0):
            msg += f' and group size {batch_norm_sync_group_size}'
        logging.info(msg)
    self.batch_norm_sync_mode = batch_norm_sync_mode
    if find_unused_parameters:
        logging.info('Enabling find_unused_parameters in DDP')
    self.find_unused_parameters = find_unused_parameters
    self.ddp_bucket_cap_mb = bucket_cap_mb
    if fp16_grad_compress:
        if (get_torch_version() < [1, 8, 0]):
            raise RuntimeError('FP16 grad compression is only supported since PyTorch 1.8')
        logging.info('Enabling FP16 grad compression')
    self.fp16_grad_compress = fp16_grad_compress
    return self