o
    ß¥µi3  ã                   @   s8   d Z ddlmZ ddlmZ e ¡ ZG dd„ deƒZdS )z ChatGLM model configuration é    )ÚPretrainedConfig)Úloggerc                       sH   e Zd ZdZdZ									
									d‡ fdd„	Z‡  ZS )ÚChatGLMConfigaÎ	  
    This is the configuration class to store the configuration of a [`~ChatGLMModel`].
    It is used to instantiate an ChatGLM model according to the specified arguments, defining the model
    architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of
    the ChatGLM-6B [THUDM/ChatGLM-6B](https://huggingface.co/THUDM/chatglm-6b) architecture.

    Configuration objects inherit from  [`PretrainedConfig`] and can be used
    to control the model outputs. Read the documentation from  [`PretrainedConfig`]
    for more information.


    Args:
        vocab_size (`int`, *optional*, defaults to 150528):
            Vocabulary size of the ChatGLM-6B model.
            Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`~ChatGLMModel`] or
            [`~TFChatGLMModel`].
        hidden_size (`int`, *optional*, defaults to 4096):
            Dimension of the encoder layers and the pooler layer.
        num_hidden_layers (`int`, *optional*, defaults to 28):
            Number of hidden layers in the Transformer encoder.
        num_attention_heads (`int`, *optional*, defaults to 32):
            Number of attention heads for each attention layer in the Transformer encoder.
        inner_hidden_size (`int`, *optional*, defaults to 16384):
            Dimension of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
        max_sequence_length (`int`, *optional*, defaults to 512):
            The maximum sequence length that this model might ever be used with.
            Typically set this to something large just in case (e.g., 512 or 1024 or 2048).
        layernorm_epsilon (`float`, *optional*, defaults to 1e-5):
            The epsilon used by the layer normalization layers.
        use_cache (`bool`, *optional*, defaults to `True`):
            Whether the model should return the last key/values attentions (not used by all models).
        Example:

    ```python
    >>> from modelscope.models.nlp.chatglm.configuration import ChatGLMConfig
    >>> from modelscope.models.nlp.chatglm.text_generation import ChatGLMModel

    >>> # Initializing a ChatGLM-6B THUDM/ChatGLM-6B style configuration
    >>> configuration = ChatGLMConfig()

    >>> # Initializing a model from the THUDM/ChatGLM-6B style configuration
    >>> model = ChatGLMModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
Úchatglmé L é   é   é    çñhãˆµøä>FéôI éõI éðI éñI r   é   é @  TNc                    s„   || _ || _|| _|| _|| _|| _|| _|| _|| _|| _	|| _
|	| _|
| _|| _|| _|| _|| _tƒ jd|||dœ|¤Ž d S )N)Úpad_token_idÚbos_token_idÚeos_token_id© )Ú
num_layersÚ
vocab_sizeÚhidden_sizeÚnum_attention_headsÚmax_sequence_lengthÚlayernorm_epsilonÚinner_hidden_sizeÚ	use_cacher   r   r   Úmask_token_idÚgmask_token_idÚposition_encoding_2dÚquantization_bitÚpre_seq_lenÚprefix_projectionÚsuperÚ__init__)Úselfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   Úkwargs©Ú	__class__r   ú_/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/models/nlp/chatglm/configuration.pyr$   =   s0   ý
üzChatGLMConfig.__init__)r   r   r   r	   r
   Fr   r   r   r   r   r   r   Tr   NF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer$   Ú__classcell__r   r   r'   r)   r   
   s*    0ïr   N)r-   Ú transformers.configuration_utilsr   Úmodelscope.utilsr   ÚloggingÚ
get_loggerr   r   r   r   r)   Ú<module>   s
    