fit_world

Contents

fit_world#

hybrid_aif.train.fit_world(
system,
params,
learn_state,
batch,
*,
key,
lr=0.0001,
lr_by_slot=None,
clip=1000.0,
roles=None,
return_states=False,
**loss_kwargs,
)[source]#

One gradient step of world-model learning: (params, learn_state, losses).

With return_states=True a fourth element follows: the posterior RSSMState of the forward pass (pre-step parameters, gradient stopped). roles goes to assemble(), **loss_kwargs to world_loss(). Pure, jit-able, resumable from its own return value; learn_state starts as system.init_learn_state(params) and None raises.

lr may be traced. clip is one global-norm clip over the whole model (None disables it), summed in PART_FIELDS order; each slot then steps through its own LearnState entry. lr_by_slot is System.learn’s rate grammar: a static 0.0 skips that slot’s step at trace time, a traced zero multiplies it. A frozen slot is not differentiated, holds no optimizer state, and comes back bitwise.