espnet.utils.training.batchfy.batchfy_by_frame
Less than 1 minute
espnet.utils.training.batchfy.batchfy_by_frame
espnet.utils.training.batchfy.batchfy_by_frame(sorted_data, max_frames_in, max_frames_out, max_frames_inout, num_batches=0, min_batch_size=1, shortest_first=False, ikey='input', okey='output')
Make variable batch set, which maximizes the num of frames to max_batch_frame.
- Parameters:
- sorteddata (Dict *[*str , Dict *[*str , Any ] ]) – dictionary loaded from data.json
- max_frames_in (int) – Maximum input frames of a batch
- max_frames_out (int) – Maximum output frames of a batch
- max_frames_inout (int) – Maximum input+output frames of a batch
- num_batches (int) – # number of batches to use (for debug)
- min_batch_size (int) – minimum batch size (for multi-gpu)
- test (int) – Return only every test batches
- shortest_first (bool) – Sort from batch with shortest samples to longest if true, otherwise reverse
- ikey (str) – key to access input (for ASR ikey=”input”, for TTS ikey=”output”.)
- okey (str) – key to access output (for ASR okey=”output”. for TTS okey=”input”.)
- Returns: List[Tuple[str, Dict[str, List[Dict[str, Any]]]] list of batches