Skip to content

Commit 7147aaf

Browse files
authored
Call datasets.load_dataset. See what happens. (#538)
* Remove custom error handling. * Fix wrong function call.
1 parent 8a518eb commit 7147aaf

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

promptsource/app.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,7 @@ def get_infos(d_name):
246246
if len(configs) > 0:
247247
conf_option = st.sidebar.selectbox("Subset", configs, index=0, format_func=lambda a: a.name)
248248

249-
dataset, failed = get_dataset(dataset_key, str(conf_option.name) if conf_option else None)
250-
if failed:
251-
if dataset.manual_download_instructions is not None:
252-
st.error(f"Dataset {dataset_key} requires manual download. Please skip for the moment.")
253-
else:
254-
st.error(f"Loading dataset {dataset_key} failed.\n{dataset}. Please skip for the moment.")
255-
249+
dataset = get_dataset(dataset_key, str(conf_option.name) if conf_option else None)
256250
splits = list(dataset.keys())
257251
index = 0
258252
if "train" in splits:

promptsource/utils.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,11 @@ def get_dataset_builder(path, conf=None):
5353
def get_dataset(path, conf=None):
5454
"Get a dataset from name and conf."
5555
builder_instance = get_dataset_builder(path, conf)
56-
fail = False
5756
if builder_instance.manual_download_instructions is None and builder_instance.info.size_in_bytes is not None:
5857
builder_instance.download_and_prepare()
59-
dts = builder_instance.as_dataset()
60-
dataset = dts
58+
return builder_instance.as_dataset()
6159
else:
62-
dataset = builder_instance
63-
fail = True
64-
return dataset, fail
60+
return datasets.load_dataset(path, conf)
6561

6662

6763
def get_dataset_confs(path):

test/show_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
subset_name = path[3] if len(path) == 5 else ""
1919
template_collection = TemplateCollection()
2020

21-
dataset, _ = get_dataset(dataset_name, subset_name)
21+
dataset = get_dataset(dataset_name, subset_name)
2222
splits = list(dataset.keys())
2323

2424
dataset_templates = template_collection.get_dataset(dataset_name, subset_name)

0 commit comments

Comments
 (0)