opensi·si

Most tools can already use a bucket, in one of two ways:

Bucket Integrations

Most tools can already use a bucket, in one of two ways:

  • Python libraries built on fsspec (pandas, Dask, PyArrow, and others) read and write hf://buckets/ paths through the huggingface_hub filesystem interface.
  • Tools that talk to S3 (boto3, the AWS CLI, rclone, DVC, and others) work against the S3-compatible API.

This page covers libraries with built-in bucket support, plus examples for common data libraries. For mounts and volume mounts, see Access Patterns.

pandas

import pandas as pd

df = pd.read_parquet("hf://buckets/username/my-bucket/data.parquet")
df.to_parquet("hf://buckets/username/my-bucket/output.parquet")

Dask

Dask reads and writes lazily, one partition per file, so you can process datasets larger than memory straight from a bucket:

import dask.dataframe as dd

df = dd.read_parquet("hf://buckets/username/my-bucket/data/")
df.to_parquet("hf://buckets/username/my-bucket/output/")

See Dask on the Hub for more.

Daft

Daft supports hf://buckets/ paths natively, with Xet-accelerated reads enabled by default:

import daft
from daft.io import IOConfig, HuggingFaceConfig
from huggingface_hub import get_token

io_config = IOConfig(hf=HuggingFaceConfig(token=get_token()))
df = daft.read_parquet("hf://buckets/username/my-bucket/data.parquet", io_config=io_config)

PyArrow

import pyarrow.parquet as pq

table = pq.read_table("hf://buckets/username/my-bucket/data.parquet")

PySpark

With pyspark_huggingface installed:

df = (
    spark.read.format("huggingface")
    .option("data_files", '["data.parquet"]')
    .load("buckets/username/my-bucket")
)

See PySpark on the Hub for more.

🤗 Datasets

from datasets import load_dataset

ds = load_dataset("buckets/username/my-bucket", data_files=["data.parquet"])

datatrove

datatrove readers and writers accept hf://buckets/ paths. HuggingFaceBucketWriter uploads large outputs with Xet:

from datatrove.pipeline.readers import ParquetReader
from datatrove.pipeline.writers import HuggingFaceBucketWriter

reader = ParquetReader(data_folder="hf://buckets/username/my-bucket/raw/")
writer = HuggingFaceBucketWriter(bucket="username/my-bucket", prefix="filtered")

See the datatrove README for more.