class_docstr: Samples based on ratios specified as `sampling_ratios` parameter
  in the config. Default to validation/test strategy as in RoundRobin.
  
  `sampling_ratios` defines a dictionary pointing from dataset key to
  a floating ration specifying how much the dataset should be sampled.
  Floats together should sum to one.
  
  `datasets` is a list of datasets that would be sampled. This should
  a subset or same as `sampling_ratios.keys()`.
code: def __init__(
      self,
      config: Config,
      dataloaders: Dict[str, DataLoader],
      *args,
      **kwargs,
  ):
      super().__init__(config, dataloaders, *args, **kwargs)
      self._check_not_epoch_training()
      given_datasets = self._get_given_datasets()
      sampling_ratios = self.config.get("sampling_ratios", {})
      probabilities = []
      for dataset in given_datasets:
          assert (
              dataset in sampling_ratios
          ), f"{dataset} must be specified in sampling_ratios param for multitasking"
          probabilities.append(sampling_ratios[dataset])
  
      # normalize the sampling ratios to sum up to 1
      prob_sum = sum(probabilities)
      assert (
          all(prob >= 0 for prob in probabilities) and prob_sum > 0
      ), (
          "sampling_ratios param for multitasking must be all non-negative "
          "and at least one of them needs to be positive."
      )
  
      self._dataset_probabilities = [
          prob / prob_sum for prob in probabilities
      ]
      logger.info("Using per-dataset sampling probabilities:")
      for dataset, prob in zip(
          given_datasets, self._dataset_probabilities
      ):
          logger.info(f"\t{dataset}: {prob}")
  
imports: import logging
  import warnings
  from dataclasses import dataclass
  from typing import Dict
  import numpy
  from mmf.common.registry import registry
  from mmf.utils.configuration import get_global_config
  from mmf.utils.dataset import dataset_list_from_config
  from omegaconf import MISSING, OmegaConf
  from torch.utils.data import DataLoader
label_desc: Use image node_id 1 to create a new RatiosIterationStrategy object from inherited base classes: IterationStrategy with example: obj = RatiosIterationStrategy(config, dataloaders)