We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b81805 commit 67a6122Copy full SHA for 67a6122
src/datasets/utils/hub.py
@@ -2,7 +2,11 @@
2
from urllib.parse import quote
3
4
import huggingface_hub as hfh
5
+from packaging import version
6
7
8
def hf_hub_url(repo_id: str, path: str, revision: Optional[str] = None) -> str:
- return hfh.hf_hub_url(repo_id, quote(path), repo_type="dataset", revision=revision)
9
+ if version.parse(hfh.__version__) < version.parse("0.11.0"):
10
+ # old versions of hfh don't url-encode the file path
11
+ path = quote(path)
12
+ return hfh.hf_hub_url(repo_id, path, repo_type="dataset", revision=revision)
0 commit comments