# Copyright (c) Meta Platforms, Inc. and affiliates.# All rights reserved.## This source code is licensed under the BSD-style license found in the# LICENSE file in the root directory of this source tree.from__future__importannotationsfromdataclassesimportdataclassfromtypingimportFinalfromfairseq2.runtime.config_registryimportConfigRegistrarfromfairseq2.runtime.dependencyimportDependencyContainerQWEN_FAMILY:Final="qwen"
[docs]@dataclass(kw_only=True)classQwenConfig:model_dim:int=3584"""The dimensionality of the model."""max_seq_len:int=32_768"""The maximum sequence length."""vocab_size:int=152_064"""The size of the vocabulary."""tied_embeddings:bool=False"""If ``True``, ties the embedding table and the output projection layer."""num_layers:int=28"""The number of decoder layers."""num_attn_heads:int=28"""The number of attention heads in decoder layers."""num_key_value_heads:int=4"""The number of key/value heads for Grouped Query Attention."""head_dim:int|None=None""" The dimensionality of attention heads. If ``None``, uses the standard formula ``model_dim // num_attn_heads``. """qkv_proj_bias:bool=True"""If ``True``, query, key, and value projections learn an additive bias."""q_norm:bool=False"""If ``True``, applies Layer Normalization to projected attention queries."""k_norm:bool=False"""If ``True``, applies Layer Normalization to projected attention keys."""ffn_inner_dim:int=18_944"""The dimensionality of inner projection layers in feed-forward networks."""rope_theta:float=1_000_000.0"""The coefficient of the long-term decay of the Rotary position encoder."""dropout_p:float=0.0"""The dropout probability on outputs of Transformer layers."""