Datasets:

ArneBinder commited on
Commit
4511165
·
1 Parent(s): a9a7133

allow to load from local zip file or directory

Browse files
Files changed (1) hide show
  1. scidtb_argmin.py +7 -2
scidtb_argmin.py CHANGED
@@ -100,10 +100,15 @@ class SciDTBArgmin(datasets.GeneratorBasedBuilder):
100
  # 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.
101
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
102
 
103
- path = dl_manager.download_and_extract(_URL)
 
 
 
 
 
104
 
105
  return [
106
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"path": path}),
107
  ]
108
 
109
  def _generate_examples(self, path):
 
100
  # 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.
101
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
102
 
103
+ if dl_manager.manual_dir is not None:
104
+ base_path = os.path.abspath(dl_manager.manual_dir)
105
+ if not os.path.isdir(base_path):
106
+ base_path = dl_manager.extract(base_path)
107
+ else:
108
+ base_path = dl_manager.download_and_extract(_URL)
109
 
110
  return [
111
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"path": base_path}),
112
  ]
113
 
114
  def _generate_examples(self, path):