DenseMamba-350M / configuration_dense_gau_retnet.py
jamesHD2001's picture
Upload 10 files
cc650a6 verified
raw
history blame
3.24 kB
# coding=utf-8
# Copyright 2022 EleutherAI and the Huggingface Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" 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,
)