File size: 1,150 Bytes
9ee3361 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
"""Python State Changes"""
from random import choice, shuffle
import datasets
import json
_DESCRIPTION = """\
Python state changes from a single line of code.
"""
_FEATURES = datasets.Features(
{
"start": datasets.Value("string"),
"code": datasets.Value("string"),
"end": datasets.Value("string"),
}
)
_LICENSE = "MIT License"
class PythonStateChanges(datasets.GeneratorBasedBuilder):
"""Program Synthesis dataset from dreamcoder."""
VERSION = datasets.Version("1.1.0")
BUILDER_CONFIGS = [
datasets.BuilderConfig(version=VERSION),
]
DEFAULT_CONFIG_NAME = "default"
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=_FEATURES,
license=_LICENSE,
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN
),
]
def _generate_examples(self):
with open('data.jsonl', 'r', encoding="utf-8") as f:
for id_, line in enumerate(f):
yield id_, json.loads(line)
|