Sebastian Gehrmann commited on
Commit
112809d
1 Parent(s): 9438a80

make loader work in colab

Browse files
Files changed (1) hide show
  1. SIMPITIKI.py +27 -27
SIMPITIKI.py CHANGED
@@ -41,40 +41,40 @@ _LICENSE = "CC-BY 4.0"
41
  _URLs = {
42
  "v1":{
43
  "random": {
44
- "train":"./v1/random_split/train.jsonl",
45
- "val":"./v1/random_split/val.jsonl",
46
- "test":"./v1/random_split/test.jsonl"
47
  },
48
  "transformations": {
49
- "train": "./v1/transformations_split/train.jsonl",
50
- "val": "./v1/transformations_split/val.jsonl",
51
- "seen_transformations_test": "./v1/transformations_split/seen_transformations_test.jsonl",
52
- "unseen_transformations_test":"./v1/transformations_split/unseen_transformations_test.jsonl"
53
  },
54
  "source_dataset": {
55
- "itwiki_train":"./v1/source_dataset_split/itwiki_train.jsonl",
56
- "itwiki_val": "./v1/source_dataset_split/itwiki_val.jsonl",
57
- "itwiki_test":"./v1/source_dataset_split/itwiki_test.jsonl",
58
- "tn_test":"./v1/source_dataset_split/tn_test.jsonl"
59
  }
60
  },
61
  "v2":{
62
  "random": {
63
- "train":"./v2/random_split/train.jsonl",
64
- "val":"./v2/random_split/val.jsonl",
65
- "test":"./v2/random_split/test.jsonl"
66
  },
67
  "transformations": {
68
- "train": "./v2/transformations_split/train.jsonl",
69
- "val": "./v2/transformations_split/val.jsonl",
70
- "seen_transformations_test": "./v2/transformations_split/seen_transformations_test.jsonl",
71
- "unseen_transformations_test":"./v2/transformations_split/unseen_transformations_test.jsonl"
72
  },
73
  "source_dataset": {
74
- "itwiki_train":"./v2/source_dataset_split/itwiki_train.jsonl",
75
- "itwiki_val": "./v2/source_dataset_split/itwiki_val.jsonl",
76
- "itwiki_test":"./v2/source_dataset_split/itwiki_test.jsonl",
77
- "tn_test":"./v2/source_dataset_split/tn_test.jsonl"
78
  }
79
 
80
 
@@ -144,7 +144,7 @@ class SIMPITIKI(datasets.GeneratorBasedBuilder):
144
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
145
  # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
146
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
147
-
148
  my_urls = _URLs[self.config.name]
149
  downloaded_files = dl_manager.download_and_extract(my_urls)
150
  return [
@@ -182,7 +182,7 @@ class SIMPITIKI(datasets.GeneratorBasedBuilder):
182
  },
183
  ),
184
 
185
-
186
  datasets.SplitGenerator(
187
  name='challenge_seen_transformations_val',
188
  # These kwargs will be passed to _generate_examples
@@ -236,7 +236,7 @@ class SIMPITIKI(datasets.GeneratorBasedBuilder):
236
  "split": "challenge_itwiki_test",
237
  },
238
  ),
239
-
240
  datasets.SplitGenerator(
241
  name='challenge_tn_test',
242
  # These kwargs will be passed to _generate_examples
@@ -256,7 +256,7 @@ class SIMPITIKI(datasets.GeneratorBasedBuilder):
256
 
257
  with open(filepath, encoding="utf-8") as f:
258
  for id_, row in enumerate(f):
259
- data = json.loads(row)
260
  yield id_, {
261
  "text": data["text"],
262
  "simplified_text": data["simplified_text"],
@@ -265,6 +265,6 @@ class SIMPITIKI(datasets.GeneratorBasedBuilder):
265
  "gem_id": f"gem-SIMPITIKI-{split}-{id_}",
266
  }
267
 
268
-
269
 
270
 
 
41
  _URLs = {
42
  "v1":{
43
  "random": {
44
+ "train":"v1/random_split/train.jsonl",
45
+ "val":"v1/random_split/val.jsonl",
46
+ "test":"v1/random_split/test.jsonl"
47
  },
48
  "transformations": {
49
+ "train": "v1/transformations_split/train.jsonl",
50
+ "val": "v1/transformations_split/val.jsonl",
51
+ "seen_transformations_test": "v1/transformations_split/seen_transformations_test.jsonl",
52
+ "unseen_transformations_test":"v1/transformations_split/unseen_transformations_test.jsonl"
53
  },
54
  "source_dataset": {
55
+ "itwiki_train":"v1/source_dataset_split/itwiki_train.jsonl",
56
+ "itwiki_val": "v1/source_dataset_split/itwiki_val.jsonl",
57
+ "itwiki_test":"v1/source_dataset_split/itwiki_test.jsonl",
58
+ "tn_test":"v1/source_dataset_split/tn_test.jsonl"
59
  }
60
  },
61
  "v2":{
62
  "random": {
63
+ "train":"v2/random_split/train.jsonl",
64
+ "val":"v2/random_split/val.jsonl",
65
+ "test":"v2/random_split/test.jsonl"
66
  },
67
  "transformations": {
68
+ "train": "v2/transformations_split/train.jsonl",
69
+ "val": "v2/transformations_split/val.jsonl",
70
+ "seen_transformations_test": "v2/transformations_split/seen_transformations_test.jsonl",
71
+ "unseen_transformations_test":"v2/transformations_split/unseen_transformations_test.jsonl"
72
  },
73
  "source_dataset": {
74
+ "itwiki_train":"v2/source_dataset_split/itwiki_train.jsonl",
75
+ "itwiki_val": "v2/source_dataset_split/itwiki_val.jsonl",
76
+ "itwiki_test":"v2/source_dataset_split/itwiki_test.jsonl",
77
+ "tn_test":"v2/source_dataset_split/tn_test.jsonl"
78
  }
79
 
80
 
 
144
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
145
  # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
146
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
147
+
148
  my_urls = _URLs[self.config.name]
149
  downloaded_files = dl_manager.download_and_extract(my_urls)
150
  return [
 
182
  },
183
  ),
184
 
185
+
186
  datasets.SplitGenerator(
187
  name='challenge_seen_transformations_val',
188
  # These kwargs will be passed to _generate_examples
 
236
  "split": "challenge_itwiki_test",
237
  },
238
  ),
239
+
240
  datasets.SplitGenerator(
241
  name='challenge_tn_test',
242
  # These kwargs will be passed to _generate_examples
 
256
 
257
  with open(filepath, encoding="utf-8") as f:
258
  for id_, row in enumerate(f):
259
+ data = json.loads(row)
260
  yield id_, {
261
  "text": data["text"],
262
  "simplified_text": data["simplified_text"],
 
265
  "gem_id": f"gem-SIMPITIKI-{split}-{id_}",
266
  }
267
 
268
+
269
 
270