zhufy commited on
Commit
205c377
·
1 Parent(s): 258b48d

Update xquad_split.py

Browse files
Files changed (1) hide show
  1. xquad_split.py +8 -12
xquad_split.py CHANGED
@@ -101,32 +101,28 @@ class Xquad(datasets.GeneratorBasedBuilder):
101
  # TODO(xquad): Downloads the data and defines the splits
102
  # dl_manager is a datasets.download.DownloadManager that can be used to
103
  # download and extract URLs
104
-
105
-
106
- urls_to_download = _URL + _TRAIN_FILE
107
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
108
-
109
- urls_to_download = _URL + _VALID_FILE
110
- downloaded_files = dl_manager.download_and_extract(urls_to_download)
111
-
112
- urls_to_download = _URL + _TEST_FILE
113
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
114
 
115
  return [
116
  datasets.SplitGenerator(
117
  name=datasets.Split.TRAIN,
118
  # These kwargs will be passed to _generate_examples
119
- gen_kwargs={"filepath": os.path.join(data_dir, _TRAIN_FILE)},
120
  ),
121
  datasets.SplitGenerator(
122
  name=datasets.Split.VALIDATION,
123
  # These kwargs will be passed to _generate_examples
124
- gen_kwargs={"filepath": os.path.join(data_dir, _VALID_FILE)},
125
  ),
126
  datasets.SplitGenerator(
127
  name=datasets.Split.TEST,
128
  # These kwargs will be passed to _generate_examples
129
- gen_kwargs={"filepath": os.path.join(data_dir, _TEST_FILE)},
130
  ),
131
  ]
132
 
 
101
  # TODO(xquad): Downloads the data and defines the splits
102
  # dl_manager is a datasets.download.DownloadManager that can be used to
103
  # download and extract URLs
104
+
105
+ urls_to_download = {'TRAIN': _URL + _TRAIN_FILE,
106
+ 'VALID':_URL + _VALID_FILE,
107
+ 'TEST':_URL + _TEST_FILE,
108
+ }
 
 
 
 
109
  downloaded_files = dl_manager.download_and_extract(urls_to_download)
110
 
111
  return [
112
  datasets.SplitGenerator(
113
  name=datasets.Split.TRAIN,
114
  # These kwargs will be passed to _generate_examples
115
+ gen_kwargs={"filepath": downloaded_files['TRAIN']},
116
  ),
117
  datasets.SplitGenerator(
118
  name=datasets.Split.VALIDATION,
119
  # These kwargs will be passed to _generate_examples
120
+ gen_kwargs={"filepath": downloaded_files['VALID']},
121
  ),
122
  datasets.SplitGenerator(
123
  name=datasets.Split.TEST,
124
  # These kwargs will be passed to _generate_examples
125
+ gen_kwargs={"filepath": downloaded_files['TEST']},
126
  ),
127
  ]
128