nemo_automodel.components.models.praxis.state_dict_adapter
nemo_automodel.components.models.praxis.state_dict_adapter
Weight-name conversion between the Praxis checkpoint and the Automodel module tree.
The checkpoint (model-*.safetensors with model.safetensors.index.json) stores the
trunk under backbone.{encoder,decoder}. and the expert under action_expert.. The
action expert names are identical on both sides. The trunk differs in these places:
- projections:
t_proj.VideoTensor->time_proj;input_projections.TextEncodingTensor.proj.{0,2,3}->text_in.{fc1,fc2,norm};input_projections.VideoTensor.proj->video_in;output_projections.VideoTensor.proj->video_out(encoder) oroutput_projections.VideoTensor.proj.{0,1}->video_out.{norm,linear}(decoder); - attention:
mha.in_proj.{q,k,v}_weight->attn.{q,k,v}_proj.weightand the othermha.*names ->attn.*; - dense feed-forward:
ffn.0.linear.{a,b}_weight->ffn.{gate,up}_proj.weightandffn.1.weight->ffn.down_proj.weight; - mixture of experts:
ffn.router.weight->ffn.gate.weight,ffn.expert_bias->ffn.gate.e_score_correction_bias,ffn.routed.{gate_up,down}_weight->ffn.experts.{gate_and_up_projs,down_projs}(same[experts, in, out]layout), and the packed shared expertffn.shared.gate_upof shape [hidden, 2 * inter] is split and transposed intoffn.shared_experts.{gate,up}_proj.weightof shape [inter, hidden];ffn.shared.downof shape [inter, hidden] is transposed intodown_proj.weight.
Module Contents
Classes
Functions
Data
API
Bases: StateDictAdapter
Convert between checkpoint keys (from_hf) and module keys (to_hf).
Convert one module tensor to its checkpoint tensor(s); see to_hf.
Map checkpoint tensors to module tensors.
Parameters:
Checkpoint tensors keyed by their checkpoint names.
Returns: dict[str, Tensor]
Tensors keyed by module names. Shared-expert weights are new contiguous tensors; every
Map module tensors back to checkpoint tensors (the inverse of from_hf).
Parameters:
Module tensors keyed by module names.
Returns: dict[str, Tensor]
Tensors keyed by checkpoint names; the two shared-expert input projections of a block
Split a trunk key into (tower prefix, block prefix or '', leaf); None for other keys.