class_docstr: Samples from multiple sub-datasets according to sampling ratios
     using virtual epoch sizes to speed up dataloading.
  Args:
      datasets (
          List[~torch.utils.data.Dataset]
          or OrderedDict[str, ~torch.utils.data.Dataset]
      ): datasets
      sampling_ratios (List[float]): list of probability of each dataset to be sampled
          (default: None, which corresponds to concating all dataset together).
      seed (int): RNG seed to use (default: 2).
      epoch (int): starting epoch number (default: 1).
      eval_key (str, optional): a key used at evaluation time that causes
          this instance to pass-through batches from *datasets[eval_key]*.
      collate_format (CollateFormat):  collater output format, either CollateFormat.ordered_dict or
          CollateFormat.single (default: CollateFormat.single) where CollateFormat.single configures
          the collater to output batches of data mixed from all sub-datasets,
          and CollateFormat.ordered_dict configures the collater to output a dictionary of batches indexed by keys
          of sub-datasets.
          Note that not all sub-datasets will present in a single batch in both formats.
      virtual_size (int, or callable): the expected virtual size of the dataset (default: default_virtual_size_func).
      split (str): the split of the data, e.g. 'train', 'valid' or 'test'.
      virtual_epoch_size (int): virtual epoch size, the dataset will go through the data by
          this virtual epoch size one by one to speed up data loading, e.g. indicing and filtering
          can be performed whenever a virtual epoch is loaded without waiting for the whole dataset to be loaded.
      shared_collater (bool): whether or not to all sub-datasets have the same collater.
      shard_epoch (int): the real epoch number for shard selection.
      shuffle (bool): whether or not to shuffle data (default: True).
class_docstr_tok: ["Samples","from","multiple","sub-datasets","according","to","sampling","ratios","using","virtual","epoch","sizes","to","speed","up","dataloading",".","Args",":","datasets","(","List","[","~torch.utils.data.Dataset","]","or","OrderedDict","[","str",",","~torch.utils.data.Dataset","]",")",":","datasets","sampling_ratios","(","List","[","float","]",")",":","list","of","probability","of","each","dataset","to","be","sampled","(","default",":","None",",","which","corresponds","to","concating","all","dataset","together",")",".","seed","(","int",")",":","RNG","seed","to","use","(","default",":","2",")",".","epoch","(","int",")",":","starting","epoch","number","(","default",":","1",")",".","eval_key","(","str",",","optional",")",":","a","key","used","at","evaluation","time","that","causes","this","instance","to","pass-through","batches","from","*","datasets","[","eval_key","]","*",".","collate_format","(","CollateFormat",")",":","collater","output","format",",","either","CollateFormat.ordered_dict","or","CollateFormat.single","(","default",":","CollateFormat.single",")","where","CollateFormat.single","configures","the","collater","to","output","batches","of","data","mixed","from","all","sub-datasets",",","and","CollateFormat.ordered_dict","configures","the","collater","to","output","a","dictionary","of","batches","indexed","by","keys","of","sub-datasets",".","Note","that","not","all","sub-datasets","will","present","in","a","single","batch","in","both","formats",".","virtual_size","(","int",",","or","callable",")",":","the","expected","virtual","size","of","the","dataset","(","default",":","default_virtual_size_func",")",".","split","(","str",")",":","the","split","of","the","data",",","e.g",".","'train","'",",","'valid","'","or","'test","'",".","virtual_epoch_size","(","int",")",":","virtual","epoch","size",",","the","dataset","will","go","through","the","data","by","this","virtual","epoch","size","one","by","one","to","speed","up","data","loading",",","e.g",".","indicing","and","filtering","can","be","performed","whenever","a","virtual","epoch","is","loaded","without","waiting","for","the","whole","dataset","to","be","loaded",".","shared_collater","(","bool",")",":","whether","or","not","to","all","sub-datasets","have","the","same","collater",".","shard_epoch","(","int",")",":","the","real","epoch","number","for","shard","selection",".","shuffle","(","bool",")",":","whether","or","not","to","shuffle","data","(","default",":","True",")","."]
code: def set_epoch(self, epoch):
      if self._current_epoch_start_index is None:
          # initializing epoch idnices of a virtual dataset
          self._setup(epoch)
          self._next_virtual_epoch(epoch)
      else:
          # working on already intialized epoch indices
          if epoch == self._cur_epoch:
              # re-enter so return
              return
          self._next_virtual_epoch(epoch)
  
file_path: fairseq/fairseq/data/multilingual/sampled_multi_epoch_dataset.py
imports: import hashlib
  import logging
  import math
  import numpy
  from fairseq.data import SampledMultiDataset
  from .sampled_multi_dataset import CollateFormat, default_virtual_size_func
label_desc: Use image node_id 7 for calling the SampledMultiEpochDataset obj's underlying member method code with example usage: obj.set_epoch(epoch) without return types