lewtun HF staff commited on
Commit
7c163db
1 Parent(s): 383cc86
Files changed (5) hide show
  1. create_dataset.py +20 -0
  2. raw_data/test.csv +0 -0
  3. raw_data/train.csv +0 -0
  4. test.jsonl +3 -0
  5. train.jsonl +3 -0
create_dataset.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import DatasetDict, load_dataset
2
+
3
+
4
+ def main():
5
+ label2id = {"positive": 2, "neutral": 1, "negative": 0}
6
+ train_dset = load_dataset("csv", data_files="raw_data/train.csv", split="train")
7
+ train_dset = train_dset.remove_columns(["selected_text"])
8
+ test_dset = load_dataset("csv", data_files="raw_data/train.csv", split="train")
9
+ raw_dset = DatasetDict()
10
+ raw_dset["train"] = train_dset
11
+ raw_dset["test"] = test_dset
12
+
13
+ for split, dset in raw_dset.items():
14
+ dset = dset.rename_column("sentiment", "label_text")
15
+ dset = dset.map(lambda x: {"label": label2id[x["label_text"]]}, num_proc=8)
16
+ dset.to_json(f"{split}.jsonl")
17
+
18
+
19
+ if __name__ == "__main__":
20
+ main()
raw_data/test.csv ADDED
The diff for this file is too large to render. See raw diff
 
raw_data/train.csv ADDED
The diff for this file is too large to render. See raw diff
 
test.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:088f0450a3f18fbd3768548b666cbf0e00b0e71a835f88dc4f6408156d1e7710
3
+ size 5277301
train.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:750bbef4e42ca44a0a6fef4625748f75014d15e128fb6b18752d34f64a4681bc
3
+ size 3743264