class_docstr: A `DataLoader` intended for multi-task learning.  The basic idea is that you use a
  `MultiTaskDatasetReader`, which takes a dictionary of `DatasetReaders`, keyed by some name.  You
  use those same names for various parameters here, including the data paths that get passed to
  each reader.  We will load each dataset and iterate over instances in them using a
  `MultiTaskEpochSampler` and a `MultiTaskScheduler`.  The `EpochSampler` says how much to use
  from each dataset at each epoch, and the `Scheduler` orders the instances in the epoch however
  you want.  Both of these are designed to be used in conjunction with trainer `Callbacks`, if
  desired, to have the sampling and/or scheduling behavior be dependent on the current state of
  training.
  
  While it is not necessarily required, this `DatasetReader` was designed to be used alongside a
  `MultiTaskModel`, which can handle instances coming from different datasets.  If your datasets
  are similar enough (say, they are all reading comprehension datasets with the same format), or
  your model is flexible enough, then you could feasibly use this `DataLoader` with a normal,
  non-multitask `Model`.
  
  Registered as a `DataLoader` with name "multitask".
  
  # Parameters
  
  reader: `MultiTaskDatasetReader`
  data_path: `Dict[str, str]`
      One file per underlying dataset reader in the `MultiTaskDatasetReader`, which will be passed
      to those readers to construct one `DataLoader` per dataset.
  scheduler: `MultiTaskScheduler`, optional (default = `HomogeneousRoundRobinScheduler`)
      The `scheduler` determines how instances are ordered within an epoch.  By default, we'll
      select one batch of instances from each dataset in turn, trying to ensure as uniform a mix
      of datasets as possible.  Note that if your model can handle it, using a
      `RoundRobinScheduler` is likely better than a `HomogeneousRoundRobinScheduler` (because it
      does a better job mixing gradient signals from various datasets), so you may want to
      consider switching.  We use the homogeneous version as default because it should work for
      any allennlp model, while the non-homogeneous one might not.
  sampler: `MultiTaskEpochSampler`, optional (default = `None`)
      Only used if `instances_per_epoch` is not `None`. If we need to select a subset of the data
      for an epoch, this `sampler` will tell us with what proportion we should sample from each
      dataset.  For instance, we might want to focus more on datasets that are underperforming in
      some way, by having those datasets contribute more instances this epoch than other datasets.
  instances_per_epoch: `int`, optional (default = `None`)
      If not `None`, we will use this many instances per epoch of training, drawing from the
      underlying datasets according to the `sampler`.
  num_workers: `Dict[str, int]`, optional (default = `None`)
      Used when creating one `MultiProcessDataLoader` per dataset.  If you want non-default
      behavior for this parameter in the `DataLoader` for a particular dataset, pass the
      corresponding value here, keyed by the dataset name.
  max_instances_in_memory: `Dict[str, int]`, optional (default = `None`)
      Used when creating one `MultiProcessDataLoader` per dataset.  If you want non-default
      behavior for this parameter in the `DataLoader` for a particular dataset, pass the
      corresponding value here, keyed by the dataset name.
  start_method: `Dict[str, str]`, optional (default = `None`)
      Used when creating one `MultiProcessDataLoader` per dataset.  If you want non-default
      behavior for this parameter in the `DataLoader` for a particular dataset, pass the
      corresponding value here, keyed by the dataset name.
  instance_queue_size: `Dict[str, int]`, optional (default = `None`)
      Used when creating one `MultiProcessDataLoader` per dataset.  If you want non-default
      behavior for this parameter in the `DataLoader` for a particular dataset, pass the
      corresponding value here, keyed by the dataset name.
  instance_chunk_size: `Dict[str, int]`, optional (default = `None`)
      Used when creating one `MultiProcessDataLoader` per dataset.  If you want non-default
      behavior for this parameter in the `DataLoader` for a particular dataset, pass the
      corresponding value here, keyed by the dataset name.
  shuffle: `bool`, optional (default = `True`)
      If `False`, we will not shuffle the instances that come from each underlying data loader.
      You almost certainly never want to use this except when debugging.
  cuda_device: `Optional[Union[int, str, torch.device]]`, optional (default = `None`)
      If given, batches will automatically be put on this device.
  
      !!! Note
          This should typically not be set in an AllenNLP configuration file. The `Trainer`
          will automatically call [`set_target_device()`](#set_target_device) before iterating
          over batches.
code: def _get_instances_for_epoch(self) -> Dict[str, Iterable[Instance]]:
      if self._instances_per_epoch is None:
          return {
              key: maybe_shuffle_instances(loader, self._shuffle)
              for key, loader in self._loaders.items()
          }
      if self.sampler is None:
          # We already checked for this in the constructor, so this should never happen unless you
          # modified the object after creation. But mypy is complaining, so here's another check.
          raise ValueError(
              "You must specify an EpochSampler if self._instances_per_epoch is not None."
          )
      dataset_proportions = self.sampler.get_task_proportions(
          self._loaders
      )
      proportion_sum = sum(dataset_proportions.values())
      num_instances_per_dataset = {
          key: math.floor(
              proportion * self._instances_per_epoch / proportion_sum
          )
          for key, proportion in dataset_proportions.items()
      }
      return {
          key: itertools.islice(self._iterators[key], num_instances)
          for key, num_instances in num_instances_per_dataset.items()
      }
  
imports: from typing import Any, Dict, Iterable, Iterator, Union, Optional
  import itertools
  import math
  import torch
  from allennlp.common import util
  from allennlp.data.batch import Batch
  from allennlp.data.data_loaders.data_loader import DataLoader, TensorDict
  from allennlp.data.data_loaders.multiprocess_data_loader import MultiProcessDataLoader
  from allennlp.data.data_loaders.multitask_scheduler import MultiTaskScheduler
  from allennlp.data.data_loaders.multitask_epoch_sampler import MultiTaskEpochSampler
  from allennlp.data.dataset_readers.multitask import MultiTaskDatasetReader
  from allennlp.data.instance import Instance
  from allennlp.data.vocabulary import Vocabulary
  import allennlp.nn.util
label_desc: Use image node_id 7 for calling the MultiTaskDataLoader obj's underlying member method code with example usage: obj._get_instances_for_epoch() and returns: unknown, unknown