§
    ñ§gí!  ã                   óÆ   — 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S )zDeBERTa model configurationé    )ÚOrderedDict)ÚTYPE_CHECKINGÚAnyÚMappingÚOptionalÚUnioné   )ÚPretrainedConfig)Ú
OnnxConfig)Úlogging)ÚFeatureExtractionMixinÚPreTrainedTokenizerBaseÚ
TensorTypec                   óN   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dˆ fd„	Zˆ xZS )ÚDebertaConfigay  
    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.

    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
    ```ÚdebertaéYÄ  é   é   é   Úgeluçš™™™™™¹?é   r   ç{®Gáz”?çH¯¼šò×z>FéÿÿÿÿTNc                 ó  •—  t          ¦   «         j        di |¤Ž || _        || _        || _        || _        || _        || _        || _        |	| _	        |
| _
        || _        || _        || _        || _        || _        t!          |t"          ¦  «        r1d„ |                     ¦   «                              d¦  «        D ¦   «         }|| _        || _        || _        |                     d|¦  «        | _        || _        || _        d S )Nc                 ó6   — g | ]}|                      ¦   «         ‘ŒS © )Ústrip)Ú.0Úxs     úm/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/deberta/configuration_deberta.pyú
<listcomp>z*DebertaConfig.__init__.<locals>.<listcomp>‘   s    € ÐOÐOÐO¨!˜AŸGšG™IœIÐOÐOÐOó    ú|Úpooler_hidden_sizer   )Ú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Úpos_att_typeÚ
vocab_sizeÚlayer_norm_epsÚgetr'   Úpooler_dropoutÚpooler_hidden_act)Úselfr=   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r>   r4   r5   r6   r7   r<   r@   rA   ÚkwargsÚ	__class__s                        €r#   r)   zDebertaConfig.__init__g   s  ø€ ð. 	‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"à&ˆÔØ!2ˆÔØ#6ˆÔ Ø!2ˆÔØ$ˆŒØ#6ˆÔ Ø,HˆÔ)Ø'>ˆÔ$Ø.ˆÔØ!2ˆÔØ"4ˆÔØ&<ˆÔ#Ø(ˆÔØ%:ˆÔ"õ l¥CÑ(Ô(ð 	PØOÐO¨|×/AÒ/AÑ/CÔ/C×/IÒ/IÈ#Ñ/NÔ/NÐOÑOÔOˆLà(ˆÔØ$ˆŒØ,ˆÔà"(§*¢*Ð-AÀ;Ñ"OÔ"OˆÔØ,ˆÔØ!2ˆÔÐÐr%   )r   r   r   r   r   r   r   r   r   r   r   r   Fr   r   TNr   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer)   Ú__classcell__©rD   s   @r#   r   r       sŒ   ø€ € € € € ðBð BðH €Jð ØØØØØØØ%(Ø #ØØØØ Ø!ØØ"ØØØ ð)23ð 23ð 23ð 23ð 23ð 23ð 23ð 23ð 23ð 23r%   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k    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   rS   r   Ú	input_idsÚattention_maskÚtoken_type_ids)ÚtaskÚ_configr2   r   )rB   Údynamic_axiss     r#   ÚinputszDebertaOnnxConfig.inputsž   s   € àŒ9Ð)Ò)Ð)Ø&¨8¸
ÐCÐCˆLˆLà&¨:Ð6Ð6ˆLØŒ<Ô'¨!Ò+Ð+ÝØ˜|Ð,Ð/?ÀÐ.NÐQaÐcoÐPpÐqñô ð õ  ¨lÐ ;Ð>NÐP\Ð=]Ð^Ñ_Ô_Ð_r%   c                 ó   — dS )Nr   r   )rB   s    r#   Údefault_onnx_opsetz$DebertaOnnxConfig.default_onnx_opset«   s   € àˆrr%   r   FNr	   é(   Úpreprocessor)r   r   Ú
batch_sizeÚ
seq_lengthÚnum_choicesÚis_pairÚ	frameworkr   Únum_channelsÚimage_widthÚimage_heightÚ	tokenizerr   c                 ó|   •— t          ¦   «                              ||¬¦  «        }| j        j        dk    rd|v r|d= |S )N)r_   rd   r   rW   )r(   Úgenerate_dummy_inputsrY   r2   )rB   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   Údummy_inputsrD   s               €r#   rj   z'DebertaOnnxConfig.generate_dummy_inputs¯   sL   ø€ õ ‘w”w×4Ò4À,ÐZcÐ4ÑdÔdˆØŒ<Ô'¨1Ò,Ð,Ð1AÀ\Ð1QÐ1QØÐ-Ð.ØÐr%   )	r   r   r   FNr	   r^   r^   N)rE   rF   rG   Úpropertyr   r9   Úintr[   r]   r   Úboolr   r   rj   rJ   rK   s   @r#   rM   rM      sC  ø€ € € € € Øð
`˜  W¨S°#¨XÔ%6Ð 6Ô7ð 
`ð 
`ð 
`ñ „Xð
`ð ð Cð ð ð ñ „Xðð ØØØØ,0ØØØØ/3ðð àÐOÔPðð ðð ð	ð
 ðð ðð ˜LÔ)ðð ðð ðð ðð -ðð 
cÔ	ðð ð ð ð ð ð ð ð ð r%   rM   N)rH   Úcollectionsr   Útypingr   r   r   r   r   Úconfiguration_utilsr
   Úonnxr   Úutilsr   Ú r   r   r   Ú
get_loggerrE   Úloggerr   rM   r   r%   r#   ú<module>rw      s$  ðð "Ð !à #Ð #Ð #Ð #Ð #Ð #Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð ð PØOÐOÐOÐOÐOÐOÐOÐOÐOÐOð 
ˆÔ	˜HÑ	%Ô	%€ðy3ð y3ð y3ð y3ð y3Ð$ñ y3ô y3ð y3ðz"ð "ð "ð "ð "˜
ñ "ô "ð "ð "ð "r%   