vllm.transformers_utils.configs.nemotron
Nemotron model configuration
NemotronConfig
¶
Bases: PretrainedConfig
This is the configuration class to store the configuration of a
[NemotronModel
]. It is used to instantiate an Nemotron 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 Nemotron-8B.
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 256000
|
Vocabulary size of the Nemotron model. Defines the number of
different tokens that can be represented by the
|
256000
|
hidden_size
|
`int`, *optional*, defaults to 6144
|
Dimension of the hidden representations. |
6144
|
intermediate_size
|
`int`, *optional*, defaults to 24576
|
Dimension of the MLP representations. |
24576
|
num_hidden_layers
|
`int`, *optional*, defaults to 32
|
Number of hidden layers in the Transformer decoder. |
32
|
num_attention_heads
|
`int`, *optional*, defaults to 48
|
Number of attention heads for each attention layer in the Transformer decoder. |
48
|
head_dim
|
`int`, *optional*
|
Projection weights dimension in multi-head attention. Set to hidden_size // num_attention_heads if None |
None
|
num_key_value_heads
|
`int`, *optional*
|
This is the number of key_value heads that should be used to
implement Grouped Query Attention. If
|
None
|
hidden_act
|
`str` or `function`, *optional*, defaults to `"relu2"`
|
The non-linear activation function (function or string) in the decoder. |
'relu2'
|
max_position_embeddings
|
`int`, *optional*, defaults to 4096
|
The maximum sequence length that this model might ever be used with. |
4096
|
initializer_range
|
`float`, *optional*, defaults to 0.0134
|
The standard deviation of the truncated_normal_initializer for initializing all weight matrices. |
0.0134
|
norm_eps
|
`float`, *optional*, defaults to 1e-05
|
The epsilon used by the normalization layers. |
1e-05
|
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
|
pad_token_id
|
`int`, *optional*
|
Padding token id. |
None
|
bos_token_id
|
`int`, *optional*, defaults to 2
|
Beginning of stream token id. |
2
|
eos_token_id
|
`int`, *optional*, defaults to 3
|
End of stream token id. |
3
|
tie_word_embeddings
|
`bool`, *optional*, defaults to `False`
|
Whether to tie weight embeddings |
False
|
rope_theta
|
`float`, *optional*, defaults to 10000.0
|
The base period of the RoPE embeddings. |
10000.0
|
partial_rotary_factor
|
`float`, *optional*, defaults to 0.5
|
Percentage of the query and keys which will have rotary embedding. |
0.5
|
attention_bias
|
`bool`, *optional*, defaults to `False`
|
Whether to use a bias in the query, key, value and output projection layers during self-attention. |
False
|
attention_dropout
|
`float`, *optional*, defaults to 0.0
|
The dropout ratio for the attention probabilities. |
0.0
|
mlp_bias
|
`bool`, *optional*, defaults to `False`
|
Whether to use a bias in up_proj and down_proj layers in the MLP layers. |
False
|
>>> from transformers import NemotronModel, NemotronConfig
>>> # Initializing a Nemotron nemotron-15b style configuration
>>> configuration = NemotronConfig()
>>> # Initializing a model from the nemotron-15b style configuration
>>> model = NemotronModel(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
Source code in vllm/transformers_utils/configs/nemotron.py
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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
head_dim
instance-attribute
¶
keys_to_ignore_at_inference
class-attribute
instance-attribute
¶
__init__
¶
__init__(
vocab_size=256000,
hidden_size=6144,
intermediate_size=24576,
num_hidden_layers=32,
num_attention_heads=48,
head_dim=None,
num_key_value_heads=None,
hidden_act="relu2",
max_position_embeddings=4096,
initializer_range=0.0134,
norm_eps=1e-05,
use_cache=True,
pad_token_id=None,
bos_token_id=2,
eos_token_id=3,
tie_word_embeddings=False,
rope_theta=10000.0,
rope_scaling=None,
partial_rotary_factor=0.5,
attention_bias=False,
attention_dropout=0.0,
mlp_bias=False,
**kwargs,
)
Source code in vllm/transformers_utils/configs/nemotron.py
_rope_scaling_validation
¶
Validate the rope_scaling
configuration.