dataset
genlm.eval.domains.json_schema.dataset
JSONSchemaBenchInstance
JSONSchemaBenchDataset
Bases: Dataset[JSONSchemaBenchInstance]
Dataset for JSON evaluation using the JSONSchemaBench dataset.
Source code in genlm/eval/domains/json_schema/dataset.py
__init__(schemas, tasks, unique_ids)
Initialize the dataset with a list of regex patterns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schemas
|
list[str]
|
The JSON schemas to evaluate. |
required |
tasks
|
list[str]
|
The task name for each schema. |
required |
unique_ids
|
list[int]
|
The unique id for each schema. |
required |
Source code in genlm/eval/domains/json_schema/dataset.py
from_tasks(tasks, split='val')
classmethod
Load tasks from a list of tasks in the JSONSchemaBench dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tasks
|
list[Task]
|
The tasks to evaluate. |
required |
split
|
str
|
The split to load. Defaults to "val". |
'val'
|
Returns:
Type | Description |
---|---|
JSONSchemaBenchDataset
|
Dataset initialized with schemas from the tasks. |
Source code in genlm/eval/domains/json_schema/dataset.py
__iter__()
Iterate over JSON schemas.
Returns:
Type | Description |
---|---|
Iterator[JSONSchemaBenchInstance]
|
Iterator over JSON schema instances. |
Source code in genlm/eval/domains/json_schema/dataset.py
schema
property
Get the schema class for this dataset.
Returns:
Type | Description |
---|---|
type[JSONSchemaBenchInstance]
|
The Pydantic model class for JSON schema instances. |