protomotions.utils.inference_utils module#

Deriving the inference view from the training bundle.

Inference, export and --full-eval all read the one saved (training) bundle and derive their view at load through derive_inference_configs(), in one order: framework defaults (apply_inference_defaults on each config class), then overrides, then the recipe’s and --inference-config’s hooks. Nothing is baked at train time; the save path dry-runs this derivation so a broken hook fails during training, not at inference.

protomotions.utils.inference_utils.inference_defaults(configs)[source]#

The framework’s inference view, before any override or recipe hook.

A fixed sequence, not a getattr scan: each config class says what inference changes about it, and the sensors switch to their clean (noise-free) read.

protomotions.utils.inference_utils.derive_inference_configs(training, args, overrides, hooks)[source]#

The inference view of a training bundle: defaults, overrides, then hooks.

Works on a deep copy, so the training bundle is never mutated. A hook that silently undoes an override is refused by name. The derived view is what inference runs, what export reads and what --full-eval evaluates.

protomotions.utils.inference_utils.recipe_hooks(checkpoint_dir, inference_config)[source]#

The inference hooks to run, in order: the recipe’s, then --inference-config.

The recipe’s hook is loaded from the experiment_config.py saved beside the checkpoint (so editing a recipe changes existing checkpoints’ inference view, and a run directory without it is incomplete).