class_docstr: Strategy for distributed training using torch.distributed.
class_docstr_tok: ["Strategy","for","distributed","training","using","torch.distributed","."]
code: def setup_sampler(self, dataset) -> DistributedSampler:
      # FIXME(cwher): this is only invoked in train_on_ray, not tested after adapt Boost API.
      return DistributedSampler(
          dataset, dist.get_world_size(), dist.get_rank()
      )
  
imports: import os
  import random
  from collections import OrderedDict
  from typing import Callable, Optional
  import numpy
  import torch
  import torch.distributed
  import torch.nn
  from coati.experience_buffer import ExperienceBuffer
  from coati.models import Actor, Critic, RewardModel
  from torch.utils.data import DataLoader
  from transformers.modeling_utils import PreTrainedModel
  from transformers.tokenization_utils_base import PreTrainedTokenizerBase
  from colossalai.booster.plugin import TorchDDPPlugin
  from colossalai.booster.plugin.torch_ddp_plugin import TorchDDPModel
  from .base import Strategy
  from .sampler import DistributedSampler
label_desc: Use image node_id 7 for calling the DDPStrategy obj's underlying member method code with example usage: obj.setup_sampler(dataset) and returns: DistributedSampler