xmohri commited on
Commit
95d0289
·
verified ·
1 Parent(s): f7fffa6

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. dataset_script.py +25 -0
  2. sub-001.jsonl.gz +3 -0
dataset_script.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import Dataset, DatasetDict, Features, Value
2
+ import os
3
+ import gzip
4
+ import json
5
+
6
+ def load_jsonl_gz(file_path):
7
+ with gzip.open(file_path, 'rt', encoding='utf-8') as f:
8
+ return [json.loads(line) for line in f]
9
+
10
+ def load_data(data_dir):
11
+ # Adjust the paths if necessary to load all the files
12
+ data_files = [os.path.join(data_dir, f) for f in os.listdir(data_dir) if f.endswith(".jsonl.gz")]
13
+ data = []
14
+
15
+ for file in data_files:
16
+ data.extend(load_jsonl_gz(file)) # Concatenate all jsonl.gz files
17
+
18
+ return Dataset.from_dict(data)
19
+
20
+ # Replace 'processed_data_gz' with the folder name
21
+ def dataset_info():
22
+ return DatasetDict({
23
+ 'train': load_data('/nlp/scr/xmohri/decodingthoughts/processed_data_gz'),
24
+ })
25
+
sub-001.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71ab36635e80a35097e5ff36aee856b83ae3f20382d34886c537abc3484d93a1
3
+ size 152533914