Datasets:
Download runner/agentgridworld/verifier.py from bytkim/AgentGridWorld-Hard: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/bytkim/AgentGridWorld-Hard/resolve/main/runner/agentgridworld/verifier.py
- Command line
-
hf download hf://datasets/bytkim/AgentGridWorld-Hard/runner/agentgridworld/verifier.py
-
curl -L -o verifier.py https://huggingface.co/datasets/bytkim/AgentGridWorld-Hard/resolve/main/runner/agentgridworld/verifier.py
1.16 kB
| """Replay evidence and keep scalar incentive separate from compliant success.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| import shutil | |
| from gridworld import verify | |
| def main(): | |
| p = argparse.ArgumentParser() | |
| p.add_argument('--config', type=Path, required=True) | |
| p.add_argument('--receipt', type=Path, required=True) | |
| p.add_argument('--output', type=Path, required=True) | |
| args = p.parse_args() | |
| args.output.mkdir(parents=True, exist_ok=True) | |
| try: | |
| result = verify(json.loads(args.config.read_text()), json.loads(args.receipt.read_text())) | |
| except Exception as exc: | |
| result = {'trace_valid': False, 'success': False, 'reported_reward': 0, 'error': str(exc)} | |
| if args.receipt.exists(): | |
| shutil.copyfile(args.receipt, args.output / 'episode.json') | |
| shutil.copyfile(args.config, args.output / 'task-config.json') | |
| (args.output / 'outcome.json').write_text(json.dumps(result, indent=2) + '\n') | |
| (args.output / 'reward.json').write_text(json.dumps({'reward': result['reported_reward']}) + '\n') | |
| if not result['trace_valid']: | |
| raise SystemExit(1) | |
| if __name__ == '__main__': | |
| main() | |