Datasets:

Languages:
English
Size:
n<1K
ArneBinder commited on
Commit
26f0f37
1 Parent(s): 6bc6221

allow to load from local zip file or directory

Browse files
Files changed (1) hide show
  1. cdcp.py +7 -1
cdcp.py CHANGED
@@ -96,7 +96,13 @@ class CDCP(datasets.GeneratorBasedBuilder):
96
  # 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.
97
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
98
 
99
- base_path = Path(dl_manager.download_and_extract(_URL)) / "cdcp"
 
 
 
 
 
 
100
 
101
  return [
102
  datasets.SplitGenerator(
 
96
  # 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.
97
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
98
 
99
+ if dl_manager.manual_dir is not None:
100
+ base_path = os.path.abspath(dl_manager.manual_dir)
101
+ if not os.path.isdir(base_path):
102
+ base_path = dl_manager.extract(base_path)
103
+ else:
104
+ base_path = dl_manager.download_and_extract(_URL)
105
+ base_path = Path(base_path) / "cdcp"
106
 
107
  return [
108
  datasets.SplitGenerator(