Ster/Docs

ster decisions fetch

Read rows of a Hugging Face classification dataset into labelled decisions: one choice question per row, with the dataset's own class names as the options and its label as the answer.

Invocation and purpose#

text
ster decisions fetch --dataset <OWNER/NAME> --config <CONFIG> --split <SPLIT> --text-field <COLUMN> --label-field <COLUMN> --question-id <ID> --instructions <TEXT> --count <COUNT> --output <OUTPUT> [--offset <OFFSET>]

Reads --count rows of the named dataset through the Hub's datasets-server rows route, a hundred at a time, and writes the labelled-decision document `ster calibrate`, `ster tune decide` and `ster decisions benchmark` read. Every row becomes one example whose state is the text column and whose one choice question lists the label column's class names as options; the row's label, an index or a name, is the answer. Nothing about the dataset is assumed: its configuration, split and both column names are named by the caller, because a guessed column silently trains on the wrong text.

Inputs and options#

InputRequiredMeaning
--dataset <OWNER/NAME>yesThe dataset id on the Hub, such as fancyzhx/ag_news.
--config <CONFIG>yesThe dataset configuration the rows are read from.
--split <SPLIT>yesThe split the rows are read from, such as train or test.
--text-field <COLUMN>yesThe column holding the text each row is about; it becomes the example's state.
--label-field <COLUMN>yesThe class-label column. Its named classes become the options; a column that is not a class label with two to twenty-six names is refused.
--question-id <ID>yesThe id the one question is asked under in every example.
--instructions <TEXT>yesThe question asked about every text.
--count <COUNT>yesRows to read; above zero.
--offset <OFFSET>noRows to skip from the start of the split; 0 by default.
--output <OUTPUT>yesWhere the labelled decisions are written; missing parent directories are created.

Output and state#

Prints an object with path and report. The report carries dataset, config, split, the options read from the label column, requested, rows read, examples kept, skipped — rows whose text was empty or whose label named no class — and label_counts, how many examples carry each label, so an ordered or lopsided slice is visible before anything trains on it. Progress on stderr reads fetching rows <from>..<to> of <dataset>.

Refusals#

  • A missing --config, --split, --text-field, --label-field, --question-id or --instructions is refused by clap with exit 2; none has a built-in value.
  • fetch needs a row count above zero; a fetched question needs an id and instructions when either is blank.
  • the datasets server answered <status> for <dataset>: <sentence>, carrying the server's own sentence; failed to reach the datasets server: <kind>; the datasets server returned a page that is not JSON.
  • the dataset has no column named '<label-field>'; column '<label-field>' is not a class label with at least two named classes; column '<label-field>' has <n> classes; Ster labels at most 26.
  • no row of <dataset> carried both a text and a known label when every row was skipped, and the labelled-decision validation refusals of `ster calibrate` when the set they form is invalid.