vllm.transformers_utils.configs.lfm2_moe ¶
Lfm2MoeConfig ¶
Bases: PretrainedConfig
This is the configuration class to store the configuration of a [Lfm2MoeModel
]. It is used to instantiate a LFM2 Moe model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the LFM2-8B-A1B model. e.g. LiquidAI/LFM2-8B-A1B
Configuration objects inherit from [PretrainedConfig
] and can be used to control the model outputs. Read the documentation from [PretrainedConfig
] for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vocab_size | `int`, *optional*, defaults to 65536 | Vocabulary size of the LLaMA model. Defines the number of different tokens that can be represented by the | 65536 |
hidden_size | `int`, *optional*, defaults to 2048 | Dimension of the hidden representations. | 2048 |
intermediate_size | `int`, *optional*, defaults to 7168 | Dimension of the MLP representations. | 7168 |
moe_intermediate_size | `int`, *optional*, defaults to 1792 | Intermediate size of the routed expert. | 1792 |
num_hidden_layers | `int`, *optional*, defaults to 32 | Number of hidden layers in the Transformer decoder. | 32 |
pad_token_id | `int`, *optional*, defaults to 0 | Padding token id. | 0 |
bos_token_id | `int`, *optional*, defaults to 1 | Beginning of stream token id. | 1 |
eos_token_id | `int`, *optional*, defaults to 2 | End of stream token id. | 2 |
tie_word_embeddings | `bool`, *optional*, defaults to `True` | Whether to tie weight embeddings | True |
rope_theta | `float`, *optional*, defaults to 1000000.0 | The base period of the RoPE embeddings. | 1000000.0 |
max_position_embeddings | `int`, *optional*, defaults to 128000 | The maximum sequence length that this model might ever be used with. | 128000 |
use_cache | `bool`, *optional*, defaults to `True` | Whether or not the model should return the last key/values attentions (not used by all models). Only relevant if | True |
norm_eps | `float`, *optional*, defaults to 1e-05 | The epsilon used by the rms normalization layers. | 1e-05 |
num_attention_heads | `int`, *optional*, defaults to 32 | Number of attention heads for each attention layer in the Transformer decoder. | 32 |
num_key_value_heads | `int`, *optional*, defaults to 8 | This is the number of key_value heads that should be used to implement Grouped Query Attention. If | 8 |
conv_bias | `bool`, *optional*, defaults to `False` | Whether to use bias in the conv layers. | False |
conv_L_cache | `int`, *optional*, defaults to 3 | L_cache dim in the conv layers. | 3 |
num_dense_layers | `int`, *optional*, defaults to 2 | Number of dense Lfm2MoeMLP layers in shallow layers(embed->dense->dense->...->dense->moe->moe...->lm_head). | 2 |
num_experts_per_tok | `int`, *optional*, defaults to 4 | Number of selected experts. | 4 |
num_experts | `int`, *optional*, defaults to 32 | Number of routed experts. | 32 |
use_expert_bias | `bool`, *optional*, defaults to `True` | Whether to use the expert bias on the routing weights. | True |
routed_scaling_factor | `float`, *optional*, defaults to 1.0 | Scaling factor for routed experts in MoE models. | 1.0 |
norm_topk_prob | `bool`, *optional*, defaults to `True` | Whether to normalize the topk probabilities. | True |
layer_types | `Optional`, *optional* | Type of each layers. | None |
>>> from transformers import Lfm2MoeModel, Lfm2MoeConfig
>>> # Initializing a LFM2 Moe model
>>> configuration = Lfm2MoeConfig()
>>> # Initializing a model from the LFM2-8B-A1B style configuration
>>> model = Lfm2MoeModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
Source code in vllm/transformers_utils/configs/lfm2_moe.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
keys_to_ignore_at_inference class-attribute
instance-attribute
¶
__init__ ¶
__init__(
vocab_size: int = 65536,
hidden_size: int = 2048,
intermediate_size: int = 7168,
moe_intermediate_size: int = 1792,
num_hidden_layers: int = 32,
pad_token_id: int = 0,
bos_token_id: int = 1,
eos_token_id: int = 2,
tie_word_embeddings: bool = True,
rope_theta: float = 1000000.0,
max_position_embeddings: int = 128000,
use_cache: bool = True,
norm_eps: float = 1e-05,
num_attention_heads: int = 32,
num_key_value_heads: int = 8,
conv_bias: bool = False,
conv_L_cache: int = 3,
num_dense_layers: int = 2,
num_experts_per_tok: int = 4,
num_experts: int = 32,
use_expert_bias: bool = True,
routed_scaling_factor: float = 1.0,
norm_topk_prob: bool = True,
layer_types: Optional[list[str]] = None,
**kwargs,
)