Tool

Load Hugging Face datasets into LlamaIndex pipelines

A LlamaIndex reader that loads datasets from Hugging Face Hub using the Filesystem API, supporting documents, dictionaries, and DataFrames.

Works with huggingface

72
Spark score
out of 100
Updated 2 days ago
Version 0.14.23

Add to Favorites

Why it matters

Users hire this asset to seamlessly load datasets from Hugging Face Hub directly into LlamaIndex workflows, enabling them to quickly ingest training data, documents, or structured datasets for RAG applications and AI model development without manual file handling.

Outcomes

What it gets done

01

Load Hugging Face datasets as LlamaIndex documents for RAG indexing

02

Extract dataset contents as Python dictionaries for custom processing

03

Convert Hugging Face data files into pandas DataFrames

04

Access compressed dataset files (.jsonl.gz) via Hugging Face Filesystem API

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-huggingface-fs | bash

Overview

Hugging Face FS Loader

Hugging Face FS Loader is a LlamaIndex reader that uses Hugging Face Hub's Filesystem API (version 0.14+) to load datasets. It offers three loading methods: load_data for LlamaIndex documents, load_dicts for Python dictionaries, and load_df for pandas DataFrames. You pass in a path to a Hugging Face dataset and receive data in your chosen format. Use this loader when you need to ingest datasets from Hugging Face Hub directly into LlamaIndex workflows for RAG applications, search indexing, or document processing. It's particularly useful when you want flexible output formats - documents for indexing, dictionaries for custom processing, or DataFrames for analysis.

What it does

Hugging Face FS Loader is a data reader for LlamaIndex that uses Hugging Face Hub's Filesystem API (version 0.14 or higher) to load datasets. It provides three flexible loading methods: load_data for documents, load_dicts for dictionary objects, and load_df for pandas DataFrames, allowing you to choose the format that best suits your downstream processing needs.

When to use - and when NOT to

Use this loader when you need to ingest datasets hosted on Hugging Face Hub directly into LlamaIndex workflows. It's ideal for scenarios where you're building RAG applications, indexing public datasets for search, or processing machine learning datasets within LlamaIndex pipelines. The multiple output formats make it suitable whether you need structured documents for indexing, raw dictionaries for custom processing, or DataFrames for analytical operations.

Do NOT use this loader if you need to access datasets from sources other than Hugging Face Hub - it's specifically designed for the Hugging Face Filesystem API. Also avoid it if you're working with Hugging Face Hub versions older than 0.14, as the Filesystem API dependency won't be satisfied.

Inputs and outputs

You provide a path string pointing to a dataset file on Hugging Face Hub (for example, "datasets/dair-ai/emotion/data/data.jsonl.gz"). The loader accepts compressed formats like .jsonl.gz.

You receive one of three output types depending on the method called: LlamaIndex document objects from load_data, Python dictionaries from load_dicts, or pandas DataFrames from load_df. This flexibility lets you choose the data structure that matches your processing pipeline.

Integrations

This loader integrates with LlamaIndex as a data reader component, designed specifically to feed data into LlamaIndex's document processing and indexing system. It relies on Hugging Face Hub's Filesystem API (version 0.14 or higher) to access datasets stored on the Hugging Face platform.

Who it's for

This tool is for developers building LlamaIndex applications who need to incorporate datasets from Hugging Face Hub. It's particularly useful for machine learning engineers and data scientists who want to leverage publicly available datasets in their RAG systems, search applications, or document processing pipelines without manual download steps.

Installation and usage

Install the loader via pip:

pip install llama-index-readers-huggingface-fs

Basic usage example showing all three loading methods:

from pathlib import Path

from llama_index.readers.huggingface_fs import HuggingFaceFSReader

### load documents
loader = HuggingFaceFSReader()
documents = loader.load_data("datasets/dair-ai/emotion/data/data.jsonl.gz")

### load dicts
dicts = loader.load_dicts("datasets/dair-ai/emotion/data/data.jsonl.gz")

### load df
df = loader.load_df("datasets/dair-ai/emotion/data/data.jsonl.gz")
Source README

Hugging Face FS Loader

pip install llama-index-readers-huggingface-fs

This loader uses Hugging Face Hub's Filesystem API (> 0.14) to
load datasets.

Besides the existing load_data function, you may also choose to use
load_dicts and load_df.

Usage

To use this loader, you need to pass in a path to a Hugging Face dataset.

from pathlib import Path

from llama_index.readers.huggingface_fs import HuggingFaceFSReader

### load documents
loader = HuggingFaceFSReader()
documents = loader.load_data("datasets/dair-ai/emotion/data/data.jsonl.gz")

### load dicts
dicts = loader.load_dicts("datasets/dair-ai/emotion/data/data.jsonl.gz")

### load df
df = loader.load_df("datasets/dair-ai/emotion/data/data.jsonl.gz")

This loader is designed to be used as a way to load data into LlamaIndex.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.