class_docstr: Orders instances in a round-robin fashion, but grouped into batches composed entirely of
  instances from one dataset.  We'll return one batch from one dataset, then another batch from a
  different dataset, etc.  This is currently necessary in AllenNLP if your instances have
  different fields for different datasets, as we can't currently combine instances with different
  fields.
  
  When one dataset runs out, we continue iterating round-robin through the rest.
  
  If you want more fine-grained control over which datasets can be combined, it should be
  relatively straightforward to write your own scheduler, following this logic, which allows some
  datasets to be combined and others not.
  
  Registered as a `MultiTaskScheduler` with name "homogeneous_roundrobin".
  
  # Parameters
  
  batch_size: `Union[int, Dict[str, int]]`
      Determines how many instances to group together in each dataset.  If this is an `int`, the
      same value is used for all datasets; otherwise, the keys must correspond to the dataset
      names used elsewhere in the multi-task code.
class_docstr_tok: ["Orders","instances","in","a","round-robin","fashion",",","but","grouped","into","batches","composed","entirely","of","instances","from","one","dataset",".","We","'ll","return","one","batch","from","one","dataset",",","then","another","batch","from","a","different","dataset",",","etc",".","This","is","currently","necessary","in","AllenNLP","if","your","instances","have","different","fields","for","different","datasets",",","as","we","ca","n't","currently","combine","instances","with","different","fields",".","When","one","dataset","runs","out",",","we","continue","iterating","round-robin","through","the","rest",".","If","you","want","more","fine-grained","control","over","which","datasets","can","be","combined",",","it","should","be","relatively","straightforward","to","write","your","own","scheduler",",","following","this","logic",",","which","allows","some","datasets","to","be","combined","and","others","not",".","Registered","as","a","`","MultiTaskScheduler","`","with","name","``","homogeneous_roundrobin","''",".","#","Parameters","batch_size",":","`","Union","[","int",",","Dict","[","str",",","int","]","]","`","Determines","how","many","instances","to","group","together","in","each","dataset",".","If","this","is","an","`","int","`",",","the","same","value","is","used","for","all","datasets",";","otherwise",",","the","keys","must","correspond","to","the","dataset","names","used","elsewhere","in","the","multi-task","code","."]
code: def batch_instances(
      self, epoch_instances: Dict[str, Iterable[Instance]]
  ) -> Iterable[List[Instance]]:
      chunked_iterators = [
          _chunked_iterator(
              iterator, self.batch_size[dataset], self.drop_last
          )
          for dataset, iterator in epoch_instances.items()
      ]
      return more_itertools.roundrobin(*chunked_iterators)
  
imports: from collections import defaultdict
  from typing import Any, Dict, Iterable, Union, List, Mapping
  import more_itertools
  from allennlp.common.registrable import Registrable
  from allennlp.data.instance import Instance
label_desc: Use image node_id 2 for calling the HomogeneousRoundRobinScheduler obj's underlying member method code with example usage: obj.batch_instances(epoch_instances) and returns: more_itertools