docstr: Extension of fairseq.iterators.EpochBatchIterator to use an additional
  weights structure. This weighs datasets as a function of epoch value.
  
  Args:
      dataset (~torch.utils.data.Dataset): dataset from which to load the data
      collate_fn (callable): merges a list of samples to form a mini-batch
      batch_sampler (~torch.utils.data.Sampler): an iterator over batches of
          indices
      seed (int, optional): seed for random number generator for
          reproducibility (default: 1).
      num_shards (int, optional): shard the data iterator into N
          shards (default: 1).
      shard_id (int, optional): which shard of the data iterator to
          return (default: 0).
      num_workers (int, optional): how many subprocesses to use for data
          loading. 0 means the data will be loaded in the main process
          (default: 0).
      weights: is of the format [(epoch, {dataset: weight})]
docstr_tok: ["Extension","of","fairseq.iterators.EpochBatchIterator","to","use","an","additional","weights","structure",".","This","weighs","datasets","as","a","function","of","epoch","value",".","Args",":","dataset","(","~torch.utils.data.Dataset",")",":","dataset","from","which","to","load","the","data","collate_fn","(","callable",")",":","merges","a","list","of","samples","to","form","a","mini-batch","batch_sampler","(","~torch.utils.data.Sampler",")",":","an","iterator","over","batches","of","indices","seed","(","int",",","optional",")",":","seed","for","random","number","generator","for","reproducibility","(","default",":","1",")",".","num_shards","(","int",",","optional",")",":","shard","the","data","iterator","into","N","shards","(","default",":","1",")",".","shard_id","(","int",",","optional",")",":","which","shard","of","the","data","iterator","to","return","(","default",":","0",")",".","num_workers","(","int",",","optional",")",":","how","many","subprocesses","to","use","for","data","loading",".","0","means","the","data","will","be","loaded","in","the","main","process","(","default",":","0",")",".","weights",":","is","of","the","format","[","(","epoch",",","{","dataset",":","weight","}",")","]"]
code: def __init__(
      self,
      dataset,
      collate_fn,
      batch_sampler,
      seed=1,
      num_shards=1,
      shard_id=0,
      num_workers=0,
      weights=None,
  ):
      """
      Extension of fairseq.iterators.EpochBatchIterator to use an additional
      weights structure. This weighs datasets as a function of epoch value.
  
      Args:
          dataset (~torch.utils.data.Dataset): dataset from which to load the data
          collate_fn (callable): merges a list of samples to form a mini-batch
          batch_sampler (~torch.utils.data.Sampler): an iterator over batches of
              indices
          seed (int, optional): seed for random number generator for
              reproducibility (default: 1).
          num_shards (int, optional): shard the data iterator into N
              shards (default: 1).
          shard_id (int, optional): which shard of the data iterator to
              return (default: 0).
          num_workers (int, optional): how many subprocesses to use for data
              loading. 0 means the data will be loaded in the main process
              (default: 0).
          weights: is of the format [(epoch, {dataset: weight})]
      """
      super().__init__(
          dataset=dataset,
          collate_fn=collate_fn,
          batch_sampler=batch_sampler,
          seed=seed,
          num_shards=num_shards,
          shard_id=shard_id,
          num_workers=num_workers,
      )
      self.weights = weights
  
imports: from fairseq.data import iterators, RoundRobinZipDatasets
  from pytorch_translate.data import weighted_data
label_desc: Use image node_id 1 to create a new WeightedEpochBatchIterator object from inherited base classes: iterators with example: obj = WeightedEpochBatchIterator(dataset, collate_fn, batch_sampler, seed, num_shards, shard_id, num_workers, weights)