dainis-boumber commited on
Commit
37831c2
1 Parent(s): 5759e63

Upload gdds.py

Browse files
Files changed (1) hide show
  1. gdds.py +9 -4
gdds.py CHANGED
@@ -1,4 +1,6 @@
1
 
 
 
2
  import csv
3
  import json
4
  import os
@@ -25,6 +27,7 @@ _HOMEPAGE = ""
25
  _LICENSE = ""
26
 
27
 
 
28
  # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
29
  class GDDS(datasets.GeneratorBasedBuilder):
30
  """TODO: Short description of my dataset."""
@@ -84,13 +87,15 @@ class GDDS(datasets.GeneratorBasedBuilder):
84
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
85
  # 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.
86
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
87
- script_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
 
 
88
  return [
89
  datasets.SplitGenerator(
90
  name=datasets.Split.TRAIN,
91
  # These kwargs will be passed to _generate_examples
92
  gen_kwargs={
93
- "filepath": os.path.join(script_directory, self.config.name, "train.jsonl"),
94
  "split": "train",
95
  },
96
  ),
@@ -98,7 +103,7 @@ class GDDS(datasets.GeneratorBasedBuilder):
98
  name=datasets.Split.VALIDATION,
99
  # These kwargs will be passed to _generate_examples
100
  gen_kwargs={
101
- "filepath": os.path.join(script_directory, self.config.name, "validate.jsonl"),
102
  "split": "dev",
103
  },
104
  ),
@@ -106,7 +111,7 @@ class GDDS(datasets.GeneratorBasedBuilder):
106
  name=datasets.Split.TEST,
107
  # These kwargs will be passed to _generate_examples
108
  gen_kwargs={
109
- "filepath": os.path.join(script_directory, self.config.name, "test.jsonl"),
110
  "split": "test"
111
  },
112
  ),
 
1
 
2
+
3
+
4
  import csv
5
  import json
6
  import os
 
27
  _LICENSE = ""
28
 
29
 
30
+
31
  # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
32
  class GDDS(datasets.GeneratorBasedBuilder):
33
  """TODO: Short description of my dataset."""
 
87
  # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
88
  # 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.
89
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
90
+ # urls = _URLS[self.config.name]
91
+ data_dir = dl_manager.download_and_extract(self.config.name)
92
+
93
  return [
94
  datasets.SplitGenerator(
95
  name=datasets.Split.TRAIN,
96
  # These kwargs will be passed to _generate_examples
97
  gen_kwargs={
98
+ "filepath": os.path.join(data_dir, "train.jsonl"),
99
  "split": "train",
100
  },
101
  ),
 
103
  name=datasets.Split.VALIDATION,
104
  # These kwargs will be passed to _generate_examples
105
  gen_kwargs={
106
+ "filepath": os.path.join(data_dir, "validate.jsonl"),
107
  "split": "dev",
108
  },
109
  ),
 
111
  name=datasets.Split.TEST,
112
  # These kwargs will be passed to _generate_examples
113
  gen_kwargs={
114
+ "filepath": os.path.join(data_dir, "test.jsonl"),
115
  "split": "test"
116
  },
117
  ),