|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" DenseGauRetNet model configuration""" |
|
|
|
from transformers.utils import logging |
|
from transformers.configuration_utils import PretrainedConfig |
|
|
|
logger = logging.get_logger(__name__) |
|
|
|
DenseGauRetNet_PRETRAINED_CONFIG_ARCHIVE_MAP = {} |
|
|
|
|
|
class DenseGauRetNetConfig(PretrainedConfig): |
|
model_type = "DenseGauRetNet" |
|
_auto_class = "AutoConfig" |
|
|
|
def __init__( |
|
self, |
|
hidden_act: str = "silu", |
|
hidden_size: int = 1536, |
|
query_key_dim: int = 768, |
|
initializer_range: float = 0.02, |
|
max_position_embeddings: int = 2048, |
|
num_attention_heads: int = 2, |
|
num_hidden_layers: int = 16, |
|
rms_norm_eps: float = 1e-06, |
|
layernorm_eps: float = 1e-5, |
|
retnorm: bool = False, |
|
vocab_size: int = 32001, |
|
v_factor: int = 2, |
|
intermediate_k_select_scale: int = 8, |
|
intermediate_v_select_scale: int = 32, |
|
dense_block_layers: int = 2, |
|
dropout: float = 0.1, |
|
use_cache: bool = False, |
|
deepnorm: bool = False, |
|
pad_token_id=0, |
|
bos_token_id=1, |
|
eos_token_id=2, |
|
tie_word_embeddings=False, |
|
|
|
**kwargs, |
|
): |
|
self.hidden_act = hidden_act |
|
self.hidden_size = hidden_size |
|
self.query_key_dim = query_key_dim |
|
self.initializer_range = initializer_range |
|
self.max_position_embeddings = max_position_embeddings |
|
self.num_attention_heads = num_attention_heads |
|
self.num_hidden_layers = num_hidden_layers |
|
self.rms_norm_eps = rms_norm_eps |
|
self.layernorm_eps = layernorm_eps |
|
self.retnorm = retnorm |
|
self.vocab_size = vocab_size |
|
self.v_factor = v_factor |
|
self.intermediate_k_select_scale = intermediate_k_select_scale |
|
self.intermediate_v_select_scale = intermediate_v_select_scale |
|
self.dense_block_layers = dense_block_layers |
|
self.dropout = dropout |
|
self.use_cache = use_cache |
|
self.deepnorm = deepnorm |
|
|
|
super().__init__( |
|
pad_token_id=pad_token_id, |
|
bos_token_id=bos_token_id, |
|
eos_token_id=eos_token_id, |
|
tie_word_embeddings=tie_word_embeddings, |
|
**kwargs, |
|
) |
|
|