noether.modeling.modules.decoders¶
Submodules¶
Classes¶
A deep Perceiver decoder module. Can be configured with different number of layers and hidden dimensions. |
|
Configuration for the DeepPerceiverDecoder module. |
Package Contents¶
- class noether.modeling.modules.decoders.DeepPerceiverDecoder(config)¶
Bases:
torch.nn.ModuleA deep Perceiver decoder module. Can be configured with different number of layers and hidden dimensions. However, it should be noted that this layer is not a full-fledged Perceiver, since it only has a cross-attention mechanism.
- Parameters:
config (DeepPerceiverDecoderConfig) – Configuration for the DeepPerceiverDecoder module. See
DeepPerceiverDecoderConfigfor available options.
- blocks¶
- forward(kv, queries, attn_kwargs=None, condition=None)¶
Forward pass of the model.
- Parameters:
kv (torch.Tensor) – The key-value tensor (batch_size, num_latent_tokens, dim).
queries (torch.Tensor) – The query tensor (batch_size, num_output_queries, dim).
attn_kwargs (dict[str, Any] | None) – Dict with arguments for the attention (such as the attention mask or rope frequencies). Defaults to None.
condition (torch.Tensor | None) – Optional conditioning tensor that can be used in the attention mechanism. This can be used to pass additional conditioning information, etc.
- Returns:
The predictions as sparse tensor (batch_size * num_output_pos, num_out_values).
- Return type:
- class noether.modeling.modules.decoders.DeepPerceiverDecoderConfig(/, **data)¶
Bases:
noether.core.schemas.mixins.InjectSharedFieldFromParentMixin,pydantic.BaseModelConfiguration for the DeepPerceiverDecoder 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)
- perceiver_block_config: Annotated[noether.modeling.modules.blocks.PerceiverBlockConfig, noether.core.schemas.mixins.Shared] = None¶
Configuration for the Perceiver blocks used in the decoder.