Imp.Datasets (Imp v0.16.0)

Copy Markdown View Source

Local dataset loaders for examples, JSONL, CSV, GSM8K, HotPotQA, MATH, and Colors records.

Named loaders accept an existing local path; they do not download datasets. Source-checkout benchmark fixtures are fetched explicitly with the imp.benchmark.fetch Mix task.

Summary

Functions

Loads examples from a CSV file whose first record is the header.

Splits examples into {train, rest} at the :train fraction (default 0.8).

Functions

csv(path, input_keys, opts \\ [])

Loads examples from a CSV file whose first record is the header.

The file is read as RFC 4180 CSV: a quoted field may contain commas, doubled quotes and line breaks. A line break is CRLF, LF or a bare CR, a leading byte order mark is dropped, and blank lines are skipped. Each record becomes a map from the header's strings to the record's fields. A file that is not valid CSV, or a record whose field count differs from the header's, raises Imp.Datasets.Error naming the line the record starts on, with the start of the record that could not be read.

from_records(records, input_keys, opts \\ [])

gsm8k(path)

hotpotqa(path)

jsonl(path, input_keys, opts \\ [])

split(examples, opts \\ [])

Splits examples into {train, rest} at the :train fraction (default 0.8).

With shuffle: true (the default) the examples are shuffled with a seeded RNG before splitting. The shuffle is deterministic: the same examples and the same :seed (default 0) always produce the same split, so downstream consumers such as Imp.Optimizer.LabeledFewShot see the same trainset on every run. Pass a different seed: for a different permutation, or shuffle: false to preserve input order.