Skip to content

Keep forward slashes when joining remote dataset paths - #101

Open
barrosyan wants to merge 1 commit into
PolymathicAI:masterfrom
barrosyan:fix/remote-uri-path-join
Open

barrosyan wants to merge 1 commit into
PolymathicAI:masterfrom
barrosyan:fix/remote-uri-path-join

Conversation

@barrosyan

Copy link
Copy Markdown

Fixes #91.

WellDataset built data_path, trunk_path and the default normalization_path with os.path.join. On Windows that inserts backslashes, so hf://datasets/polymathic-ai/ becomes an invalid Hugging Face repo id and streaming fails.

Changes:

  • Add a small _join_path helper that uses posixpath.join when the base path is an fsspec URI (contains ://) and os.path.join otherwise. Use it for every join in WellDataset.__init__ (same class of fix as Fix Windows path resolution for normalization_path #81, extended to the data paths).
  • Treat a remote normalization_path as absolute instead of re-joining it under the trunk path.
  • Add a regression test that swaps os.path for ntpath to simulate Windows and checks that remote URIs keep forward slashes while local paths still use the platform separator.

pytest tests/data/test_dataset.py: 29 passed.

WellDataset built data_path, trunk_path and the default normalization_path
with os.path.join, which inserts backslashes on Windows and turns
hf:// URIs into invalid Hugging Face repo ids. Join remote (fsspec) paths
with posixpath instead, and treat a remote normalization_path as absolute.

Fixes PolymathicAI#91

This branch has not been deployed

No deployments
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.

[Bug]: Windows: os.path.join breaks hf:// streaming paths in WellDataset (HFValidationError)

1 participant