code: def build_dataloader(
      dataset: GenericSSLDataset,
      dataset_config: dict,
      num_dataloader_workers: int,
      pin_memory: bool,
      multi_processing_method: str,
      device: torch.device,
      sampler_seed=0,
      get_sampler=get_sampler,
      worker_init_fn=set_dataloader_seeds,
      **kwargs,
  ):
      """
      Get the dataloader for the given satasets and data split
  
      Args:
          dataset (GenericSSLDataset):    the dataset object for which dataloader is constructed
          dataset_config (dict):          configuration of the dataset.
                                          should be DATA.TRAIN or DATA.TEST settings
          num_dataloader_workers (int):   number of workers per gpu (or cpu) training
          pin_memory (bool):              whether to pin memory or not
          multi_processing_method (str):  method to use. options: forkserver | fork | spawn
          sampler_seed (int):             seed for the sampler. Should be identical per process
          device (torch.device):          training on cuda or cpu
          get_sampler (get_sampler):      function that is used to get the sampler
          worker_init_fn (None):          any function that should be executed during
                                          initialization of dataloader workers
  
      Returns:
          Instance of Pytorch DataLoader. The dataloader is wrapped with
          DataloaderAsyncGPUWrapper or DataloaderSyncGPUWrapper depending
          on whether user wants to copy data to gpu async or not.
      """
  
      # pytorch dataloader requires setting the multiprocessing type.
      setup_multiprocessing_method(multi_processing_method)
  
      # we don't need to set the rank, replicas as the Sampler already does so in
      # it's init function
      data_sampler = get_sampler(dataset, dataset_config, sampler_seed)
      collate_function = get_collator(
          dataset_config["COLLATE_FUNCTION"],
          dataset_config["COLLATE_FUNCTION_PARAMS"],
      )
  
      # Replace the worker_init_fn with a deterministic one when debugging
      if dataset_config["USE_DEBUGGING_SAMPLER"]:
          worker_init_fn = debugging_worker_init_fn
  
      # Load the labels of the dataset before creating the data loader
      # or else the load of files will happen on each data loader separately
      # decreasing performance / hitting quota on data source
      dataset.load_labels()
  
      # Create the pytorch dataloader
      if is_batch_sampler(dataset_config):
          sampler_config = {
              "batch_sampler": data_sampler,
          }
      else:
          sampler_config = {
              "sampler": data_sampler,
              "batch_size": dataset_config["BATCHSIZE_PER_REPLICA"],
              "drop_last": dataset_config["DROP_LAST"],
          }
  
      dataloader = DataLoader(
          dataset=dataset,
          num_workers=num_dataloader_workers,
          pin_memory=pin_memory,
          shuffle=False,
          collate_fn=collate_function,
          worker_init_fn=worker_init_fn,
          **sampler_config,
      )
      enable_async_gpu_copy = dataset.cfg["DATA"][
          "ENABLE_ASYNC_GPU_COPY"
      ]
      dataloader = wrap_dataloader(
          dataloader, enable_async_gpu_copy, device
      )
  
      return dataloader
  
imports: import logging
  import random
  import numpy
  import torch
  import torch.distributed
  from classy_vision.dataset import DataloaderAsyncGPUWrapper
  from torch.utils.data import DataLoader
  from vissl.data.airstore_dataset import AirstoreDataset
  from vissl.data.collators import get_collator
  from vissl.data.data_helper import ClassPowerlawSampler, DeterministicDistributedSampler, StatefulDistributedSampler, StratifiedClassSampler
  from vissl.data.dataloader_sync_gpu_wrapper import DataloaderSyncGPUWrapper
  from vissl.data.dataset_catalog import get_data_files, register_datasets, VisslDatasetCatalog
  from vissl.data.disk_dataset import DiskImageDataset
  from vissl.data.ssl_dataset import GenericSSLDataset
  from vissl.data.synthetic_dataset import SyntheticImageDataset
  from vissl.data.torchvision_dataset import TorchvisionDataset
  from vissl.utils.misc import set_dataloader_seeds, setup_multiprocessing_method
label_desc: Use image node_id 7 for calling a global function with example usage: build_dataloader(dataset, dataset_config, num_dataloader_workers, pin_memory, multi_processing_method, device, sampler_seed, get_sampler, worker_init_fn) and returns: dataloader