def METHOD_NAME(self, data, batch_size):
    """
    Generate input batches.
    """
    padding = False if batch_size == 1 else True
    pad_func = Pad(pad_val=self._model.pad_token_id, pad_right=False, dtype=np.int64)
    def _parse_batch(batch_examples):
        if padding:
            input_ids = pad_func([example for example in batch_examples])
        else:
            input_ids = np.asarray([example for example in batch_examples], dtype=np.int64)
        return input_ids
    examples = self._convert_text_to_input(data)["input_ids"]
    # Separates data into some batches.
    one_batch = []
    for example in examples:
        one_batch.append(example)
        if len(one_batch) == batch_size:
            yield _parse_batch(one_batch)
            one_batch = []
    if one_batch:
        yield _parse_batch(one_batch)