JOB135 REPRODUCTION AND OFFLINE INFERENCE

Run the PowerShell examples from the USS checkout root, where135 and134 are
siblings. Keep134 unchanged: its environment and pinned palette are read-only
inputs here. Do not execute these commands in the archived original135 output
folders. Training and some utility scripts overwrite their chosen outputs.

Requirements

Training/evaluation: Python with NumPy and PyTorch. The recorded runs used
PyTorch2.7.1+cu126, CUDA12.6 and an NVIDIA GeForce RTX3070Ti Laptop GPU. CPU runs
are possible by selecting a CPU device in a new reproduction configuration,
but that is a documented environment change and may not reproduce floating-point
bytes exactly. The existing134/.venv/Scripts/python.exe already has these tools.
No installation or external model download is needed in this checkout.

Portable neural inference: Python+NumPy alone, using tools/field_model_v2.py and
tools/tensorize.py. PyTorch import is optional for inference. Pillow is optional
for PNG rendering. JavaScript inference and UI checks use Node's built-ins.
The transport codec's JavaScript dependencies are bundled under common; retain
that directory when copying transport tools. Browser operation needs no Python
or Node: open publication/index.html with its sibling files intact.

Create a fresh reproduction root

These commands refuse an existing destination. Choose a different new name if
135-reproduce already exists. They copy inputs and tools, never delete or move
the original records. The sibling134 path remains available to the evaluator.

  $studyRoot = (Resolve-Path .\135).Path
  $reproRoot = Join-Path (Get-Location) '135-reproduce'
  if (Test-Path -LiteralPath $reproRoot) { throw 'Choose a new reproduction directory name.' }
  New-Item -ItemType Directory -Path $reproRoot | Out-Null
  foreach ($part in @('tools','data','protocol','common','publication','setup')) {
      Copy-Item -LiteralPath (Join-Path $studyRoot $part) -Destination (Join-Path $reproRoot $part) -Recurse
  }
  New-Item -ItemType Directory -Path (Join-Path $reproRoot 'runs') | Out-Null
  New-Item -ItemType Directory -Path (Join-Path $reproRoot 'analysis') | Out-Null
  $studyPython = (Resolve-Path .\134\.venv\Scripts\python.exe).Path

The copied protocol files document the original study, not a new preregistration.
For a strictly preserved audit copy, keep those originals and write any new
environment/configuration notes under a different filename in the fresh root.

Reproduce implementation checks and all four fixed-budget runs

  & $studyPython (Join-Path $reproRoot 'tools/test_field_model.py')
  & $studyPython (Join-Path $reproRoot 'tools/test_evaluate_field.py')
  & $studyPython (Join-Path $reproRoot 'tools/train_field.py') --root $reproRoot --mode full --output (Join-Path $reproRoot 'runs/full')
  & $studyPython (Join-Path $reproRoot 'tools/train_field.py') --root $reproRoot --mode colours-only --output (Join-Path $reproRoot 'runs/colours-only')
  & $studyPython (Join-Path $reproRoot 'tools/train_field_v2.py') --root $reproRoot --mode full --output (Join-Path $reproRoot 'runs/full-v2')
  & $studyPython (Join-Path $reproRoot 'tools/train_field_v2.py') --root $reproRoot --mode colours-only --output (Join-Path $reproRoot 'runs/colours-only-v2')

Every run reads only its train.npz, development.npz and config.json numeric input
files. The supplied config fixes2400 updates, batch16 and seed135001. Checkpoint
selection uses the earliest lowest development loss at update1 and multiples
of400. Initial snapshots, history, exports, hashes and run manifests are saved.
V2 has a declared source-count reference and initial zero-delta bias2. It is not
the same architecture as the preserved v1 absolute-count model.

Release the reserved benchmark only after all four manifests are complete

  & $studyPython (Join-Path $reproRoot 'tools/evaluate_field.py') --root $reproRoot --device cuda --batch-size 16 --full-run full-v2 --control-run colours-only-v2 --run-test

The evaluator pins checkpoints before loading the600-example test and also
reports v1 descriptively. It refuses to replace an existing test-results.json.
To repeat a scoring check, use another new reproduction root. Alternatively,
first COPY the entire completed analysis directory to a uniquely named archive,
verify the copy, and use a new empty analysis directory in a separate workspace.
Do not delete or silently replace the first report or its test-pin/per-example
records. This benchmark is already exposed; a new model study needs new held-out
examples, not repeated tuning on this report.

Evaluate the previously frozen paired interventions after checkpoints are fixed

  & $studyPython (Join-Path $reproRoot 'tools/evaluate_interventions_v2.py') --weights (Join-Path $reproRoot 'runs/full-v2/weights.npz') --mode full --output (Join-Path $reproRoot 'analysis/interventions-full-v2.json')
  & $studyPython (Join-Path $reproRoot 'tools/evaluate_interventions_v2.py') --weights (Join-Path $reproRoot 'runs/full-v2/initial.npz') --mode full --output (Join-Path $reproRoot 'analysis/interventions-initial-v2.json')
  & $studyPython (Join-Path $reproRoot 'tools/evaluate_interventions_v2.py') --weights (Join-Path $reproRoot 'runs/colours-only-v2/weights.npz') --mode colours-only --output (Join-Path $reproRoot 'analysis/interventions-colours-only-v2.json')

These scripts resolve their data root from their own copied location and verify
the fixture hash. Do not pass --freeze again: use the retained pre-training
fixtures. For faster small CPU matrix operations, setting OPENBLAS_NUM_THREADS,
OMP_NUM_THREADS and MKL_NUM_THREADS to1 in the current process is optional.

Run portable offline Python inference on an existing raw field

This example writes a new result file under the fresh reproduction analysis
directory. Replace the source path with a valid field if the named artwork does
not exist in your checkout. A field path is structured JSON, not a rendered PNG.

  $env:HABITAT_REPRO_ROOT = $reproRoot
  $env:HABITAT_SOURCE = (Resolve-Path '.\135\artworks\COLOUR-ROOM-S0\COLOUR-ROOM-S0.json').Path
@'
import json, os, sys
from pathlib import Path
root = Path(os.environ['HABITAT_REPRO_ROOT'])
sys.path.insert(0, str(root/'tools'))
from field_model_v2 import NumpyFieldModel
from tensorize import field_to_batch, decode_prediction
palette = json.loads((root/'data/palette.json').read_text())
field = json.loads(Path(os.environ['HABITAT_SOURCE']).read_text())
batch, audit = field_to_batch(field, palette)
model = NumpyFieldModel(root/'runs/full-v2/weights.npz')
result = decode_prediction(model.forward(batch), batch, palette)
result['input_audit'] = audit
destination = root/'analysis/offline-response.json'
if destination.exists(): raise FileExistsError(destination)
destination.write_text(json.dumps(result, indent=2))
print(destination)
'@ | & $studyPython -

The result contains field, raw predictions, repairs and input canonicalization
audit. Set the administrative parent hash explicitly when making a linked
conversation. Repairs enforce grammar and must not be counted as learned validity.

Check the original published JavaScript weights against saved NumPy fixtures

  node .\135\tools\js_parity_check.cjs .\135\setup\trained-parity-v2 .\135\runs\full-v2\weights.js (Join-Path $reproRoot 'analysis/rechecked-js-parity.json')
  node (Join-Path $reproRoot 'tools/static_ui_check.cjs')

The parity command checks all heads, colour argmax and decoded fields. The static
UI command writes only inside the copied publication directory. Neither is a
physical browser, phone, visual-layout or live-host test. The copied publication
still carries the original fixed weights until you deliberately replace model.js
with a newly reproduced weights.js and regenerate matching parity expectations.

The original data generator can be inspected in tools/make_exercises.py. It
reads the pinned palette and retained graph from sibling134; it does not read
definitions. For exact experiment reproduction, use the saved hashed NPZ files
instead of overwriting them through regeneration. PNG generation and transport
recovery are separate presentation checks, not neural-training requirements.
