protomotions.agents.peft.utils.adapter_state module#

State-dict filtering for PEFT adapter checkpoints.

High-level actor and agent code should talk in terms of “save adapter” and “load adapter”. This module owns the low-level key rules that decide which entries are adapter/task state and which entries belong to the frozen prior, critic, or training-only scaffolding.

protomotions.agents.peft.utils.adapter_state.strip_actor_prefix(key)[source]#

Accept both model-level keys and actor-local keys.

protomotions.agents.peft.utils.adapter_state.is_adapter_state_key(key)[source]#

Return True for keys that belong in a slim PEFT checkpoint.

protomotions.agents.peft.utils.adapter_state.contains_adapter_state(state_dict)[source]#

Return True when a checkpoint contains at least one adapter key.

protomotions.agents.peft.utils.adapter_state.build_adapter_state_dict(module)[source]#

Build an adapter-only state dict from a live actor module.

protomotions.agents.peft.utils.adapter_state.load_adapter_state_dict(module, state_dict, *, strict=True)[source]#

Load adapter/task keys into module without touching frozen prior state.