transformer_lens.model_bridge.sources.inspect.intervention module

Validate intervention specs and key them by <layer>:<kind> for the provider.

Our HF provider applies interventions as forward-hook affine ops at the residual/ attn/mlp boundaries, so the full vocabulary works. resid_mid is derived (capture-only), so intervening on it is rejected.

transformer_lens.model_bridge.sources.inspect.intervention.build_interventions(intervene: Mapping[str, Any], supported_hook_points: frozenset[str]) dict[str, dict[str, Any]]

Validate specs and return {wire_key: spec} for the provider to apply.

Rejects callables (remote drivers take specs, not callbacks), bad ops, unknown or unsupported hooks, and the capture-only resid_mid.