Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:AI4Finance Foundation FinGPT HuggingFace Datasets

From Leeroopedia
Knowledge Sources
Domains Deep_Learning, NLP
Last Updated 2026-10-18 00:00 GMT

Overview

HuggingFace `datasets` library (>=2.14.5) for loading, blending, and processing benchmark and training datasets from disk or the Hub.

Description

This environment provides the `datasets` library used by the `load_dataset` implementation to load benchmark datasets (e.g., `FinGPT/fingpt-*`, `financial_phrasebank-sentences_50agree`), concatenate multiple datasets with `datasets.concatenate_datasets`, split train/test, and apply `map` transformations for tokenization. Datasets can be loaded from local disk (`load_from_disk`) or remotely (`load_dataset`).

Usage

Use this environment for any dataset loading, train/test splitting, or dataset transformation workflow. Required by `load_dataset`, `create_dataset`, and benchmark evaluation implementations.

System Requirements

Category Requirement Notes
OS Any Cross-platform
Hardware CPU sufficient No GPU needed for data loading
Disk 1-10GB For cached datasets

Dependencies

Python Packages

  • `datasets` >= 2.14.5
  • `pyarrow` >= 13.0.0
  • `huggingface-hub` >= 0.16.4
  • `pandas` >= 2.1.1
  • `numpy` < 2

Credentials

  • `HF_TOKEN`: Required if loading gated datasets from the Hub.

Quick Install

pip install "datasets>=2.14.5" pyarrow>=13.0.0 huggingface-hub>=0.16.4 pandas numpy<2

Code Evidence

Dataset loading with replication from `fingpt/FinGPT_Benchmark/utils.py:200-202`:

tmp_dataset = datasets.load_dataset(dataset_path_or_name) if from_remote else datasets.load_from_disk(
    dataset_path_or_name)

Train/test split creation from `fingpt/FinGPT_Benchmark/utils.py:208-210`:

tmp_dataset = tmp_dataset['train']
tmp_dataset = tmp_dataset.train_test_split(test_size=0.2, shuffle=True, seed=42)

Dataset concatenation from `fingpt/FinGPT_Benchmark/train_lora.py:87`:

dataset_train = datasets.concatenate_datasets([d['train'] for d in dataset_list]).shuffle(seed=42)

Common Errors

Error Message Cause Solution
`FileNotFoundError: dataset path does not exist` Local path missing Ensure `data/fingpt-*` directories exist, or use `from_remote=True`
`Replication factor must be a positive integer` Invalid `*n` syntax Use format `dataset_name*2` for replication
`The dataset must contain a 'train' or 'test' split` Missing splits Ensure dataset has 'train' split for auto-splitting

Compatibility Notes

  • NumPy 2.x: Not compatible; root `requirements.txt` pins `numpy<2` due to PyTorch and ML library conflicts.
  • Local vs remote: Use `from_remote=False` for local `data/fingpt-*` directories; `from_remote=True` for Hub `FinGPT/fingpt-*`.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment