class_docstr: Samples index based on size of each dataset. Bigger datasets
  are sampled more and this strategy requires completing
  all iterators before starting new ones. Default in MMF.
code: def __init__(
      self,
      config: Config,
      dataloaders: Dict[str, DataLoader],
      *args,
      **kwargs,
  ):
      super().__init__(config, dataloaders, *args, **kwargs)
      self._per_dataset_lengths = []
      self._total_length = 0
  
      for loader in self.dataloaders.values():
          # Some loaders might not have dataset attribute
          # set, in this case we need to fail gracefully as we can't
          # calculate lengths.
          assert hasattr(loader, "dataset"), (
              "loaders need dataset objects to work with "
              + "'size_proportional' sampling"
          )
  
          dataset_instance = loader.dataset
  
          assert hasattr(dataset_instance, "__len__"), (
              "all datasets should have __len__ defined "
              + "to work with proportional sampling iterator"
          )
          dataset_instance_length = len(dataset_instance)
          assert (
              dataset_instance_length
          ), f"dataset: {dataset_instance.dataset_type} is empty"
          self._per_dataset_lengths.append(dataset_instance_length)
          self._total_length += dataset_instance_length
  
      self._dataset_probabilities = self._per_dataset_lengths[:]
      self._dataset_probabilities = [
          prob / self._total_length
          for prob in self._dataset_probabilities
      ]
  
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 SizeProportionalIterationStrategy object from inherited base classes: IterationStrategy with example: obj = SizeProportionalIterationStrategy(config, dataloaders)