code: def build_mock_train_valid_test_datasets(
      cfg,
      trainer,
      splits_string,
      tokenizer,
      mock_data_size,
  ):
      """Build train, valid, and test datasets."""
  
      splits = get_train_valid_test_split_(
          splits_string, mock_data_size
      )
  
      # Print stats about the splits.
      logging.info(" > dataset split:")
  
      def print_split_stats(name, index):
          logging.info("    {}:".format(name))
          logging.info(
              "     document indices in [{}, {}) total of {} "
              "documents".format(
                  splits[index],
                  splits[index + 1],
                  splits[index + 1] - splits[index],
              )
          )
  
      print_split_stats("train", 0)
      print_split_stats("validation", 1)
      print_split_stats("test", 2)
  
      def build_dataset(index, name):
          dataset = None
          if splits[index + 1] > splits[index]:
              dataset = MockRETRODataset(
                  cfg,
                  trainer,
                  tokenizer,
                  name,
                  splits[index + 1] - splits[index],
              )
          return dataset
  
      train_dataset = build_dataset(0, "train")
      valid_dataset = build_dataset(1, "valid")
      test_dataset = build_dataset(2, "test")
  
      return (train_dataset, valid_dataset, test_dataset)
  
imports: import os
  from typing import List
  import numpy
  import torch
  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.gpt_dataset import _build_index_mappings, get_indexed_dataset_
  from nemo.collections.nlp.data.language_modeling.megatron.indexed_retrieval_dataset import KNNIndex, MMapRetrievalIndexedDataset
  from nemo.core import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: build_mock_train_valid_test_datasets(cfg, trainer, splits_string, tokenizer, mock_data_size) and returns: train_dataset,  valid_dataset,  test_dataset, dataset