nemo_automodel.components.models.praxis.masks
nemo_automodel.components.models.praxis.masks
Attention masks of the chunk-causal window.
Every token of a sequence carries three integer tags: its kind (global, noised video,
clean video), its chunk index and its latent frame index. A mask rule is a pure
function of the tags of the query and the key, so one rule serves both the flex
BlockMask (CUDA) and a dense boolean mask (CPU and SDPA).
Module Contents
Classes
Functions
Data
API
Small LRU cache of built masks keyed by the caller’s layout key.
A run of tokens of one kind: frames latent frames of tokens_per_frame tokens each.
A global slot has frames == 1 and tokens_per_frame tokens.
Per-token tags of one sequence, all int32 tensors of shape [tokens] on one device.
Build a flex BlockMask over [q_len, kv_len] tiles of block_size from rule.
The teacher-forcing rule of the trunk towers over one sequence.
- every token attends every global token; a global token attends only global tokens;
- a clean token attends the clean tokens of its own and earlier chunks;
- a noised token attends the noised tokens of its own chunk and the clean tokens of earlier chunks;
- a clean token never attends a noised token.
Evaluate rule on the full grid.
Returns: Tensor
Boolean tensor of shape [q_len, kv_len], true where attention is allowed.
Rule of the action expert’s cross attention.
A query of chunk c (first frame c * chunk_size, stored in q_tags.frame)
attends every global key, the clean frames strictly before its chunk and at most
window frames before it, and the noised frames of its own chunk.
Rule of the action expert’s self attention: one block per chunk.
Tags of a window sequence laid out as slots in order.
Frame f of a video slot belongs to chunk f // chunk_size. Global tokens get
chunk and frame -1.
Parameters:
The runs of the sequence in order.
Latent frames per chunk.
Device of the tag tensors.
Returns: TokenTags
class:TokenTags of the whole sequence.