code: def build_imagenet_validation_dataloader(model_cfg, tokenizer=None):
      val_image_transform, text_transform = get_preprocess_fns(
          model_cfg, tokenizer, is_train=False
      )
      data_cfg = model_cfg.data
  
      imagenet_val = {}
  
      imagenet_path = data_cfg.get("imagenet_val")
      if imagenet_path is None:
          return None
  
      image_dataset = ImageFolder(
          root=imagenet_path,
          transform=val_image_transform,
      )
  
      image_batch_sampler = MegatronPretrainingSampler(
          total_samples=len(image_dataset),
          consumed_samples=0,
          micro_batch_size=model_cfg.micro_batch_size,
          global_batch_size=model_cfg.global_batch_size,
          data_parallel_rank=parallel_state.get_data_parallel_rank(),
          data_parallel_size=parallel_state.get_data_parallel_world_size(),
          drop_last=False,
      )
  
      def custom_collate(batch):
          if len(batch) == 0:
              return None, None
          else:
              return default_collate(batch)
  
      imagenet_val["images"] = torch.utils.data.DataLoader(
          image_dataset,
          batch_sampler=image_batch_sampler,
          num_workers=min(data_cfg.num_workers, 2),
          collate_fn=custom_collate,
          pin_memory=True,
          persistent_workers=True,
      )
  
      text_dataset = ImagenetClassnameDataset(
          imagenet_classnames, openai_imagenet_template, text_transform
      )
      imagenet_val["texts"] = torch.utils.data.DataLoader(
          text_dataset,
          batch_size=text_dataset.num_templates,
          num_workers=0,
          pin_memory=True,
          persistent_workers=False,
          drop_last=False,
      )
      return imagenet_val
  
file_path: NeMo/nemo/collections/multimodal/data/clip/clip_dataset.py
imports: from functools import partial
  from typing import Any, List, Union
  import torch
  from torch.utils.data import Dataset, default_collate
  from nemo.collections.multimodal.data.clip.augmentations.augmentations import image_transform
  from nemo.collections.multimodal.data.clip.imagenet_zeroshot_data import imagenet_classnames, openai_imagenet_template
  from nemo.collections.multimodal.data.common.webdataset import WebDatasetCommon
  from nemo.collections.nlp.data.language_modeling.megatron.data_samplers import MegatronPretrainingSampler
  from nemo.collections.vision.data.megatron.image_folder import ImageFolder
label_desc: Use image node_id 4 for calling a global function with example usage: build_imagenet_validation_dataloader(model_cfg, tokenizer) and returns: imagenet_val, None, None,  None, default_collate