|
|
|
|
|
|
|
|
|
|
|
|
|
from transformers import PretrainedConfig |
|
|
|
|
|
class MobileLLMConfig(PretrainedConfig): |
|
model_type = "mobilellm" |
|
keys_to_ignore_at_inference = ["past_key_values"] |
|
|
|
def __init__( |
|
self, |
|
attention_bias=False, |
|
bos_token_id=1, |
|
eos_token_id=2, |
|
hidden_act="silu", |
|
hidden_size=1600, |
|
initializer_range=0.02, |
|
intermediate_size=4352, |
|
num_hidden_layers=54, |
|
num_attention_heads=25, |
|
num_key_value_heads=5, |
|
pretraining_tp=1, |
|
rms_norm_eps=1e-5, |
|
rope_scaling=None, |
|
rope_theta=10000.0, |
|
max_position_embeddings=2048, |
|
tie_word_embeddings=False, |
|
use_cache=True, |
|
bf16=False, |
|
fp16=True, |
|
fp32=False, |
|
vocab_size=32000, |
|
share_embedding=True, |
|
**kwargs, |
|
): |
|
|
|
self.attention_bias = attention_bias |
|
self.bos_token_id = bos_token_id |
|
self.eos_token_id = eos_token_id |
|
self.hidden_act = hidden_act |
|
self.hidden_size = hidden_size |
|
self.initializer_range = initializer_range |
|
self.intermediate_size = intermediate_size |
|
self.num_hidden_layers = num_hidden_layers |
|
self.num_attention_heads = num_attention_heads |
|
self.num_key_value_heads = num_key_value_heads |
|
self.pretraining_tp = pretraining_tp |
|
self.rms_norm_eps = rms_norm_eps |
|
self.rope_scaling = rope_scaling |
|
self.rope_theta = rope_theta |
|
self.max_position_embeddings = max_position_embeddings |
|
self.use_cache = use_cache |
|
self.bf16 = bf16 |
|
self.fp16 = fp16 |
|
self.fp32 = fp32 |
|
self.vocab_size = vocab_size |
|
self.share_embedding = share_embedding |
|
super().__init__( |
|
tie_word_embeddings=tie_word_embeddings, |
|
**kwargs |
|
) |
|
|