""" STEP 5 — SCORE A FINE-TUNED MODEL WITH THE SAME HARNESS AS THE MODEL TABLE. Loads the embedder harness (an evaluation harness that is not part of this release) unchanged and registers the fine-tuned model under the base's own pooling and query prompt (`self-tune.json`), then runs it exactly as any row of that table: the same pool, the same chunker and header, gold@1/5/10/18, semantic against the others. python evaluate.py --harness --model models/qwen3-0.6b-st \\ --pool pool-hard.json --out result.json [--name qwen3-0.6b-st] """ import argparse import importlib.util import json import os import sys def main(): ap = argparse.ArgumentParser() ap.add_argument("--harness", required=True) ap.add_argument("--model", required=True, help="a directory train.py wrote") ap.add_argument("--name", default="") a, rest = ap.parse_known_args() meta = json.load(open(os.path.join(a.model, "self-tune.json"))) name = a.name or os.path.basename(os.path.normpath(a.model)) spec = importlib.util.spec_from_file_location("embed_pool_probe", a.harness) probe = importlib.util.module_from_spec(spec) spec.loader.exec_module(probe) entry = (os.path.abspath(a.model), meta["pooling"], meta["prefix"]) # A newer harness also declares a document prefix per model; the self-tuned models take none, as their bases do. width = len(next(iter(probe.MODELS.values()))) probe.MODELS[name] = entry + ("",) * (width - len(entry)) # The harness treats a Qwen-family model's precision by its name; a fine-tuned Qwen keeps that behaviour. if meta["pooling"] == "last" and not name.startswith("qwen3"): probe.MODELS[f"qwen3-{name}"] = probe.MODELS.pop(name) name = f"qwen3-{name}" sys.argv = [a.harness, "--model", name, *rest] probe.main() if __name__ == "__main__": main()