class_docstr: Randomly samples from a dataset  while ensuring that each batch (of size p * k)
  includes samples from exactly p labels, with k samples for each label.
  
  Args:
      groups (list[int]): List where the ith entry is the group_id/label of the ith sample in the dataset.
      p (int): Number of labels/groups to be sampled from in a batch
      k (int): Number of samples for each label/group in a batch
code: def __init__(self, groups, p, k):
      self.p = p
      self.k = k
      self.groups = create_groups(groups, self.k)
  
      # Ensures there are enough classes to sample from
      if len(self.groups) < p:
          raise ValueError(
              "There are not enough classes to sample from"
          )
  
file_path: vision/references/similarity/sampler.py
imports: import random
  from collections import defaultdict
  import torch
  from torch.utils.data.sampler import Sampler
label_desc: Use image node_id 1 to create a new PKSampler object from inherited base classes: Sampler with example: obj = PKSampler(groups, p, k)