Skip to content

Commit b775390

Browse files
authored
Improve error message for gated datasets on load (#6684)
* Improve error message for gated datasets on load Internal Slack discussion: https://huggingface.slack.com/archives/C02V51Q3800/p1708424971135029 * Point to dataset page URL * Harmonise error message
1 parent f807cd4 commit b775390

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/datasets/load.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,13 +1804,14 @@ def dataset_module_factory(
18041804
):
18051805
raise ConnectionError(f"Couldn't reach '{path}' on the Hub ({type(e).__name__})")
18061806
elif "404" in str(e):
1807-
msg = f"Dataset '{path}' doesn't exist on the Hub"
1807+
msg = f"Dataset '{path}' doesn't exist on the Hub or cannot be accessed"
18081808
raise DatasetNotFoundError(msg + f" at revision '{revision}'" if revision else msg)
18091809
elif "401" in str(e):
1810-
msg = f"Dataset '{path}' doesn't exist on the Hub"
1810+
msg = f"Dataset '{path}' doesn't exist on the Hub or cannot be accessed"
18111811
msg = msg + f" at revision '{revision}'" if revision else msg
18121812
raise DatasetNotFoundError(
1813-
msg + ". If the repo is private or gated, make sure to log in with `huggingface-cli login`."
1813+
msg
1814+
+ f". If the dataset is private or gated, make sure to log in with `huggingface-cli login` or visit the dataset page at https://huggingface.co/datasets/{path} to ask for access."
18141815
)
18151816
else:
18161817
raise e

0 commit comments

Comments
 (0)