def METHOD_NAME(self):
    assert dist.is_available()
    if dist.is_initialized():
        self.rank = dist.get_rank()
        self.world_size = dist.get_world_size()
    else:
        self.rank = 0
        self.world_size = 1
    worker_info = torch.utils.data.get_worker_info()
    if worker_info is None:
        self.worker_id = 0
        self.num_workers = 1
    else:
        self.worker_id = worker_info.id
        self.num_workers = worker_info.num_workers
    return dict(
        rank=self.rank,
        world_size=self.world_size,
        worker_id=self.worker_id,
        num_workers=self.num_workers)