Locutusque commited on
Commit
adc60c4
1 Parent(s): 57f52a5

Create TM.py

Browse files
Files changed (1) hide show
  1. TM.py +56 -0
TM.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datasets
2
+ from datasets import DatasetBuilder, DatasetInfo
3
+ import pandas as pd
4
+
5
+ class TMDataset(datasets.GeneratorBasedBuilder):
6
+ def __init__(self):
7
+ self.downloads = [
8
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_1.parquet",
9
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_10.parquet",
10
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_11.parquet",
11
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_12.parquet",
12
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_13.parquet",
13
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_14.parquet",
14
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_15.parquet",
15
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_16.parquet",
16
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_17.parquet",
17
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_18.parquet",
18
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_2.parquet",
19
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_3.parquet",
20
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_4.parquet",
21
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_5.parquet",
22
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_6.parquet",
23
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_7.parquet",
24
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_8.parquet",
25
+ "https://huggingface.co/datasets/Locutusque/InstructMix-V2/resolve/main/data/combined_datasets_batch_9.parquet"
26
+
27
+ ]
28
+ VERSION = datasets.Version("1.0.0")
29
+
30
+ def _info(self):
31
+
32
+ features = datasets.Features({
33
+ "text": datasets.Value("string"),
34
+ })
35
+
36
+ return datasets.DatasetInfo(
37
+ description="Combination of text completion datasets",
38
+ features=features,
39
+ supervised_keys=None
40
+ )
41
+
42
+ def _split_generators(self, dl_manager):
43
+
44
+ data_dir = dl_manager.download_and_extract(self.downloads)
45
+ return [
46
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_dir})
47
+ ]
48
+
49
+ def _generate_examples(self, filepath):
50
+ for file in filepath:
51
+ df = pd.read_parquet(file)
52
+
53
+ for idx, row in df.iterrows():
54
+ yield idx, {
55
+ "text": row["text"],
56
+ }