protomotions.agents.peft.sft_agent module#

SFT agent for PEFT adapters on a frozen discrete-token GPC prior.

class protomotions.agents.peft.sft_agent.DiscretePriorPEFTSFTAgent(fabric, env, config, root_dir=None)[source]#

Bases: DiscretePriorPEFTSetupMixin, PretrainedModulesMixin, SupervisedAgent

Train a discrete-prior PEFT adapter with target-token supervision.

The model owns the expert labeling path through the frozen target encoder; the generic supervised loop stores those labels and applies the configured supervised loss during optimization.

__init__(fabric, env, config, root_dir=None)[source]#
property has_critic#

Whether this agent has a value critic.

Base agents do not assume critic ownership; PPO-style subclasses define that contract explicitly from their model config. Algorithm code should branch on this property instead of probing for critic attributes.

create_model()[source]#
create_optimizers(model)[source]#
get_state_dict(state_dict)[source]#

Get complete state dictionary for checkpointing.

Collects all agent state including model weights, training progress, and normalization statistics into a single dictionary for saving.

Parameters:

state_dict – Existing state dict to update (typically empty dict).

Returns:

Updated state dictionary containing all agent state.