def chunks(lst, n):
    """Yield successive n-sized chunks from lst."""
    for i in range(0, len(lst), n):
        yield lst[i : i + n]
Yield successive n-sized chunks from lst.
dpkd/transformers/examples/legacy/seq2seq/utils.py