@@ -46,33 +46,25 @@ def get_dataset_builder(path, conf=None):
46
46
47
47
def get_dataset (path , conf = None ):
48
48
"Get a dataset from name and conf."
49
- builder_instance = get_dataset_builder (path , conf )
50
- if builder_instance .manual_download_instructions is None and builder_instance .info .size_in_bytes is not None :
51
- builder_instance .download_and_prepare ()
52
- return builder_instance .as_dataset ()
53
- else :
54
- return load_dataset (path , conf )
55
-
56
-
57
- def load_dataset (dataset_name , subset_name ):
58
49
try :
59
- return datasets .load_dataset (dataset_name , subset_name )
50
+ return datasets .load_dataset (path , conf )
60
51
except datasets .builder .ManualDownloadError :
61
52
cache_root_dir = (
62
53
os .environ ["PROMPTSOURCE_MANUAL_DATASET_DIR" ]
63
54
if "PROMPTSOURCE_MANUAL_DATASET_DIR" in os .environ
64
55
else DEFAULT_PROMPTSOURCE_CACHE_HOME
65
56
)
66
- data_dir = (
67
- f"{ cache_root_dir } /{ dataset_name } "
68
- if subset_name is None
69
- else f"{ cache_root_dir } /{ dataset_name } /{ subset_name } "
70
- )
71
- return datasets .load_dataset (
72
- dataset_name ,
73
- subset_name ,
74
- data_dir = data_dir ,
75
- )
57
+ data_dir = f"{ cache_root_dir } /{ path } " if conf is None else f"{ cache_root_dir } /{ path } /{ conf } "
58
+ try :
59
+ return datasets .load_dataset (
60
+ path ,
61
+ conf ,
62
+ data_dir = data_dir ,
63
+ )
64
+ except Exception as err :
65
+ raise err
66
+ except Exception as err :
67
+ raise err
76
68
77
69
78
70
def get_dataset_confs (path ):
0 commit comments