noether.modeling.modules.attention.anchor_attention.cross¶
Classes¶
Configuration for Cross Anchor Attention module. |
|
Anchor attention across branches: each configured branch attends to the anchors of all other branches. |
Module Contents¶
- class noether.modeling.modules.attention.anchor_attention.cross.CrossAnchorAttentionConfig(/, **data)¶
Bases:
noether.modeling.modules.attention.anchor_attention.multi_branch.MultiBranchAnchorAttentionConfigConfiguration for Cross Anchor Attention module.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class noether.modeling.modules.attention.anchor_attention.cross.CrossAnchorAttention(config)¶
Bases:
noether.modeling.modules.attention.anchor_attention.multi_branch.MultiBranchAnchorAttentionAnchor attention across branches: each configured branch attends to the anchors of all other branches.
For a list of branches (e.g., A, B, C), this creates a pattern, where A attends to (B_anchors + C_anchors), B attends to (A_anchors + C_anchors), etc. It requires all configured branches and their anchors to be present in the input.
Example: all surface tokens attend to volume_anchors and all volume tokens attend to surface_anchors. This is achieved via the following attention patterns:
AttentionPattern(query_tokens=["surface_anchors", "surface_queries"], key_value_tokens=["volume_anchors"]) AttentionPattern(query_tokens=["volume_anchors", "volume_queries"], key_value_tokens=["surface_anchors"])
- Parameters:
config (CrossAnchorAttentionConfig) – Configuration for the CrossAnchorAttention module. See
CrossAnchorAttentionConfigfor the available options.