"""Harness B: route a scene's on-disk explicit spatial code -- as TEXT, no video frames -- to all three models, for every VSI-Bench question. Reuses harness.A's model registry/adapters and fixed generation protocol exactly; only what is fed to the model differs (spatial-code text instead of frame images). Results are written in the identical per-question JSON shape harness.A uses, so B's records are directly comparable to A's -- the frame-provenance fields are simply replaced with spatial-code provenance fields (see harness.B.run._build_record). """ from __future__ import annotations import os from pathlib import Path from encoder.config import DEPTH_VARIANTS, TRACKING_MODES from harness.A import ( DO_SAMPLE, JSONL, MAX_NEW_TOKENS, MODEL_PATHS, TEMPERATURE, WORKSPACE_ROOT, ) # The harness consumes the encoder's fixed explicit spatial-code output. SPATIAL_CODE_FORMATS = ("explicit",) DEFAULT_SPATIAL_CODE_FORMAT = "explicit" # Same vocabulary as inference.SAM3_FRAME_SELECTIONS / harness.A.FRAME_SELECTIONS -- # which raw video sampling the on-disk spatial code was itself built from. INPUT_SELECTIONS = ("uniform", "selective") DEFAULT_INPUT_SELECTION = "uniform" # Same depth/tracking vocabulary encoder.config uses to lay out spatial codes on disk -- # real sweepable axes here too (see sweep.py's --depths/--trackings), not fixed # constants; DEFAULT_DEPTH/DEFAULT_TRACKING are just the single-value default when a # caller doesn't ask to sweep them, matching this workspace's shipped production config. DEFAULT_DEPTH = "metric" DEFAULT_TRACKING = "tracking" FRAMES_PER_VIDEO = int(os.environ.get("VSI_HARNESS_B_FRAMES_PER_VIDEO", "32")) # One JSON per question, matching harness.A's layout: # results/B////////.json RESULTS_DIR = Path(os.environ.get("VSI_HARNESS_B_RESULTS_DIR", "/root/results/B"))