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

feat: Hugging Face path expansion #17665

Merged
merged 2 commits into from
Jul 16, 2024
Merged

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Jul 16, 2024

This should allow us to scan Parquet, CSV and IPC from hf://

r = pl.scan_parquet(
    "hf://datasets/roneneldan/TinyStories/data/train-00000-of-00004-2d5a1467fff1081b.parquet"
).head(1)

print(r.collect())

r = pl.scan_parquet(
    "hf://datasets/roneneldan/TinyStories@~parquet/default/train/*.parquet"
).head(1)

print(r.collect())

r = pl.scan_csv("hf://datasets/fka/awesome-chatgpt-prompts/*.csv")

print(r.collect())

ref #17625

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Jul 16, 2024
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 53.28947% with 142 lines in your changes missing coverage. Please review.

Project coverage is 80.71%. Comparing base (08b6f1d) to head (ad2fb1a).
Report is 2 commits behind head on main.

Files Patch % Lines
crates/polars-io/src/path_utils/hugging_face.rs 46.66% 136 Missing ⚠️
crates/polars-io/src/path_utils/mod.rs 83.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17665      +/-   ##
==========================================
- Coverage   80.72%   80.71%   -0.02%     
==========================================
  Files        1485     1486       +1     
  Lines      195527   195798     +271     
  Branches     2782     2782              
==========================================
+ Hits       157839   158029     +190     
- Misses      37176    37257      +81     
  Partials      512      512              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nameexhaustion nameexhaustion marked this pull request as ready for review July 16, 2024 13:29
Copy link
Collaborator

@c-peters c-peters left a comment

Choose a reason for hiding this comment

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

Nice!

@c-peters c-peters merged commit 20babcd into pola-rs:main Jul 16, 2024
22 checks passed
@ritchie46
Copy link
Member

Ran a benchmark:

# Download full parquet:
- Polars: 12,1s
- DuckDB: 2min 14s
- pandas: 13.6s
- dask: 13.6s

# Download with a limit (so download must stop early)
- Polars <1s
- DuckDB: 1,5s
- pandas: 12,4s
- dask: 13.9s

@nameexhaustion nameexhaustion deleted the expand-paths-hf branch July 19, 2024 12:21
@c-peters c-peters added the accepted Ready for implementation label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants