code: def give_dataloaders(
      dataset, trainset, testset, opt, cluster_path=""
  ):
      """
      Args:
          dataset: string, name of dataset for which the dataloaders should be returned.
          opt:     argparse.Namespace, contains all training-specific parameters.
      Returns:
          dataloaders: dict of dataloaders for training, testing and evaluation on training.
      """
      # Dataset selection
      if opt.dataset == "Inaturalist":
          if opt.finetune:
              datasets = give_inat_datasets_finetune_1head(
                  testset, cluster_path, opt
              )
          else:
              if opt.get_features:
                  datasets = give_inaturalist_datasets_for_features(opt)
              else:
                  datasets = give_inaturalist_datasets(opt)
      else:
          raise Exception("No Dataset >{}< available!".format(dataset))
  
      # Move datasets to dataloaders.
      dataloaders = {}
  
      for key, dataset in datasets.items():
          if (
              isinstance(dataset, TrainDatasetsmoothap)
              or isinstance(dataset, TrainDatasetsmoothap1Head)
          ) and key in ["training", "clustering"]:
              dataloaders[key] = torch.utils.data.DataLoader(
                  dataset,
                  batch_size=opt.bs,
                  num_workers=opt.kernels,
                  sampler=torch.utils.data.SequentialSampler(dataset),
                  pin_memory=True,
                  drop_last=True,
              )
          else:
              is_val = dataset.is_validation
              if key == "training" or key == "clustering":
                  dataloaders[key] = torch.utils.data.DataLoader(
                      dataset,
                      batch_size=opt.bs,
                      num_workers=opt.kernels,
                      shuffle=not is_val,
                      pin_memory=True,
                      drop_last=not is_val,
                  )
              else:
                  dataloaders[key] = torch.utils.data.DataLoader(
                      dataset,
                      batch_size=opt.bs,
                      num_workers=6,
                      shuffle=not is_val,
                      pin_memory=True,
                      drop_last=not is_val,
                  )
      return dataloaders
  
imports: import pickle
  import warnings
  from numpy.core.arrayprint import IntegerFormat
  import copy
  import os
  import random
  import numpy
  import pandas
  import torch
  from PIL import Image
  from torch.utils.data import Dataset
  from torchvision import transforms
label_desc: Use image node_id 1 for calling a global function with example usage: give_dataloaders(dataset, trainset, testset, opt, cluster_path) and returns: dataloaders