code: def create_test_loader(opts: argparse.Namespace) -> CVNetsDataLoader:
      """Helper function to create and return a dataset loader for test dataset from command-line arguments"""
      test_dataset = get_test_dataset(opts)
  
      n_test_samples = get_num_data_samples_as_int_or_mapping(
          test_dataset
      )
      is_master_node = is_master(opts)
  
      # overwrite the validation argument
      setattr(
          opts,
          "dataset.val_batch_size0",
          getattr(opts, "dataset.eval_batch_size0"),
      )
  
      # we don't need variable batch sampler for evaluation
      sampler_name = getattr(opts, "sampler.name", "batch_sampler")
      crop_size_h, crop_size_w = image_size_from_opts(opts)
      if (
          sampler_name.find("video") > -1
          and sampler_name != "video_batch_sampler"
      ):
          clips_per_video = getattr(
              opts, "sampler.vbs.clips_per_video", 1
          )
          frames_per_clip = getattr(
              opts, "sampler.vbs.num_frames_per_clip", 8
          )
          setattr(opts, "sampler.name", "video_batch_sampler")
          setattr(opts, "sampler.bs.crop_size_width", crop_size_w)
          setattr(opts, "sampler.bs.crop_size_height", crop_size_h)
          setattr(opts, "sampler.bs.clips_per_video", clips_per_video)
          setattr(
              opts, "sampler.bs.num_frames_per_clip", frames_per_clip
          )
      elif sampler_name.find("var") > -1:
          setattr(opts, "sampler.name", "batch_sampler")
          setattr(opts, "sampler.bs.crop_size_width", crop_size_w)
          setattr(opts, "sampler.bs.crop_size_height", crop_size_h)
  
      test_sampler = build_sampler(
          opts=opts,
          n_data_samples=n_test_samples,
          is_training=False,
          get_item_metadata=test_dataset.get_item_metadata,
      )
  
      collate_fn_test = build_test_collate_fn(opts=opts)
  
      data_workers = getattr(opts, "dataset.workers", 1)
      persistent_workers = False
      pin_memory = False
  
      test_loader = CVNetsDataLoader(
          dataset=test_dataset,
          batch_size=1,
          batch_sampler=test_sampler,
          num_workers=data_workers,
          pin_memory=pin_memory,
          persistent_workers=persistent_workers,
          collate_fn=partial(collate_fn_test, opts=opts)
          if collate_fn_test is not None
          else None,
      )
  
      if is_master_node:
          logger.log("Evaluation sampler details: ")
          print("{}".format(test_sampler))
  
      return test_loader
  
file_path: ml-cvnets/data/data_loaders.py
imports: import argparse
  from functools import partial
  from typing import Mapping, Optional, Tuple, Union
  from torch.utils.data.sampler import Sampler
  from data.collate_fns import build_collate_fn, build_test_collate_fn
  from data.datasets import BaseDataset, get_test_dataset, get_train_val_datasets
  from data.loader.dataloader import CVNetsDataLoader
  from data.sampler import build_sampler
  from utils import logger
  from utils.ddp_utils import is_master
  from utils.tensor_utils import image_size_from_opts
label_desc: Use image node_id 1 for calling a global function with example usage: create_test_loader(opts) and returns: test_loader