Package smile.llm.llama
Class TransformerBlock
java.lang.Object
smile.llm.llama.TransformerBlock
A block in Transformer model. It consists of an attention mechanism
followed by a feedforward neural network. This module can be stacked
multiple times to create a complete Transformer model.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
TransformerBlock
Constructor.- Parameters:
layerId
- the identifier of the block.args
- the model configuration parameters.
-
-
Method Details
-
forward
Forward pass through the block.- Parameters:
x
- the input tensor.startPos
- the starting position for attention caching.cis
- the precomputed frequency tensor.mask
- the attention mask tensor.- Returns:
- the output tensor.
-