code: def dataloader_with_randombatchsampler(
      dataset, batch_size, shuffle, drop_last
  ):
      """
      建立一个 batch_sampler 为 ReproduceBatchSampler 的 dataloader
      """
      if shuffle:
          sampler = oneflow.utils.data.RandomSampler(dataset)
      else:
          sampler = oneflow.utils.data.SequentialSampler(dataset)
      dataloader = DataLoader(
          dataset=dataset,
          batch_sampler=ReproduceBatchSampler(
              BatchSampler(
                  sampler, batch_size=batch_size, drop_last=drop_last
              ),
              batch_size=batch_size,
              drop_last=drop_last,
          ),
      )
  
      return dataloader
  
imports: import pytest
  from pathlib import Path
  from fastNLP.core.drivers.oneflow_driver.single_device import OneflowSingleDriver
  from fastNLP.core.samplers import ReproduceBatchSampler, RandomSampler
  from tests.helpers.models.oneflow_model import OneflowNormalModel_Classification_1
  from tests.helpers.datasets.oneflow_data import OneflowNormalDataset, OneflowNormalXYDataset
  from tests.helpers.datasets.torch_data import TorchNormalDataset
  from tests.helpers.models.torch_model import TorchNormalModel_Classification_1
  from fastNLP.envs.distributed import rank_zero_rm
  from fastNLP.envs.imports import _NEED_IMPORT_ONEFLOW, _NEED_IMPORT_TORCH
  from fastNLP import prepare_oneflow_dataloader, BucketedBatchSampler
label_desc: Use image node_id 1 for calling a global function with example usage: dataloader_with_randombatchsampler(dataset, batch_size, shuffle, drop_last) and returns: dataloader