Ë
    T^(hÉ*  ã                   óh   — d Z ddlZddlmZ ddlmZ  ej                  e«      Z G d„ de«      Z	dgZ
y)zXLNet configurationé    Né   )ÚPretrainedConfig)Úloggingc                   ó¦   ‡ — e Zd ZdZdZdgZdddddœZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd	„	Zed
„ «       Z	e	j                  d„ «       Z	ˆ xZS )ÚXLNetConfiga˜  
    This is the configuration class to store the configuration of a [`XLNetModel`] or a [`TFXLNetModel`]. It is used to
    instantiate a XLNet 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
    [xlnet/xlnet-large-cased](https://huggingface.co/xlnet/xlnet-large-cased) 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 32000):
            Vocabulary size of the XLNet model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`XLNetModel`] or [`TFXLNetModel`].
        d_model (`int`, *optional*, defaults to 1024):
            Dimensionality of the encoder layers and the pooler layer.
        n_layer (`int`, *optional*, defaults to 24):
            Number of hidden layers in the Transformer encoder.
        n_head (`int`, *optional*, defaults to 16):
            Number of attention heads for each attention layer in the Transformer encoder.
        d_inner (`int`, *optional*, defaults to 4096):
            Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
        ff_activation (`str` or `Callable`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the If string, `"gelu"`, `"relu"`, `"silu"` and
            `"gelu_new"` are supported.
        untie_r (`bool`, *optional*, defaults to `True`):
            Whether or not to untie relative position biases
        attn_type (`str`, *optional*, defaults to `"bi"`):
            The attention type used by the model. Set `"bi"` for XLNet, `"uni"` for Transformer-XL.
        initializer_range (`float`, *optional*, defaults to 0.02):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        layer_norm_eps (`float`, *optional*, defaults to 1e-12):
            The epsilon used by the layer normalization layers.
        dropout (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        mem_len (`int` or `None`, *optional*):
            The number of tokens to cache. The key/value pairs that have already been pre-computed in a previous
            forward pass won't be re-computed. See the
            [quickstart](https://huggingface.co/transformers/quickstart.html#using-the-past) for more information.
        reuse_len (`int`, *optional*):
            The number of tokens in the current batch to be cached and reused in the future.
        bi_data (`bool`, *optional*, defaults to `False`):
            Whether or not to use bidirectional input pipeline. Usually set to `True` during pretraining and `False`
            during finetuning.
        clamp_len (`int`, *optional*, defaults to -1):
            Clamp all relative distances larger than clamp_len. Setting this attribute to -1 means no clamping.
        same_length (`bool`, *optional*, defaults to `False`):
            Whether or not to use the same attention length for each token.
        summary_type (`str`, *optional*, defaults to "last"):
            Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.

            Has to be one of the following options:

                - `"last"`: Take the last token hidden state (like XLNet).
                - `"first"`: Take the first token hidden state (like BERT).
                - `"mean"`: Take the mean of all tokens hidden states.
                - `"cls_index"`: Supply a Tensor of classification token position (like GPT/GPT-2).
                - `"attn"`: Not implemented now, use multi-head attention.
        summary_use_proj (`bool`, *optional*, defaults to `True`):
            Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.

            Whether or not to add a projection after the vector extraction.
        summary_activation (`str`, *optional*):
            Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.

            Pass `"tanh"` for a tanh activation to the output, any other value will result in no activation.
        summary_proj_to_labels (`boo`, *optional*, defaults to `True`):
            Used in the sequence classification and multiple choice models.

            Whether the projection outputs should have `config.num_labels` or `config.hidden_size` classes.
        summary_last_dropout (`float`, *optional*, defaults to 0.1):
            Used in the sequence classification and multiple choice models.

            The dropout ratio to be used after the projection and activation.
        start_n_top (`int`, *optional*, defaults to 5):
            Used in the SQuAD evaluation script.
        end_n_top (`int`, *optional*, defaults to 5):
            Used in the SQuAD evaluation script.
        use_mems_eval (`bool`, *optional*, defaults to `True`):
            Whether or not the model should make use of the recurrent memory mechanism in evaluation mode.
        use_mems_train (`bool`, *optional*, defaults to `False`):
            Whether or not the model should make use of the recurrent memory mechanism in train mode.

            <Tip>

            For pretraining, it is recommended to set `use_mems_train` to `True`. For fine-tuning, it is recommended to
            set `use_mems_train` to `False` as discussed
            [here](https://github.com/zihangdai/xlnet/issues/41#issuecomment-505102587). If `use_mems_train` is set to
            `True`, one has to make sure that the train batches are correctly pre-processed, *e.g.* `batch_1 = [[This
            line is], [This is the]]` and `batch_2 = [[ the first line], [ second line]]` and that all batches are of
            equal size.

            </Tip>

    Examples:

    ```python
    >>> from transformers import XLNetConfig, XLNetModel

    >>> # Initializing a XLNet configuration
    >>> configuration = XLNetConfig()

    >>> # Initializing a model (with random weights) from the configuration
    >>> model = XLNetModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```ÚxlnetÚmemsÚ
vocab_sizeÚd_modelÚn_headÚn_layer)Ún_tokenÚhidden_sizeÚnum_attention_headsÚnum_hidden_layersc                 ó‚  •— || _         || _        || _        || _        ||z  dk7  rt	        d||z  › d�«      ‚d|v r#|d   ||z  k7  rt	        d|d   › d||z  › d�«      ‚||z  | _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        || _        d|v rt7        j8                  d	t:        «       |d   }|| _        || _        tA        ‰| �„  d|||d
œ|¤Ž y)zConstructs XLNetConfig.r   z'd_model % n_head' (z) should be equal to 0Úd_headz
`d_head` (z*) should be equal to `d_model // n_head` (ú)Ú	use_cachezlThe `use_cache` argument is deprecated and will be removed in a future version, use `use_mems_eval` instead.)Úpad_token_idÚbos_token_idÚeos_token_idN© )"r
   r   r   r   Ú
ValueErrorr   Úff_activationÚd_innerÚuntie_rÚ	attn_typeÚinitializer_rangeÚlayer_norm_epsÚdropoutÚmem_lenÚ	reuse_lenÚbi_dataÚ	clamp_lenÚsame_lengthÚsummary_typeÚsummary_use_projÚsummary_activationÚsummary_last_dropoutÚstart_n_topÚ	end_n_topr   r   r   ÚwarningsÚwarnÚFutureWarningÚuse_mems_evalÚuse_mems_trainÚsuperÚ__init__)Úselfr
   r   r   r   r   r   r   r   r   r    r!   r"   r#   r0   r1   r$   r%   r&   r'   r(   r)   r*   r+   r,   r   r   r   ÚkwargsÚ	__class__s                                €úk/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/xlnet/configuration_xlnet.pyr3   zXLNetConfig.__init__‘   s”  ø€ ð@ %ˆŒØˆŒØˆŒØˆŒØ�VÑ˜qÒ ÜÐ3°G¸fÑ4DÐ3EÐE[Ð\Ó]Ð]Ø�vÑØ�hÑ 7¨fÑ#4Ò4Ü Ø  ¨Ñ!1Ð 2Ð2\Ð]dÐhnÑ]nÐ\oÐopÐqóð ð  Ñ'ˆŒØ*ˆÔØˆŒØˆŒØ"ˆŒà!2ˆÔØ,ˆÔàˆŒØˆŒØ"ˆŒØˆŒØ"ˆŒØ&ˆÔà(ˆÔØ 0ˆÔØ"4ˆÔØ$8ˆÔ!Ø&ˆÔØ"ˆŒà(ˆÔØ(ˆÔØ(ˆÔà˜&Ñ Ü�M‰Mðäôð
 # ;Ñ/ˆMà*ˆÔØ,ˆÔÜ‰ÑÐs lÀÐ\hÑsÐlrÓsó    c                 óJ   — t         j                  d| j                  › d�«       y)Nú
The model ú< is one of the few models that has no sequence length limit.éÿÿÿÿ)ÚloggerÚinfoÚ
model_type)r4   s    r7   Úmax_position_embeddingsz#XLNetConfig.max_position_embeddingsã   s    € ä�‰�j §¡Ð 1Ð1mÐnÔoØr8   c                 ó4   — t        d| j                  › d�«      ‚)Nr:   r;   )ÚNotImplementedErrorr?   )r4   Úvalues     r7   r@   z#XLNetConfig.max_position_embeddingsè   s#   € ô "Ø˜Ÿ™Ð)Ð)eÐfó
ð 	
r8   )i }  i   é   é   i   ÚgeluTÚbig{®Gáz”?gê-�™—q=çš™™™™™¹?i   NTFFr<   FÚlastTÚtanhrH   é   rK   rK   é   é   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r?   Úkeys_to_ignore_at_inferenceÚattribute_mapr3   Úpropertyr@   ÚsetterÚ__classcell__)r6   s   @r7   r   r      sµ   ø„ ñjðX €JØ#) (ÐàØ Ø'Ø&ñ	€Mð ØØØØØØØØØØØØØØØØØØØØ!Ø ØØØØØõ9Ptðd ñó ðð ×#Ñ#ñ
ó $ô
r8   r   )rQ   r-   Úconfiguration_utilsr   Úutilsr   Ú
get_loggerrN   r=   r   Ú__all__r   r8   r7   ú<module>r[      s@   ðñ  ã å 3Ý ð 
ˆ×	Ñ	˜HÓ	%€ôR
Ð"ô R
ðj ˆ/�r8   