Download release/examples/run_dsh.py from AI45Research/ManipulationArena: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/AI45Research/ManipulationArena/resolve/main/release/examples/run_dsh.py
- Command line
-
hf download hf://datasets/AI45Research/ManipulationArena/release/examples/run_dsh.py
-
curl -L -o run_dsh.py https://huggingface.co/datasets/AI45Research/ManipulationArena/resolve/main/release/examples/run_dsh.py
1.11 kB
| """Run one frozen unit with DSH's native tools, events and attack gates.""" | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| import sys | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from manipulationarena.config import load_config | |
| from manipulationarena.__main__ import main | |
| def example(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--config", required=True, type=Path) | |
| parser.add_argument("--image", required=True) | |
| parser.add_argument("--unit-key", required=True) | |
| parser.add_argument("--output", required=True, type=Path) | |
| args = parser.parse_args() | |
| configuration = load_config(args.config, image=args.image) | |
| blue = configuration.roles["blue"] | |
| if blue.harness != "dsh" or blue.adapter: | |
| parser.error("This example uses roles.blue.harness=dsh with the built-in adapter") | |
| return main(["run", "--config", str(args.config), "--image", args.image, | |
| "--unit-key", args.unit_key, "--output", str(args.output)]) | |
| if __name__ == "__main__": | |
| raise SystemExit(example()) | |