nemo_automodel.components.datasets.decision.gs1
nemo_automodel.components.datasets.decision.gs1
Native GS1 training lines as single-question SystemOne records.
A native line is {"request": {"state", "questions", optional "id"}, "targets": {question_id: {"candidate_ids", "distribution"}}}. Its request is a SystemOne request, so a record keeps the state and question unchanged and adds
the target distribution as soft_labels. Reading a record is the model’s business (the GS1 decision reader); this
module only converts and validates the data.
Module Contents
Functions
Data
API
Whether a request state holds image or video blocks (top-level list items).
Parameters:
The state of a request.
Returns: bool
True for a list state with an {"type": "image"} or {"type": "video"} item.
Convert one native GS1 training line into validated single-question SystemOne records.
Parameters:
A native line (see the module docstring).
Line number, used for the record IDs when the request has no id.
Returns: list[dict[str, Any]]
One record per question, with ID "<request id>/<question id>": the request’s state and that question, its
Raises:
ValueError: If the state is null (not a GS1 request), a record is not a valid SystemOne record, the targets do not name exactly the request’s questions and each question’s candidates, or a distribution is not finite, nonnegative and normalized.