Download tasks/afx-e2-s09/tests/grade.py from openenvforge/3ambench: direct link, hf CLI and curl.
- Browser
- Download file 892 Bytes
-
https://huggingface.co/datasets/openenvforge/3ambench/resolve/main/tasks/afx-e2-s09/tests/grade.py
- Command line
-
hf download hf://datasets/openenvforge/3ambench/tasks/afx-e2-s09/tests/grade.py
-
curl -L -o grade.py https://huggingface.co/datasets/openenvforge/3ambench/resolve/main/tasks/afx-e2-s09/tests/grade.py
892 Bytes
| #!/usr/bin/env python3 | |
| """Entry point: the grader package lives next to this file (python3 -I drops the script dir).""" | |
| import argparse | |
| import json | |
| import os | |
| import sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from afgrader.xgrade import ExpertGrader # noqa: E402 | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| for k in ("--workspace", "--spec", "--hidden", "--out"): | |
| ap.add_argument(k, required=True) | |
| ap.add_argument("--details") | |
| a = ap.parse_args() | |
| with open(a.spec) as fh: | |
| spec = json.load(fh) | |
| keys, details = ExpertGrader(spec, a.hidden).grade(a.workspace) | |
| with open(a.out, "w") as fh: | |
| json.dump(keys, fh) | |
| if a.details: | |
| with open(a.details, "w") as fh: | |
| json.dump(details, fh, indent=1, default=str) | |
| print(json.dumps(keys)) | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |