Download experiments/harvest.py from fahadhafeezofficial/clsa-code: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/fahadhafeezofficial/clsa-code/resolve/main/experiments/harvest.py
- Command line
-
hf download hf://datasets/fahadhafeezofficial/clsa-code/experiments/harvest.py
-
curl -L -o harvest.py https://huggingface.co/datasets/fahadhafeezofficial/clsa-code/resolve/main/experiments/harvest.py
1.34 kB
| # Copyright (c) 2026 CLSA contributors | |
| # SPDX-License-Identifier: MIT | |
| """Harvest activations and LM candidate scores for one or all backbones. | |
| Usage: | |
| PYTHONPATH=src python experiments/harvest.py --model primary | |
| PYTHONPATH=src python experiments/harvest.py --all | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) | |
| from clsa.transcoder.harvest import harvest # noqa: E402 | |
| from clsa.util import load_config, write_result # noqa: E402 | |
| def main() -> None: | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--model", default="primary", help="primary|secondary|efficiency_probe|a HF id") | |
| ap.add_argument("--all", action="store_true") | |
| ap.add_argument("--limit", type=int, default=None) | |
| args = ap.parse_args() | |
| cfg = load_config("transcoder") | |
| names = cfg["backbones"] | |
| targets = list(names.values()) if args.all else [names.get(args.model, args.model)] | |
| out = [] | |
| for name in targets: | |
| info = harvest(name, cfg, limit=args.limit) | |
| print(json.dumps(info, indent=2), flush=True) | |
| out.append(info) | |
| path = write_result("harvest", {"runs": out}, config=cfg, seed=int(cfg.get("seed", 0))) | |
| print("wrote", path) | |
| if __name__ == "__main__": | |
| main() | |