datasets icon indicating copy to clipboard operation
datasets copied to clipboard

Skip origin metadata fetch when streaming=True

Open TheDerbiedOne opened this issue 6 months ago • 1 comments

Fixes #8197

When using load_dataset(..., streaming=True, data_files=...), DataFilesList.from_patterns currently fetches origin metadata (ETag/mtime) for each resolved file even though the streaming pipeline doesn't use the local cache/fingerprint path.

This PR adds an opt-out (skip_origin_metadata) for data-file resolution and uses it in load_dataset_builder(..., streaming=True) so we skip the origin metadata fetch in streaming mode, reducing init latency and avoiding unnecessary network calls.

Includes a unit test that asserts _get_origin_metadata is not called for streaming.

TheDerbiedOne avatar Jun 01 '26 01:06 TheDerbiedOne

Hi! Thanks for putting this PR together. Following up on the discussion in #8197 with the maintainers, instead of only applying this automatically for streaming, we should expose skip_origin_metadata=False as a public parameter (e.g., passing it through load_dataset into DatasetBuilder). Could you amend the PR?

yuxin00j avatar Jun 17 '26 03:06 yuxin00j