amazon_reviews_multi_zh / create_dataset.py
Unso's picture
Upload create_dataset.py
b179e29
raw
history blame
500 Bytes
from datasets import load_dataset
def main():
raw_data = load_dataset("amazon_reviews_multi", "zh")
raw_data = raw_data.rename_column("review_id", "id")
raw_data = raw_data.rename_column("review_body", "text")
raw_data = raw_data.rename_column("stars", "label")
raw_data = raw_data.remove_columns(["product_id", "reviewer_id", "review_title", "language", "product_category"])
for split, dataset in raw_data.items():
dataset.to_json(f"{split}.jsonl")
if __name__ == "__main__":
main()