inif.converters.evaleval
Targets the instance_level_eval_0.2.2 schema used by the evaleval/EEE_datastore HuggingFace dataset. The HF entry point requires the evaleval extra (pip install "inif[evaleval]"); local JSON / JSONL conversion does not. See the evaleval converter guide for the field-mapping table, scoring, and metadata promotion rules.
Entry points
from_instance_records
Convert a list of EEE instance records into an :class:InifDocument.
def from_instance_records(
records: list[dict],
aggregate: dict | None = None,
*,
tokenizer: Any = "auto",
include_messages: bool = True,
deduplicate: bool = True,
min_sequence_length: int = 5,
tag_chat_roles: bool = True,
tag_generated: bool = True,
tag_reasoning: bool = True,
) -> InifDocumentrecordslist[dict]-
Instance-level records conforming to
instance_level_eval_0.2.2. aggregatedict | None-
Optional aggregate record (
eval.schema.json). Contributes model developer info, eval library version, and metric config to document-level metadata. tokenizerAny-
One of:
"auto"(default) orNone— auto-loadAutoTokenizer.from_pretrainedbased on each record’smodel_id(with aggregate fallback). Raises if the id is missing or the tokenizer cannot be loaded (closed-source ids likeopenai/gpt-4will hit this).- a model id string — loaded via
AutoTokenizer.from_pretrained; warns if the resolved id disagrees with the source records’model_id. - a tokenizer instance — used as-is; warns if its
name_or_pathdisagrees with the source records’model_id.
Tokens are a load-bearing invariant of every INIF sample, so there is no way to opt out of tokenization — every option here yields a usable tokenizer or raises.
include_messagesbool-
Include message texts on each Sample.
deduplicatebool-
Run sequence deduplication over the produced samples.
min_sequence_lengthint-
Minimum length for common-sequence detection.
tag_chat_rolesbool-
Add role annotations via character-span matching.
tag_generatedbool-
Annotate the last assistant message’s tokens with
"generated". tag_reasoningbool-
Annotate tokens belonging to each turn’s
reasoning_tracespan. Matching tokens getreasoning+assistant; tokens within the span whose id appears intokenizer.all_special_idsadditionally gettemplate. Best-effort: silently skipped when the token stream doesn’t round-trip cleanly to the formatted chat template or the reasoning text can’t be located.
from_eval_json
Load EEE JSON files from disk and convert.
aggregate_path is optional; instances_path can be either a single JSON file containing a list of records, or a .jsonl file with one record per line.
def from_eval_json(
aggregate_path: str | Path | None,
instances_path: str | Path,
**kwargs: Any,
) -> InifDocumentaggregate_pathstr | Path | Noneinstances_pathstr | Path**kwargsAny
from_hf_dataset
Convert an EEE config from the HuggingFace datastore.
def from_hf_dataset(
config: str,
split: str = "samples",
*,
aggregate_config: str | None = None,
aggregate_split: str = "train",
repo: str = "evaleval/EEE_datastore",
limit: int | None = None,
revision: str | None = None,
**kwargs: Any,
) -> InifDocumentconfigstr-
A config name from
evaleval/EEE_datastore, typically one ending in_samples(e.g."theory_of_mind_samples"). splitstr-
Dataset split for instance records (usually
"samples"). aggregate_configstr | None-
Optional paired aggregate config (without
_samplessuffix). When provided, the first row is used as the aggregate. aggregate_splitstr-
Split name for the aggregate config (defaults to
"train"). repostr-
HuggingFace repo id (override for testing).
limitint | None-
Maximum number of records to convert (
None= all). revisionstr | None-
HuggingFace dataset revision / commit.
**kwargsAny-
Forwarded to :func:
from_instance_records.