Download example_read.py from moddemod/xarch: direct link, hf CLI and curl.
- Browser
- Download file 800 Bytes
-
https://huggingface.co/datasets/moddemod/xarch/resolve/main/example_read.py
- Command line
-
hf download hf://datasets/moddemod/xarch/example_read.py
-
curl -L -o example_read.py https://huggingface.co/datasets/moddemod/xarch/resolve/main/example_read.py
800 Bytes
| import json | |
| import sys | |
| from pathlib import Path | |
| root = Path(sys.argv[1] if len(sys.argv) > 1 else ".") | |
| def records(name): | |
| with (root / name).open(encoding="utf-8") as stream: | |
| for line in stream: | |
| yield json.loads(line) | |
| pair = next(records("train.jsonl")) | |
| print("Positive pair:", pair["query_arch"], "->", pair["positive_arch"]) | |
| print("Query excerpt:", pair["query"][:200]) | |
| functions = list(records("test.functions.jsonl")) | |
| targets = [f for f in functions if f["arch"] == "x64"] | |
| gold_groups = {f["group_id"] for f in targets} | |
| queries = [f for f in functions if f["arch"] == "arm64" and f["group_id"] in gold_groups] | |
| print("arm64 -> x64:", len(queries), "eligible queries;", len(targets), "candidates") | |
| print("Encode text; same group_id indicates a labeled relevant candidate.") | |