Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HfFileSystem] Faster fs.walk() #2346

Merged
merged 2 commits into from
Jun 26, 2024
Merged

[HfFileSystem] Faster fs.walk() #2346

merged 2 commits into from
Jun 26, 2024

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Jun 19, 2024

...by using expand_info=False by default (same logic as fs.glob())

before:

In [1]: from huggingface_hub import HfFileSystem

In [2]: %time _ = list(HfFileSystem().walk("hf://datasets/allenai/c4/en"))
CPU times: user 275 ms, sys: 27.6 ms, total: 302 ms
Wall time: 11.6 s

after:

In [1]: from huggingface_hub import HfFileSystem

In [2]: %time _ = list(HfFileSystem().walk("hf://datasets/allenai/c4/en"))
CPU times: user 176 ms, sys: 22.4 ms, total: 198 ms
Wall time: 3.25 s

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@lhoestq lhoestq requested a review from Wauplin June 20, 2024 15:02
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks @lhoestq for working on that :)

@Wauplin Wauplin merged commit fbda38e into main Jun 26, 2024
17 checks passed
@Wauplin Wauplin deleted the faster-fs-walk branch June 26, 2024 17:28
MoritzLaurer pushed a commit to MoritzLaurer/huggingface_hub that referenced this pull request Jul 3, 2024
* faster fs walk

* add missing args
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.

3 participants