class_docstr: Finetune RETRO Model 
code: def build_pretraining_data_loader(self, dataset, consumed_samples):
      if isinstance(dataset, BlendableDataset):
          collate_fun = dataset.datasets[0].collate_fn
      else:
          collate_fun = dataset.collate_fn
  
      collate_fn = partial(collate_fun, tp_workers=0)
      global_batch_size = (
          self.trainer.world_size
          * self.cfg.micro_batch_size
          // self.cfg.tensor_model_parallel_size
      )
      batch_sampler = MegatronPretrainingBatchSampler(
          total_samples=len(dataset),
          consumed_samples=consumed_samples,
          micro_batch_size=self.cfg.micro_batch_size,
          global_batch_size=global_batch_size,
          data_parallel_rank=parallel_state.get_data_parallel_rank(),
          data_parallel_size=parallel_state.get_data_parallel_world_size(),
          drop_last=True,
      )
      return torch.utils.data.DataLoader(
          dataset,
          batch_sampler=batch_sampler,
          collate_fn=collate_fn,
          num_workers=0,
          pin_memory=True,
      )
  
imports: import json
  from functools import partial
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.common.data import ConcatMapDataset
  from nemo.collections.common.metrics import MetricStringToTorchMetric
  from nemo.collections.common.metrics.classification_accuracy import ExactStringPerCategoryMatchMetric
  from nemo.collections.nlp.data.common.sequence_to_sequence_dataset import SequenceToSequenceDataset
  from nemo.collections.nlp.data.language_modeling.megatron.base_dataset_utils import get_datasets_weights_and_num_samples, get_train_valid_test_split_
  from nemo.collections.nlp.data.language_modeling.megatron.blendable_dataset import BlendableDataset
  from nemo.collections.nlp.data.language_modeling.megatron.megatron_batch_samplers import MegatronPretrainingBatchSampler
  from nemo.collections.nlp.data.language_modeling.megatron.retro_fine_tune_dataset import RetroQAFineTuneDataset
  from nemo.collections.nlp.models.language_modeling.megatron_retrieval_model import MegatronRetrievalModel
  from nemo.collections.nlp.models.language_modeling.megatron_t5_model import MegatronT5Model, T5Sentinel
  from nemo.collections.nlp.parts.nlp_overrides import GlobalBatchDataFetcher
  from nemo.utils import AppState, logging
label_desc: Use image node_id 2 for calling the MegatronRetroFinetuneModel obj's underlying member method code with example usage: obj.build_pretraining_data_loader(dataset, consumed_samples) and returns: torch