def read_formatted_batch(dataset: nlp.Dataset, length, batch_size, type): with dataset.formatted_as(type=type): for i in range(0, length, batch_size): _ = dataset[i:i + batch_size]
def read_formatted(dataset: nlp.Dataset, length, type): with dataset.formatted_as(type=type): for i in range(length): _ = dataset[i]