jev-skills / code /README.md
qmichalwarda's picture
code README: decider hook example
3328ee4 verified
|
Raw History Blame Contribute Delete
3.1 kB

Jev Skills code

Standalone Python (3.10+). Reading parquet needs pandas and pyarrow; rebuilding rules7.py also needs huggingface_hub. No jevswarm imports.

file what
score.py the scorer (load_items, score, evaluate, oracle / uniform baselines)
spatial_bench.py builds JevSpatial v1 (games_spatial/* 1-5), a few seconds, no network
play_bench.py closed-loop game simulations (Snake, Dino, Breakout, Whac-A-Mole) driven by any decider: --decider python --decider-target module:factory, --decider http --url ... (any server speaking the System One wire format, POST /v1/systemone with {"model", "state", "questions"}), oracle, random
rules7.py builds Jev Rules-7 (downloads the pinned ShARC dev and patent test files), uses drop_keys.json (rule texts excluded from the ShARC selection)
browser_bench.py builds agents/browser
bench_common.py, rows.py helpers; rows.py maps generator skills to category/skill and licence ids
docs/ notes on JevSpatial and Rules-7

Rebuild the items

python spatial_bench.py --out out/        # jevspatial_v1_items.json.gz (2,040 items)
python rules7.py --out out/               # rules7_v1_items.json.gz     (3,440 items; needs network)
python -c "import browser_bench as b; items, info = b.build(0); print(len(items))"   # 600 items

The output is deterministic and byte-identical to the published rows for these three parts (checked when the dataset was built). The other skills (tools, agent_action, chess, small_games, safety, judging, grounding) are shipped as data only; their sources and pinned revisions are in the dataset card.

Score a model

import score

def decide(state, questions):
    # call your model; return one answer per question key
    return {k: ({"noul": 0.5} if q["type"] == "noul" else
                {"probabilities": {o: 1 / len(q["criteria"]) for o in q["criteria"]}})
            for k, q in questions.items()}

items = score.load_items("../data/rules.parquet")        # or parquet / jsonl / json.gz
print(score.evaluate(decide, items)["pooled_by_category"])

For score questions return probabilities keyed by the level strings in criteria (or their indices). python score.py ../data/rules.parquet --baseline oracle prints 1.0 for every skill.

Closed-loop games with your own decider

play_bench.py plays Snake, Dino, Breakout and Whac-A-Mole with any decider. A Python hook, my_decider.py:

def make_decider():
    def decide(state, questions):   # uniform guesser
        return {k: {"noul": 0.5} for k in questions}
    return decide

python play_bench.py --decider python --decider-target my_decider:make_decider --decisions 100. The factory may also return an object with a .decide(state, questions) method. Any server speaking the System One wire format works with --decider http --url http://HOST:PORT (it posts {"model", "state", "questions"} to /v1/systemone); --decider oracle (always the best move) and --decider random are references.