code: def train_valid_test_datasets_provider(train_val_test_num_samples):
      """Build train, valid, and test datasets."""
  
      args = get_args()
      retro_args = get_retro_args()
  
      print_rank_0(
          "> building train, validation, and test datasets "
          "for GPT ..."
      )
  
      train_ds, valid_ds, test_ds = BlendedMegatronDatasetBuilder(
          MultiSplitGPTDataset,
          train_val_test_num_samples,
          core_retro_dataset_config_from_args(args, retro_args),
      ).build()
      print_rank_0("> finished creating pretrained GPT datasets ...")
  
      return train_ds, valid_ds, test_ds
  
file_path: megatron-lm/tools/retro/query/chunk_dataset.py
imports: import os
  import torch
  from megatron import get_args, get_retro_args, print_rank_0
  from megatron.core.datasets.blended_megatron_dataset_builder import BlendedMegatronDatasetBuilder
  from megatron.training import build_train_valid_test_datasets, update_train_iters
  from pretrain_gpt import is_dataset_built_on_rank
  from tools.retro.db.utils import get_indexed_dataset_infos
  from tools.retro.utils import get_num_chunks_per_sample
  from .multi_split_gpt_dataset import MultiSplitGPTDataset, MultiSplitGPTDatasetConfig
  from .utils import get_neighbor_dirname, get_query_workdir
label_desc: Use image node_id 2 for calling a global function with example usage: train_valid_test_datasets_provider(train_val_test_num_samples) and returns: train_ds,  valid_ds,  test_ds