lewtun HF staff commited on
Commit
ec73b66
1 Parent(s): fd5b2c4

Track data in Git LFS

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. create_dataset.py +18 -0
  3. test.jsonl +0 -0
  4. train.jsonl +3 -0
  5. validation.jsonl +0 -0
.gitattributes CHANGED
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  *.mp3 filter=lfs diff=lfs merge=lfs -text
37
  *.ogg filter=lfs diff=lfs merge=lfs -text
38
  *.wav filter=lfs diff=lfs merge=lfs -text
 
 
36
  *.mp3 filter=lfs diff=lfs merge=lfs -text
37
  *.ogg filter=lfs diff=lfs merge=lfs -text
38
  *.wav filter=lfs diff=lfs merge=lfs -text
39
+ *.jsonl filter=lfs diff=lfs merge=lfs -text
create_dataset.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import load_dataset
2
+
3
+
4
+
5
+ def main():
6
+ raw_data = load_dataset("amazon_reviews_multi", "en")
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.remove_columns(["product_id", "reviewer_id", "review_title", "language", "product_category"])
10
+
11
+ for split, dataset in raw_data.items():
12
+ dataset = dataset.map(lambda x: {"label": x["stars"]-1}, num_proc=4)
13
+ dataset = dataset.map(lambda x: {"label_text": str(x["label"])}, num_proc=4)
14
+ dataset = dataset.remove_columns(["stars"])
15
+ dataset.to_json(f"{split}.jsonl")
16
+
17
+ if __name__ == "__main__":
18
+ main()
test.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52543b9175d517ec686ebc5bf76a05e22128fd184068b37c682486f109ca99f0
3
+ size 47440116
validation.jsonl ADDED
The diff for this file is too large to render. See raw diff