def METHOD_NAME(
    self, tokens: List[Dict[str, List[int]]], skip_invalid_size_inputs: bool
) -> Iterator[Dict[str, Any]]:
    lengths = torch.LongTensor([next(iter(d.values())).numel() for d in tokens])
    batch_iterator = self.task.get_batch_iterator(
        dataset=self.task.build_dataset_for_inference(tokens, lengths),
        max_tokens=self.cfg.dataset.max_tokens,
        max_sentences=self.cfg.dataset.batch_size,
        max_positions=self.max_positions,
        ignore_invalid_inputs=skip_invalid_size_inputs,
        disable_iterator_cache=True,
    ).next_epoch_itr(shuffle=False)
    return batch_iterator