Integrate hf datasets as a data source
#11987
Replies: 3 comments
|
What do you think about the proposed integration? cc: @joshua-stauffer |
|
Hi @ParagEkbote — thanks for reaching out and for offering to contribute this. A native Hugging Face integration could definitely be valuable for teams working with training, evaluation, and other AI/ML datasets. Adding a new data source is an ongoing maintenance commitment for GX, so before we take it on I'd like two things in place:
I'll convert this issue to a discussion so the conversation stays open and others can weigh in. The questions I'd most want an RFC to answer:
Another lighter-weight approach would be a HF dataset docs recipe, similar to our existing Validate unstructured data tutorial. Happy to keep exploring this with you through the discussion and RFC. |
|
Thanks for reaching out about the same, here are my thoughts about the queries presented: 1. What does a native data source give users over
|
| Hugging Face | Great Expectations |
|---|---|
| Repository | Data Source |
| Configuration/subset | Data Asset |
| Split | Batch Definition parameter |
| Revision | Batch identifier/version |
| Shard | Batch slice / Batch parameters |
This fits GX's existing model reasonably cleanly since GX Batches already represent versions or slices of data, becoming another batch-identifying parameter rather than a new concept.
3. Which Execution Engine?
Pandas could be a suitable option for the integration. HF datasets already expose Dataset.to_pandas(), which fits GX's existing Pandas execution engine with no new compute layer required. Support for PyArrow can be explored as well since HF datasets are traditionally saved as pyarrow objects.
4. Dataset types
v1 would support scalar/tabular types: numeric, string, boolean, categorical, timestamp. Unsupported types like image, audio or video would raise an informative validation error rather than silently failing.
5. Configurations, splits, revisions, auth, caching, large datasets
- Config/split/revision become datasource/asset parameters, passed through to
load_dataset()as-is. - Revision support would include branch, tag,and commit hash, with repo/config/split/revision recorded in the GX validation metadata for reproducibility.
- Auth: Reuse the HF hub loading directly (
token=orHF_TOKEN). - Caching: Fully delegated to
datasets(HF_HOME,cache_dir). - Large datasets: rely on Arrow-backed lazy loading with
keep_in_memory=False, materializing only at batch-conversion time.
6. Streaming datasets (IterableDataset)
I would like to support streaming datasets for processing large datasets, but GX metrics (row counts, uniqueness, quantiles, completeness, distributions) assume random access or multi-pass computation, which IterableDataset's single-pass iterator model doesn't support. So the streaming support would be out of scope for v1 unless explicitly requested.
I'll convert this into a complete RFC after agreeing on the scope and architecture before implementation begins and with community interest.
cc: @joshua-stauffer
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
The Hugging Face Hub recently surpassed 1M+ datasets. Many users store and share
hf datasetson the Hub and apply it as a standard interface for accessing them. However,great_expectationsdoes not currently provide Hugging Face datasets as a native datasource.Describe the solution you'd like
Add support for Hugging Face datasets as a datasource in
great_expectations. This would allow users to load datasets directly from the Hugging Face Hub and apply expectations to their data.Describe alternatives you've considered
N.A.
Additional context
I would be interesting in contributing this integration, having done a similar integration contribution to dagster.
All reactions