Skip to content

fix pathlib.Path support in save_to_disk and load_from_disk#8202

Open
JiwaniZakir wants to merge 2 commits into
huggingface:mainfrom
JiwaniZakir:fix/issue-6829
Open

fix pathlib.Path support in save_to_disk and load_from_disk#8202
JiwaniZakir wants to merge 2 commits into
huggingface:mainfrom
JiwaniZakir:fix/issue-6829

Conversation

@JiwaniZakir
Copy link
Copy Markdown

url_to_fs from fsspec only accepts strings, but save_to_disk and load_from_disk in arrow_dataset.py, dataset_dict.py, and load.py pass the user-supplied path directly without converting it, causing a crash when a pathlib.Path is provided. Added str() conversion at each url_to_fs call site so all path-like objects are handled correctly. To verify, call dataset.save_to_disk(Path("my_dir")) and Dataset.load_from_disk(Path("my_dir")) with a pathlib.Path.

Fixes #6829

Hermes Agent and others added 2 commits May 16, 2026 01:02
`url_to_fs` from fsspec does not accept `pathlib.Path` objects, only strings.
Convert `dataset_path` to `str` before passing to `url_to_fs` in
`Dataset.save_to_disk`, `Dataset.load_from_disk`, `DatasetDict.save_to_disk`,
`DatasetDict.load_from_disk`, and the top-level `load_from_disk`.

Fixes huggingface#6829
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Load and save from/to disk no longer accept pathlib.Path

1 participant