Chapter 9 — Minimal Tracker Integration
Inline tracker integration
Create the tracker once, poll its schedule after training steps, extract
when requested, and flush before exiting. step should count optimizer
steps. The following is the integration shape; the spec, model, and
training loop are supplied by your application.
from iris.inline import IrisTracker
tracker = IrisTracker(
output_dir="/path/to/models/my-run",
spec_dict=my_spec,
probes_path="my_model.probes.json",
)
tracker.set_optimizer(optimizer)
for step in range(n_steps):
# Your existing forward, backward, and optimizer step.
# Keep your model, objective, and training data unchanged.
tracker.report_loss(loss, step=step)
if tracker.should_extract(step):
tracker.extract(model, step=step)
tracker.flush()
The optimizer in set_optimizer must be the one whose .step() actually
runs. If your loop clears gradients before extraction, optimizer
registration is needed for supported gradient-dependent readings; otherwise
extract before zero_grad(). Read the recorded coverage and the log when
gradient data is absent, including early or unscheduled frames.
Reporting outcomes
report_loss is optional: it supplies a trainer-derived loss curve.
Use report_metrics for declared training/held-out loss and accuracy,
and report_signal for your own scalar observables. These reported
values remain distinct from IRIS™'s probe and internal measurements.
See Chapter 25 for interfaces and metric definitions.
Preserve training behavior
The tracker is an observer. It does not write your parameters or gradients. Measurement calls can run model forwards and optional callbacks, so keep callbacks side-effect-free and give them a fixed evaluation batch rather than the training iterator. Custom hooks and model behavior still need review in your integration. Compare a short instrumented run against your baseline on the hardware and determinism settings you actually use.
Check the first capture
Before committing a long job, confirm that iris.log records successful
frames and that the .iris bundle grows. Open the run in the Bench and
check model identity, steps, domains, and intended channels. Training
continuing normally is not evidence that capture succeeded.
Use should_extract(step) every optimizer step for live schedule controls.
The legacy every_n_steps argument is ignored; use supported constructor
settings and runtime controls. Re-extracting an already
measured step does not create another frame.
