Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
json
Languages:
English
Size:
10K - 100K
License:
Download generator/common.py from DavidHatley/system-one-mini-data: direct link, hf CLI and curl.
- Browser
- Download file 2.27 kB
-
https://huggingface.co/datasets/DavidHatley/system-one-mini-data/resolve/main/generator/common.py
- Command line
-
hf download hf://datasets/DavidHatley/system-one-mini-data/generator/common.py
-
curl -L -o common.py https://huggingface.co/datasets/DavidHatley/system-one-mini-data/resolve/main/generator/common.py
2.27 kB
| import hashlib | |
| import json | |
| import os | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| os.environ.setdefault('HF_HOME', str(ROOT / '.cache/huggingface')) | |
| os.environ.setdefault('TOKENIZERS_PARALLELISM', 'false') | |
| os.environ.setdefault('OMP_NUM_THREADS', '4') | |
| os.environ.setdefault('MPLCONFIGDIR', str(ROOT / '.cache/matplotlib')) | |
| SCHEMA = { | |
| 'task_complete': {'prompt': 'Has the task been successfully completed?', 'options': ['false', 'true']}, | |
| 'should_retry': {'prompt': 'Should the same failed action be retried without changing it?', 'options': ['false', 'true']}, | |
| 'failure_source': {'prompt': 'What is the source of the original reproduced failure?', 'options': ['code', 'environment', 'test', 'dependency', 'unknown']}, | |
| 'next_action': {'prompt': 'What action should the agent take next under the diagnostic policy?', 'options': ['inspect_code', 'rerun_tests', 'inspect_environment', 'revert_change', 'escalate']}, | |
| 'evidence_sufficient': {'prompt': 'Does exactly one controlled intervention identify the original failure source?', 'options': ['false', 'true']}, | |
| } | |
| POLICY = ('Controlled trials each start from the same failing snapshot and change only the named component. ' | |
| 'Exactly one repair clearing the original failure identifies its source; zero or multiple clearing repairs mean unknown. ' | |
| 'Task complete means latest checks pass AND acceptance was confirmed. Retry unchanged only if incomplete, ' | |
| 'the temporary blocker has cleared, and no unchanged retry already failed. Next action: completed => escalate (handoff); ' | |
| 'otherwise if retry is warranted or latest checks pass => rerun_tests; ' | |
| 'otherwise a code cause with rollback authorized => revert_change; code or test => inspect_code; ' | |
| 'environment or dependency => inspect_environment; unknown => escalate.') | |
| def read_rows(split, root='data/v0'): | |
| return [json.loads(line) for line in (Path(root) / f'{split}.jsonl').read_text().splitlines()] | |
| def save_json(path, data): | |
| path = Path(path) | |
| path.parent.mkdir(parents=True, exist_ok=True) | |
| path.write_text(json.dumps(data, indent=2, allow_nan=False) + '\n') | |
| def digest(path): | |
| return hashlib.sha256(Path(path).read_bytes()).hexdigest() | |