Ë
    S^(h  ã                   ó`   — d 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&Funnel Transformer model configurationé   )ÚPretrainedConfig)Úloggingc                   óÆ   ‡ — e Zd ZdZdZdddœZdg d¢dd	d
dddddddddddddddfˆ fd„	Zed„ «       Zej                  d„ «       Zed„ «       Z
e
j                  d„ «       Z
ˆ xZS )ÚFunnelConfiga  
    This is the configuration class to store the configuration of a [`FunnelModel`] or a [`TFBertModel`]. It is used to
    instantiate a Funnel Transformer 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 Funnel
    Transformer [funnel-transformer/small](https://huggingface.co/funnel-transformer/small) 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 30522):
            Vocabulary size of the Funnel transformer. Defines the number of different tokens that can be represented
            by the `inputs_ids` passed when calling [`FunnelModel`] or [`TFFunnelModel`].
        block_sizes (`List[int]`, *optional*, defaults to `[4, 4, 4]`):
            The sizes of the blocks used in the model.
        block_repeats (`List[int]`, *optional*):
            If passed along, each layer of each block is repeated the number of times indicated.
        num_decoder_layers (`int`, *optional*, defaults to 2):
            The number of layers in the decoder (when not using the base model).
        d_model (`int`, *optional*, defaults to 768):
            Dimensionality of the model's hidden states.
        n_head (`int`, *optional*, defaults to 12):
            Number of attention heads for each attention layer in the Transformer encoder.
        d_head (`int`, *optional*, defaults to 64):
            Dimensionality of the model's heads.
        d_inner (`int`, *optional*, defaults to 3072):
            Inner dimension in the feed-forward blocks.
        hidden_act (`str` or `callable`, *optional*, defaults to `"gelu_new"`):
            The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
            `"relu"`, `"silu"` and `"gelu_new"` are supported.
        hidden_dropout (`float`, *optional*, defaults to 0.1):
            The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
        attention_dropout (`float`, *optional*, defaults to 0.1):
            The dropout probability for the attention probabilities.
        activation_dropout (`float`, *optional*, defaults to 0.0):
            The dropout probability used between the two layers of the feed-forward blocks.
        initializer_range (`float`, *optional*, defaults to 0.1):
            The upper bound of the *uniform initializer* for initializing all weight matrices in attention layers.
        initializer_std (`float`, *optional*):
            The standard deviation of the *normal initializer* for initializing the embedding matrix and the weight of
            linear layers. Will default to 1 for the embedding matrix and the value given by Xavier initialization for
            linear layers.
        layer_norm_eps (`float`, *optional*, defaults to 1e-09):
            The epsilon used by the layer normalization layers.
        pooling_type (`str`, *optional*, defaults to `"mean"`):
            Possible values are `"mean"` or `"max"`. The way pooling is performed at the beginning of each block.
        attention_type (`str`, *optional*, defaults to `"relative_shift"`):
            Possible values are `"relative_shift"` or `"factorized"`. The former is faster on CPU/GPU while the latter
            is faster on TPU.
        separate_cls (`bool`, *optional*, defaults to `True`):
            Whether or not to separate the cls token when applying pooling.
        truncate_seq (`bool`, *optional*, defaults to `True`):
            When using `separate_cls`, whether or not to truncate the last token when pooling, to avoid getting a
            sequence length that is not a multiple of 2.
        pool_q_only (`bool`, *optional*, defaults to `True`):
            Whether or not to apply the pooling only to the query or to query, key and values for the attention layers.
    ÚfunnelÚd_modelÚn_head)Úhidden_sizeÚnum_attention_headsi:w  )é   r   r   Né   i   é   é@   i   Úgelu_newgš™™™™™¹?g        g•Ö&è.>ÚmeanÚrelative_shiftTc                 óê  •— || _         || _        |€dgt        |«      z  n|| _        t        |«      t        | j                  «      k(  sJ d«       ‚|| _        || _        || _        || _        || _        |	| _	        |
| _
        || _        || _        || _        || _        || _        |dv sJ d|› d�«       ‚|| _        |dv sJ d|› d�«       ‚|| _        || _        || _        || _        t+        ‰| �X  di |¤Ž y )	Né   z>`block_sizes` and `block_repeats` should have the same length.)r   ÚmaxzGot z< for `pooling_type` but only 'mean' and 'max' are supported.)r   Ú
factorizedzO for `attention_type` but only 'relative_shift' and 'factorized' are supported.© )Ú
vocab_sizeÚblock_sizesÚlenÚblock_repeatsÚnum_decoder_layersr   r	   Úd_headÚd_innerÚ
hidden_actÚhidden_dropoutÚattention_dropoutÚactivation_dropoutÚinitializer_rangeÚinitializer_stdÚlayer_norm_epsÚpooling_typeÚattention_typeÚseparate_clsÚtruncate_seqÚpool_q_onlyÚsuperÚ__init__)Úselfr   r   r   r   r   r	   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   ÚkwargsÚ	__class__s                         €úm/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/funnel/configuration_funnel.pyr,   zFunnelConfig.__init__Y   sL  ø€ ð0 %ˆŒØ&ˆÔØ7DÐ7L˜a˜S¤3 {Ó#3Ò3ÐR_ˆÔÜ�;Ó¤3 t×'9Ñ'9Ó#:Ò:ð 	
ØLó	
Ð:ð #5ˆÔØˆŒØˆŒØˆŒØˆŒØ$ˆŒØ,ˆÔØ!2ˆÔØ"4ˆÔØ!2ˆÔØ.ˆÔØ,ˆÔØð  
ñ 
ð 	]ð �,�Ð[Ð\ó	]ð 
ð )ˆÔØð "
ñ 
ð 	rð �.Ð!Ð!pÐqó	rð 
ð -ˆÔØ(ˆÔØ(ˆÔØ&ˆÔä‰ÑÑ"˜6Ó"ó    c                 ó,   — t        | j                  «      S ©N)Úsumr   ©r-   s    r0   Únum_hidden_layerszFunnelConfig.num_hidden_layers“   ó   € ä�4×#Ñ#Ó$Ð$r1   c                 ó   — t        d«      ‚)NzYThis model does not support the setting of `num_hidden_layers`. Please set `block_sizes`.©ÚNotImplementedError©r-   Úvalues     r0   r6   zFunnelConfig.num_hidden_layers—   s   € ä!Øgó
ð 	
r1   c                 ó,   — t        | j                  «      S r3   )r   r   r5   s    r0   Ú
num_blockszFunnelConfig.num_blocks�   r7   r1   c                 ó   — t        d«      ‚)NzRThis model does not support the setting of `num_blocks`. Please set `block_sizes`.r9   r;   s     r0   r>   zFunnelConfig.num_blocks¡   s   € ä!Ð"vÓwÐwr1   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typeÚattribute_mapr,   Úpropertyr6   Úsetterr>   Ú__classcell__)r/   s   @r0   r   r      s¿   ø„ ñ8ðt €Jà Ø'ñ€Mð ÚØØØØØØØØØØØØØØØ'ØØØõ+8#ðt ñ%ó ð%ð ×Ññ
ó ð
ð
 ñ%ó ð%ð ×Ññxó ôxr1   r   N)
rC   Úconfiguration_utilsr   Úutilsr   Ú
get_loggerr@   Úloggerr   Ú__all__r   r1   r0   ú<module>rN      s@   ðñ -å 3Ý ð 
ˆ×	Ñ	˜HÓ	%€ôKxÐ#ô Kxð\ Ð
�r1   