|
| | LlamaConfig (dim_t embedding_dim, dim_t num_layers) |
| | Construct a LLaMA network configuration.
|
| void | fromMetadata (const SerializationMetadata &meta) |
| | Populate configuration from provided metadata.
|
| dim_t | getHiddenDimension () const noexcept |
| dim_t | getMaxSequenceLength () const noexcept |
| dim_t | getModelDim () const noexcept |
| dim_t | getNumHeads () const noexcept |
| dim_t | getNumKVHeads () const noexcept |
| dim_t | getNumLayers () const noexcept |
| float | getRMSNormEpsilon () const noexcept |
| float | getRoPEScalingFactor () const noexcept |
| float | getRoPETheta () const noexcept |
| dim_t | getVocabSize () const noexcept |
| SerializationMetadata | toMetadata () const |
| | Convert configuration into a SerializationMetadata object.
|
| std::string | toString () const override |
| | Produce a short, human-readable summary of the configuration.
|
| bool | useBias () const noexcept |
| void | validate () const override |
| | Validate configuration parameters.
|
| template<typename Self> |
| decltype(auto) | withBias (this Self &&self, bool use_bias) |
| template<typename Self> |
| decltype(auto) | withHiddenDimension (this Self &&self, dim_t hidden_dim) |
| template<typename Self> |
| decltype(auto) | withMaxSequenceLength (this Self &&self, dim_t max_seq_len) |
| | Sets the trained maximum sequence length for this model.
|
| template<typename Self> |
| decltype(auto) | withNumHeads (this Self &&self, dim_t num_heads) |
| template<typename Self> |
| decltype(auto) | withNumKVHeads (this Self &&self, dim_t num_kv_heads) |
| template<typename Self> |
| decltype(auto) | withRoPEScalingFactor (this Self &&self, float scale_factor) |
| template<typename Self> |
| decltype(auto) | withRoPETheta (this Self &&self, float theta) |
| template<typename Self> |
| decltype(auto) | withVocabularyLength (this Self &&self, dim_t vocab_size) |
| virtual | ~ComponentConfig ()=default |
| | Virtual destructor for polymorphic base.
|
Network-level configuration for LLaMA-style transformer networks.
Exposes only the settings needed at network scope: vocabulary, number of layers, embedding dimension, and max sequence length.
template<typename Self>
| decltype(auto) Mila::Dnn::LlamaConfig::withMaxSequenceLength |
( |
this Self && | self, |
|
|
dim_t | max_seq_len ) |
|
inline |
Sets the trained maximum sequence length for this model.
This value is sourced from the pretrained model metadata ( max_position_embeddings in HuggingFace configs ) and represents the architectural ceiling on context length — the furthest position for which RoPE embeddings were trained.
This is not a deployment parameter. The runtime context length is a deployment decision carried by BuildContext, and must not exceed this value. LlamaModel::fromPretrained() enforces that invariant.
- Template Parameters
-
| Self | Deduced type of the builder ( supports both lvalue and rvalue chains ). |
- Parameters
-
| max_seq_len | The trained maximum sequence length. Must be > 0. |
- Exceptions
-
| std::invalid_argument | if max_seq_len is zero or negative. |