code: def dataloader_with_bucketedbatchsampler(
      dataset, length, batch_size, shuffle, drop_last
  ):
      """
      建立一个 batch_sampler 为 BucketedBatchSampler 的 dataloader
      """
      dataloader = DataLoader(
          dataset=dataset,
          batch_sampler=BucketedBatchSampler(
              dataset,
              length,
              batch_size,
              shuffle=shuffle,
              drop_last=drop_last,
          ),
      )
  
      return dataloader
  
imports: import os
  import pytest
  from pathlib import Path
  from fastNLP.core.drivers.torch_driver.ddp import TorchDDPDriver
  from fastNLP import prepare_torch_dataloader
  from fastNLP.core.samplers import RandomSampler, UnrepeatedSampler, BucketedBatchSampler, UnrepeatedRandomSampler, UnrepeatedSequentialSampler
  from tests.helpers.models.torch_model import TorchNormalModel_Classification_1
  from tests.helpers.datasets.torch_data import TorchNormalDataset, TorchNormalXYDataset
  from tests.helpers.utils import magic_argv_env_context, recover_logger, Capturing
  from fastNLP.envs.distributed import rank_zero_rm
  from fastNLP import logger
  from fastNLP.core.drivers.torch_driver.dist_utils import fastnlp_torch_all_gather
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
label_desc: Use image node_id 2 for calling a global function with example usage: dataloader_with_bucketedbatchsampler(dataset, length, batch_size, shuffle, drop_last) and returns: dataloader