code: def to_distributed(
      self: Learner,
      sync_bn=True,  # Whether to replace all batch norm with `nn.SyncBatchNorm`
      **kwargs,
  ):
      "Add `AcceleratedTrainer` to a learner, and configures an Accelerator"
      self.add_cb(DistributedTrainer(sync_bn, **kwargs))
      if rank_distrib():
          self.remove_cb(ProgressCallback)
      return self
  
imports: from __future__ import annotations
  from .basics import *
  from .callback.progress import ProgressCallback
  from torch.nn.parallel import DistributedDataParallel, DataParallel
  from .data.load import _FakeLoader, _loaders
  from .optimizer import OptimWrapper
label_desc: Use image node_id 9 for calling a global function with example usage: to_distributed(sync_bn) and returns: self