Skip to main content
The data module provides dataset loading, processing, and registry management for training and evaluation.

Dataset

PyTorch-compatible dataset class for rLLM.

Constructor

list[dict[str, Any]]
List of dictionaries containing dataset examples.
str | None
Optional name for the dataset.
str | None
Optional split name (e.g., “train”, “test”, “val”).

Methods

len

Get the number of examples.

getitem

Get an item by index.

get_data

Get the raw dataset list.

repeat

Repeat the dataset n times.
int
Number of times to repeat the dataset.

shuffle

Shuffle the dataset.
int | None
Random seed for reproducibility.

select

Select a subset of the dataset.
list[int] | range
Indices to select.

load_data

Load dataset from a file.
str
Path to dataset file (.json, .jsonl, .parquet).

DatasetRegistry

Global registry for managing datasets.

Methods

register_dataset

Register a dataset.
str
Dataset name.
str
Split name (“train”, “test”, “val”).
str
Absolute path to dataset file.

load_dataset

Load a registered dataset.
str
Dataset name.
str
Split name.
Dataset | None
Loaded dataset, or None if not found.

list_datasets

List all registered datasets.
dict
Dictionary mapping dataset names to splits and paths.

Example: Creating a Dataset


Example: Loading from File


Example: Dataset Operations


Example: Registering Datasets


Example: Loading Registered Datasets


Example: Preparing Data for Training


Example: Using with Trainer


Dataset File Formats

Supported formats:

JSON

JSONL