
    i                     j    d Z ddlmZ ddlmZ ddlmZ  ed      e G d d	e                    Zd	gZy
)z&Funnel Transformer model configuration    )strict   )PreTrainedConfig)auto_docstringzfunnel-transformer/small)
checkpointc                       e Zd ZU dZdZdddZdZeed<   dZ	e
e   eed	f   z  ed
<   dZe
e   dz  ed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeez  ed<   dZeez  ed<   dZeez  ed<   dZeed<   dZedz  ed<   dZeed<   d Zeed!<   d"Zeed#<   d$Zeed%<   d$Zeed&<   d$Z eed'<   dZ!edz  ed(<   d$Z"eed)<    fd*Z#d+ Z$e%d,        Z&e&jN                  d-        Z&e%d.        Z(e(jN                  d/        Z( xZ)S )0FunnelConfiga  
    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).
    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  
vocab_size)   r   r   .block_sizesNblock_repeats   num_decoder_layersi      @   d_headi   d_innergelu_new
hidden_actg?hidden_dropoutattention_dropoutg        activation_dropoutinitializer_rangeinitializer_stdg&.>layer_norm_epsmeanpooling_typerelative_shiftattention_typeTseparate_clstruncate_seqpool_q_onlypad_token_idtie_word_embeddingsc                     | j                   dgt        | j                        z  n| j                   | _         t        |   di | y )N    )r   lenr   super__post_init__)selfkwargs	__class__s     /var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/transformers/models/funnel/configuration_funnel.pyr/   zFunnelConfig.__post_init__K   sA    <@<N<N<VaS3t'7'7#88\`\n\n''    c                    t        | j                        t        | j                        k7  rt        d      | j                  dvrt        d| j                   d      | j
                  dvrt        d| j
                   d      y)zOPart of `@strict`-powered validation. Validates the architecture of the config.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.N)r-   r   r   
ValueErrorr"   r$   r0   s    r3   validate_architecturez"FunnelConfig.validate_architectureO   s    t C(:(:$;;]^^ %
 
 tD$5$5#66rstt '
 
 t**++z{ 	
r4   c                 ,    t        | j                        S N)sumr   r9   s    r3   num_hidden_layerszFunnelConfig.num_hidden_layers`       4##$$r4   c                     t        d      )NzYThis model does not support the setting of `num_hidden_layers`. Please set `block_sizes`.NotImplementedErrorr0   values     r3   r>   zFunnelConfig.num_hidden_layersd   s    !g
 	
r4   c                 ,    t        | j                        S r<   )r-   r   r9   s    r3   
num_blockszFunnelConfig.num_blocksj   r?   r4   c                     t        d      )NzRThis model does not support the setting of `num_blocks`. Please set `block_sizes`.rA   rC   s     r3   rF   zFunnelConfig.num_blocksn   s    !"vwwr4   )*__name__
__module____qualname____doc__
model_typeattribute_mapr   int__annotations__r   listtupler   r   r   r   r   r   r   strr   floatr   r   r   r   r    r"   r$   r%   boolr&   r'   r(   r)   r/   r:   propertyr>   setterrF   __classcell__)r2   s   @r3   r	   r	      s   * J 'M
 J/8KcU38_,8&*M49t#*GSFCFCGS J "%NECK%%(us{(&))"u"$(OUT\( NE L#*NC*L$L$K#L#*# $$(" % % 
 

 % % x xr4   r	   N)	rK   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r	   __all__r,   r4   r3   <module>r\      sN    - . 3 # 56Xx# Xx  7Xxv 
r4   