def generate_dummy_batch(num_tokens, collate_fn, src_vocab, tgt_vocab, src_len=128, tgt_len=128):
    """Return a dummy batch with a given number of tokens."""
    bsz = num_tokens // max(src_len, tgt_len)
    return collate_fn([
        {
            'id': i,
            'source': src_vocab.dummy_sentence(src_len),
            'target': tgt_vocab.dummy_sentence(tgt_len),
            'output': tgt_vocab.dummy_sentence(tgt_len),
        }
        for i in range(bsz)
    ])