shivangibithel commited on
Commit
5094fd8
1 Parent(s): 2ee35ff

Update sotab.py

Browse files
Files changed (1) hide show
  1. sotab.py +18 -12
sotab.py CHANGED
@@ -34,7 +34,7 @@ _LICENSE = ""
34
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
35
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
36
  _DATA_URL = (
37
- "https://github.com/ppasupat/WikiTableQuestions/releases/download/v1.0.2/WikiTableQuestions-1.0.2-compact.zip"
38
  )
39
 
40
 
@@ -58,7 +58,7 @@ class WikiTableQuestions(datasets.GeneratorBasedBuilder):
58
  datasets.BuilderConfig(
59
  name="random-split-1",
60
  version=VERSION,
61
- description="The random-split-1-train/dev.tsv and pristine-unseen-tables.tsv",
62
  ),
63
  ]
64
 
@@ -70,7 +70,7 @@ class WikiTableQuestions(datasets.GeneratorBasedBuilder):
70
  features = datasets.Features(
71
  {
72
  "id": datasets.Value("string"),
73
- "column_index": datasets.Value("int"),
74
  "label": datasets.features.Sequence(datasets.Value("string")),
75
  "table": {
76
  "header": datasets.features.Sequence(datasets.Value("string")),
@@ -96,27 +96,33 @@ class WikiTableQuestions(datasets.GeneratorBasedBuilder):
96
  )
97
 
98
  def _split_generators(self, dl_manager):
99
- train_file = "{}-train.tsv".format(self.config.name)
100
- dev_file = "{}-dev.tsv".format(self.config.name)
101
- test_file = "pristine-unseen-tables.tsv"
102
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
103
- urls = _DATA_URL
104
- root_dir = os.path.join(dl_manager.download_and_extract(urls), "WikiTableQuestions")
 
 
 
 
 
 
105
  return [
106
  datasets.SplitGenerator(
107
  name=datasets.Split.TRAIN,
108
  # These kwargs will be passed to _generate_examples
109
- gen_kwargs={"main_filepath": os.path.join(root_dir, "data", train_file), "root_dir": root_dir},
110
  ),
111
  datasets.SplitGenerator(
112
  name=datasets.Split.TEST,
113
  # These kwargs will be passed to _generate_examples
114
- gen_kwargs={"main_filepath": os.path.join(root_dir, "data", test_file), "root_dir": root_dir},
115
  ),
116
  datasets.SplitGenerator(
117
  name=datasets.Split.VALIDATION,
118
  # These kwargs will be passed to _generate_examples
119
- gen_kwargs={"main_filepath": os.path.join(root_dir, "data", dev_file), "root_dir": root_dir},
120
  ),
121
  ]
122
 
 
34
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
35
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
36
  _DATA_URL = (
37
+ # "https://github.com/ppasupat/WikiTableQuestions/releases/download/v1.0.2/WikiTableQuestions-1.0.2-compact.zip"
38
  )
39
 
40
 
 
58
  datasets.BuilderConfig(
59
  name="random-split-1",
60
  version=VERSION,
61
+ description="",
62
  ),
63
  ]
64
 
 
70
  features = datasets.Features(
71
  {
72
  "id": datasets.Value("string"),
73
+ "column_index": datasets.Value("int32"),
74
  "label": datasets.features.Sequence(datasets.Value("string")),
75
  "table": {
76
  "header": datasets.features.Sequence(datasets.Value("string")),
 
96
  )
97
 
98
  def _split_generators(self, dl_manager):
99
+ train_url = "https://huggingface.co/datasets/shivangibithel/SOTAB/resolve/main/CTA_Training.zip"
100
+ dev_url = "https://huggingface.co/datasets/shivangibithel/SOTAB/resolve/main/CTA_Validation.zip"
101
+ test_url = "https://huggingface.co/datasets/shivangibithel/SOTAB/resolve/main/CTA_Test.zip"
102
+
103
+ CTA_Training = os.path.join(dl_manager.download_and_extract(train_url), "CTA_Training")
104
+ CTA_Validation = os.path.join(dl_manager.download_and_extract(dev_url), "CTA_Validation")
105
+ CTA_Test = os.path.join(dl_manager.download_and_extract(test_url), "CTA_Test")
106
+
107
+ train_file = "{}.json.gz".format(self.config.name)
108
+ test_file = "{}.json.gz".format(self.config.name)
109
+ dev_file = "{}.json.gz".format(self.config.name)
110
+
111
  return [
112
  datasets.SplitGenerator(
113
  name=datasets.Split.TRAIN,
114
  # These kwargs will be passed to _generate_examples
115
+ gen_kwargs={"main_filepath": os.path.join(root_dir, "Train", train_file), "root_dir": CTA_Training},
116
  ),
117
  datasets.SplitGenerator(
118
  name=datasets.Split.TEST,
119
  # These kwargs will be passed to _generate_examples
120
+ gen_kwargs={"main_filepath": os.path.join(root_dir, "Test", test_file), "root_dir": CTA_Test},
121
  ),
122
  datasets.SplitGenerator(
123
  name=datasets.Split.VALIDATION,
124
  # These kwargs will be passed to _generate_examples
125
+ gen_kwargs={"main_filepath": os.path.join(root_dir, "Validation", dev_file), "root_dir": CTA_Validation},
126
  ),
127
  ]
128