Ë
    S^(h%#  ã                   óÄ   — d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ er
ddlmZmZmZ  ej&                  e«      Z G d	„ d
e
«      Z G d„ de«      Zd
dgZy)zDeBERTa model configurationé    )ÚOrderedDict)ÚTYPE_CHECKINGÚAnyÚMappingÚOptionalÚUnioné   )ÚPretrainedConfig)Ú
OnnxConfig)Úlogging)ÚFeatureExtractionMixinÚPreTrainedTokenizerBaseÚ
TensorTypec                   óP   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„	Zˆ xZS )ÚDebertaConfigaL  
    This is the configuration class to store the configuration of a [`DebertaModel`] or a [`TFDebertaModel`]. It is
    used to instantiate a DeBERTa 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 DeBERTa
    [microsoft/deberta-base](https://huggingface.co/microsoft/deberta-base) architecture.

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

    Arguments:
        vocab_size (`int`, *optional*, defaults to 50265):
            Vocabulary size of the DeBERTa model. Defines the number of different tokens that can be represented by the
            `inputs_ids` passed when calling [`DebertaModel`] or [`TFDebertaModel`].
        hidden_size (`int`, *optional*, defaults to 768):
            Dimensionality of the encoder layers and the pooler layer.
        num_hidden_layers (`int`, *optional*, defaults to 12):
            Number of hidden layers in the Transformer encoder.
        num_attention_heads (`int`, *optional*, defaults to 12):
            Number of attention heads for each attention layer in the Transformer encoder.
        intermediate_size (`int`, *optional*, defaults to 3072):
            Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
        hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"silu"`, `"gelu"`, `"tanh"`, `"gelu_fast"`, `"mish"`, `"linear"`, `"sigmoid"` and `"gelu_new"`
            are supported.
        hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        attention_probs_dropout_prob (`float`, *optional*, defaults to 0.1):
            The dropout ratio for the attention probabilities.
        max_position_embeddings (`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).
        type_vocab_size (`int`, *optional*, defaults to 0):
            The vocabulary size of the `token_type_ids` passed when calling [`DebertaModel`] or [`TFDebertaModel`].
        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.
        relative_attention (`bool`, *optional*, defaults to `False`):
            Whether use relative position encoding.
        max_relative_positions (`int`, *optional*, defaults to 1):
            The range of relative positions `[-max_position_embeddings, max_position_embeddings]`. Use the same value
            as `max_position_embeddings`.
        pad_token_id (`int`, *optional*, defaults to 0):
            The value used to pad input_ids.
        position_biased_input (`bool`, *optional*, defaults to `True`):
            Whether add absolute position embedding to content embedding.
        pos_att_type (`List[str]`, *optional*):
            The type of relative position attention, it can be a combination of `["p2c", "c2p"]`, e.g. `["p2c"]`,
            `["p2c", "c2p"]`.
        layer_norm_eps (`float`, *optional*, defaults to 1e-12):
            The epsilon used by the layer normalization layers.
        legacy (`bool`, *optional*, defaults to `True`):
            Whether or not the model should use the legacy `LegacyDebertaOnlyMLMHead`, which does not work properly
            for mask infilling tasks.

    Example:

    ```python
    >>> from transformers import DebertaConfig, DebertaModel

    >>> # Initializing a DeBERTa microsoft/deberta-base style configuration
    >>> configuration = DebertaConfig()

    >>> # Initializing a model (with random weights) from the microsoft/deberta-base style configuration
    >>> model = DebertaModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Údebertac                 ó  •— t        ‰| �  di |¤Ž || _        || _        || _        || _        || _        || _        || _        |	| _	        |
| _
        || _        || _        || _        || _        || _        t!        |t"        «      r:|j%                  «       j'                  d«      D �cg c]  }|j)                  «       ‘Œ }}|| _        || _        || _        |j1                  d|«      | _        || _        || _        || _        y c c}w )Nú|Úpooler_hidden_size© )ÚsuperÚ__init__Úhidden_sizeÚnum_hidden_layersÚnum_attention_headsÚintermediate_sizeÚ
hidden_actÚhidden_dropout_probÚattention_probs_dropout_probÚmax_position_embeddingsÚtype_vocab_sizeÚinitializer_rangeÚrelative_attentionÚmax_relative_positionsÚpad_token_idÚposition_biased_inputÚ
isinstanceÚstrÚlowerÚsplitÚstripÚpos_att_typeÚ
vocab_sizeÚlayer_norm_epsÚgetr   Úpooler_dropoutÚpooler_hidden_actÚlegacy)Úselfr-   r   r   r   r   r   r   r   r    r!   r"   r.   r#   r$   r%   r&   r,   r0   r1   r2   ÚkwargsÚxÚ	__class__s                          €úo/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/deberta/configuration_deberta.pyr   zDebertaConfig.__init__j   s  ø€ ô0 	‰ÑÑ"˜6Ò"à&ˆÔØ!2ˆÔØ#6ˆÔ Ø!2ˆÔØ$ˆŒØ#6ˆÔ Ø,HˆÔ)Ø'>ˆÔ$Ø.ˆÔØ!2ˆÔØ"4ˆÔØ&<ˆÔ#Ø(ˆÔØ%:ˆÔ"ô �l¤CÔ(Ø/;×/AÑ/AÓ/C×/IÑ/IÈ#Ó/NÖO¨!˜AŸG™G�IÐOˆLÐOà(ˆÔØ$ˆŒØ,ˆÔà"(§*¡*Ð-AÀ;Ó"OˆÔØ,ˆÔØ!2ˆÔØˆ�ùò Ps   Â$C?)iYÄ  i   é   r8   i   Úgeluçš™™™™™¹?r:   i   r   g{®Gáz”?gH¯¼šò×z>Féÿÿÿÿr   TNr   r9   T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer   Ú__classcell__©r6   s   @r7   r   r       sY   ø„ ñEðN €Jð ØØØØØØØ%(Ø #ØØØØ Ø!ØØ"ØØØ Ø÷+4ñ 4ó    r   c                   ó¶   ‡ — e Zd Zedeeeeef   f   fd„«       Zedefd„«       Z	 	 	 	 	 	 	 	 	 dde	d   dededed	e
d
ed   dedededddeeef   fˆ fd„Zˆ xZS )ÚDebertaOnnxConfigÚreturnc                 ó´   — | j                   dk(  rddddœ}ndddœ}| j                  j                  dkD  rt        d|fd	|fd
|fg«      S t        d|fd	|fg«      S )Nzmultiple-choiceÚbatchÚchoiceÚsequence)r   é   é   )r   rK   r   Ú	input_idsÚattention_maskÚtoken_type_ids)ÚtaskÚ_configr!   r   )r3   Údynamic_axiss     r7   ÚinputszDebertaOnnxConfig.inputs£   s~   € à�9‰9Ð)Ò)Ø&¨8¸
ÑC‰Là&¨:Ñ6ˆLØ�<‰<×'Ñ'¨!Ò+ÜØ˜|Ð,Ð/?ÀÐ.NÐQaÐcoÐPpÐqóð ô  ¨lÐ ;Ð>NÐP\Ð=]Ð^Ó_Ð_rC   c                  ó   — y)Nr8   r   )r3   s    r7   Údefault_onnx_opsetz$DebertaOnnxConfig.default_onnx_opset°   s   € àrC   Úpreprocessor)r   r   Ú
batch_sizeÚ
seq_lengthÚnum_choicesÚis_pairÚ	frameworkr   Únum_channelsÚimage_widthÚimage_heightÚ	tokenizerr   c                 ój   •— t         ‰| �  ||¬«      }| j                  j                  dk(  rd|v r|d= |S )N)rV   r[   r   rO   )r   Úgenerate_dummy_inputsrQ   r!   )r3   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   Údummy_inputsr6   s               €r7   ra   z'DebertaOnnxConfig.generate_dummy_inputs´   sC   ø€ ô ‘wÑ4À,ÐZcÐ4ÓdˆØ�<‰<×'Ñ'¨1Ò,Ð1AÀ\Ñ1QØÐ-Ð.ØÐrC   )	r;   r;   r;   FNr	   é(   rc   N)r<   r=   r>   Úpropertyr   r(   ÚintrS   rU   r   Úboolr   r   ra   rA   rB   s   @r7   rE   rE   ¢   sô   ø„ Øð
`˜  W¨S°#¨XÑ%6Ð 6Ñ7ò 
`ó ð
`ð ð Cò ó ðð ØØØØ,0ØØØØ/3ñàÐOÑPðð ðð ð	ð
 ðð ðð ˜LÑ)ðð ðð ðð ðð -ðð 
��c�Ñ	÷ñ rC   rE   N)r?   Úcollectionsr   Útypingr   r   r   r   r   Úconfiguration_utilsr
   Úonnxr   Úutilsr   Ú r   r   r   Ú
get_loggerr<   Úloggerr   rE   Ú__all__r   rC   r7   ú<module>rp      se   ðñ "å #ß ?Õ ?å 3Ý Ý ñ ßOÑOð 
ˆ×	Ñ	˜HÓ	%€ô~Ð$ô ~ôD"˜
ô "ðJ Ð/Ð
0�rC   