from transformers import PretrainedConfig


class LaoyaoMoeConfig(PretrainedConfig):
    model_type = "laoyao_moe"

    def __init__(
        self,
        vocab_size=154856,
        hidden_size=1536,
        num_hidden_layers=12,
        num_attention_heads=24,
        num_key_value_heads=4,
        intermediate_size=4608,
        moe_intermediate_size=6144,
        num_experts=12,
        num_experts_per_tok=4,
        moe_expert_capacity_factor=1.25,
        moe_layers=(2, 4, 6, 8, 10),
        max_position_embeddings=8192,
        rope_theta=10000.0,
        rms_norm_eps=1e-5,
        tie_word_embeddings=True,
        use_cache=False,
        **kwargs,
    ):
        super().__init__(tie_word_embeddings=tie_word_embeddings, use_cache=use_cache, **kwargs)
        self.vocab_size = vocab_size
        self.hidden_size = hidden_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.intermediate_size = intermediate_size
        self.moe_intermediate_size = moe_intermediate_size
        self.num_experts = num_experts
        self.num_experts_per_tok = num_experts_per_tok
        self.moe_expert_capacity_factor = moe_expert_capacity_factor
        self.moe_layers = list(moe_layers)
        self.max_position_embeddings = max_position_embeddings
        self.rope_theta = rope_theta
        self.rms_norm_eps = rms_norm_eps
