added "label_text" column
Browse files- create_dataset.py +3 -2
create_dataset.py
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
from datasets import load_dataset
|
2 |
|
3 |
|
4 |
-
def main():
|
5 |
|
|
|
6 |
raw_data = load_dataset("amazon_reviews_multi", "de")
|
7 |
raw_data = raw_data.rename_column("review_id", "id")
|
8 |
raw_data = raw_data.rename_column("review_body", "text")
|
9 |
raw_data = raw_data.rename_column("stars", "label")
|
10 |
raw_data = raw_data.remove_columns(["product_id", "reviewer_id", "review_title", "language", "product_category"])
|
11 |
|
12 |
-
|
13 |
for split, dataset in raw_data.items():
|
|
|
14 |
dataset.to_json(f"{split}.jsonl")
|
15 |
|
16 |
if __name__ == "__main__":
|
17 |
main()
|
18 |
|
|
|
|
1 |
from datasets import load_dataset
|
2 |
|
3 |
|
|
|
4 |
|
5 |
+
def main():
|
6 |
raw_data = load_dataset("amazon_reviews_multi", "de")
|
7 |
raw_data = raw_data.rename_column("review_id", "id")
|
8 |
raw_data = raw_data.rename_column("review_body", "text")
|
9 |
raw_data = raw_data.rename_column("stars", "label")
|
10 |
raw_data = raw_data.remove_columns(["product_id", "reviewer_id", "review_title", "language", "product_category"])
|
11 |
|
|
|
12 |
for split, dataset in raw_data.items():
|
13 |
+
dataset = dataset.map(lambda x: {"label_text": str(x["label"])}, num_proc=4)
|
14 |
dataset.to_json(f"{split}.jsonl")
|
15 |
|
16 |
if __name__ == "__main__":
|
17 |
main()
|
18 |
|
19 |
+
|