def METHOD_NAME(self) -> int:
    """Returns the rank of the current process wrt. the total number of shards.
    Note:
        This may not be accurate in a non-dataloader-worker process like the main training process as it
        doesn't necessarily know about the number of dataloader workers.
    """
    assert self.worker_env is not None
    assert self.dist_env is not None
    return self.dist_env.global_rank * self.worker_env.world_size + self.worker_env.rank