(task,
                  data,
                  batch_size,
                  max_length_in,
                  max_length_out,
                  num_batches=0,
                  batch_sort_key='shuffle',
                  min_batch_size=1,
                  shortest_first=False,
                  batch_bins=0,
                  batch_frames_in=0,
                  batch_frames_out=0,
                  batch_frames_inout=0,
                  batch_strategy='auto')
return minibatches
Make batch set from json dictionary

  if utts have "category" value,

     >>> data = {'utt1': {'category': 'A', 'input': ...},
     ...         'utt2': {'category': 'B', 'input': ...},
     ...         'utt3': {'category': 'B', 'input': ...},
     ...         'utt4': {'category': 'A', 'input': ...}}
     >>> make_batchset(data, batchsize=2, ...)
     [[('utt1', ...), ('utt4', ...)], [('utt2', ...), ('utt3': ...)]]

  Note that if any utts doesn't have "category",
  perform as same as batchfy_by_{batch_strategy}

  :param string task: task type, which in [asr, tts]
  :param Dict[str, Dict[str, Any]] data: dictionary loaded from data.json
  :param int batch_size: maximum number of sequences in a minibatch.
  :param int batch_bins: maximum number of bins (frames x dim) in a minibatch.
  :param int batch_frames_in:  maximum number of input frames in a minibatch.
  :param int batch_frames_out: maximum number of output frames in a minibatch.
  :param int batch_frames_out: maximum number of input+output frames in a minibatch.
  :param str batch_strategy: strategy to count maximum size of batch [auto, seq, bin, frame].
      "auto" : automatically detect make_batch strategy by finding enabled args
      "seq"  : create the minibatch that has the maximum number of seqs under batch_size.
      "bin"  : create the minibatch that has the maximum number of bins under batch_bins,
               where the "bin" means the number of frames x dim.
      "frame": create the minibatch that has the maximum number of input, output and input+output
               frames under batch_frames_in, batch_frames_out and batch_frames_inout, respectively

  :param int max_length_in: maximum length of input to decide adaptive batch size
  :param int max_length_out: maximum length of output to decide adaptive batch size
  :param int num_batches: # number of batches to use (for debug)
  :param int min_batch_size: minimum batch size (for multi-gpu)
  :param bool shortest_first: Sort from batch with shortest samples to longest if true,
                              otherwise reverse
  :param str batch_sort_key: how to sort data before creating minibatches [input, output, shuffle]
      :return: List[List[Tuple[str, dict]]] list of batches

  Reference: https://github.com/espnet/espnet/pull/759/files
             https://github.com/espnet/espnet/commit/dc0a0d3cfc271af945804f391e81cd5824b08725
             https://github.com/espnet/espnet/commit/73018318a65d18cf2e644a45aa725323c9e4a0e6
Make batch set from json dictionary
Make batch set from json dictionary
def make_batchset(task,
                  data,
                  batch_size,
                  max_length_in,
                  max_length_out,
                  num_batches=0,
                  batch_sort_key='shuffle',
                  min_batch_size=1,
                  shortest_first=False,
                  batch_bins=0,
                  batch_frames_in=0,
                  batch_frames_out=0,
                  batch_frames_inout=0,
                  batch_strategy='auto'):
  """Make batch set from json dictionary

  if utts have "category" value,

     >>> data = {'utt1': {'category': 'A', 'input': ...},
     ...         'utt2': {'category': 'B', 'input': ...},
     ...         'utt3': {'category': 'B', 'input': ...},
     ...         'utt4': {'category': 'A', 'input': ...}}
     >>> make_batchset(data, batchsize=2, ...)
     [[('utt1', ...), ('utt4', ...)], [('utt2', ...), ('utt3': ...)]]

  Note that if any utts doesn't have "category",
  perform as same as batchfy_by_{batch_strategy}

  :param string task: task type, which in [asr, tts]
  :param Dict[str, Dict[str, Any]] data: dictionary loaded from data.json
  :param int batch_size: maximum number of sequences in a minibatch.
  :param int batch_bins: maximum number of bins (frames x dim) in a minibatch.
  :param int batch_frames_in:  maximum number of input frames in a minibatch.
  :param int batch_frames_out: maximum number of output frames in a minibatch.
  :param int batch_frames_out: maximum number of input+output frames in a minibatch.
  :param str batch_strategy: strategy to count maximum size of batch [auto, seq, bin, frame].
      "auto" : automatically detect make_batch strategy by finding enabled args
      "seq"  : create the minibatch that has the maximum number of seqs under batch_size.
      "bin"  : create the minibatch that has the maximum number of bins under batch_bins,
               where the "bin" means the number of frames x dim.
      "frame": create the minibatch that has the maximum number of input, output and input+output
               frames under batch_frames_in, batch_frames_out and batch_frames_inout, respectively

  :param int max_length_in: maximum length of input to decide adaptive batch size
  :param int max_length_out: maximum length of output to decide adaptive batch size
  :param int num_batches: # number of batches to use (for debug)
  :param int min_batch_size: minimum batch size (for multi-gpu)
  :param bool shortest_first: Sort from batch with shortest samples to longest if true,
                              otherwise reverse
  :param str batch_sort_key: how to sort data before creating minibatches [input, output, shuffle]
      :return: List[List[Tuple[str, dict]]] list of batches

  Reference: https://github.com/espnet/espnet/pull/759/files
             https://github.com/espnet/espnet/commit/dc0a0d3cfc271af945804f391e81cd5824b08725
             https://github.com/espnet/espnet/commit/73018318a65d18cf2e644a45aa725323c9e4a0e6
  """

  assert task in list(TASK_SET.keys())

  #swap_io: if True, use "input" as output and "output" as input in `data` dict
  swap_io = False
  if task == TASK_SET['tts']:
    swap_io = True

  minibatches = make_batchset_espnet(
      data,
      batch_size=batch_size,
      max_length_in=max_length_in,
      max_length_out=max_length_out,
      num_batches=num_batches,
      min_batch_size=min_batch_size,
      shortest_first=shortest_first,
      batch_sort_key=batch_sort_key,
      swap_io=swap_io,
      count=batch_strategy,
      batch_bins=batch_bins,
      batch_frames_in=batch_frames_in,
      batch_frames_out=batch_frames_out,
      batch_frames_inout=batch_frames_inout)
  return minibatches
def make_batchset ( task , data , batch_size , max_length_in , max_length_out , num_batches = 0 , batch_sort_key = 'shuffle' , min_batch_size = 1 , shortest_first = False , batch_bins = 0 , batch_frames_in = 0 , batch_frames_out = 0 , batch_frames_inout = 0 , batch_strategy = 'auto' ) : assert task in list ( TASK_SET . keys ( ) ) #swap_io: if True, use "input" as output and "output" as input in `data` dict swap_io = False if task == TASK_SET [ 'tts' ] : swap_io = True minibatches = make_batchset_espnet ( data , batch_size = batch_size , max_length_in = max_length_in , max_length_out = max_length_out , num_batches = num_batches , min_batch_size = min_batch_size , shortest_first = shortest_first , batch_sort_key = batch_sort_key , swap_io = swap_io , count = batch_strategy , batch_bins = batch_bins , batch_frames_in = batch_frames_in , batch_frames_out = batch_frames_out , batch_frames_inout = batch_frames_inout ) return minibatches