imdb / create_dataset.py
lewtun's picture
lewtun HF staff
Fix column names
4b67092
raw
history blame
332 Bytes
from datasets import load_dataset
def main():
id2label = {0: "negative", 1: "positive", -1: "unlabeled"}
imdb = load_dataset("imdb")
for split, dset in imdb.items():
dset = dset.map(lambda x: {"label_text": id2label[x["label"]]})
dset.to_json(f"{split}.jsonl")
if __name__ == "__main__":
main()