



from ...configuration_utils import PretrainedConfig
from ...utils import logging


__snake_case						:List[Any]						=					logging.get_logger(__name__)

__snake_case						:Union[str, Any]						=					{
    '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/main/config.json''',
    '''funnel-transformer/small-base''': '''https://huggingface.co/funnel-transformer/small-base/resolve/main/config.json''',
    '''funnel-transformer/medium''': '''https://huggingface.co/funnel-transformer/medium/resolve/main/config.json''',
    '''funnel-transformer/medium-base''': '''https://huggingface.co/funnel-transformer/medium-base/resolve/main/config.json''',
    '''funnel-transformer/intermediate''': (
        '''https://huggingface.co/funnel-transformer/intermediate/resolve/main/config.json'''
    ),
    '''funnel-transformer/intermediate-base''': (
        '''https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/config.json'''
    ),
    '''funnel-transformer/large''': '''https://huggingface.co/funnel-transformer/large/resolve/main/config.json''',
    '''funnel-transformer/large-base''': '''https://huggingface.co/funnel-transformer/large-base/resolve/main/config.json''',
    '''funnel-transformer/xlarge''': '''https://huggingface.co/funnel-transformer/xlarge/resolve/main/config.json''',
    '''funnel-transformer/xlarge-base''': '''https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/config.json''',
}

class    _A	(     __UpperCAmelCase   ):
       UpperCamelCase__  :   Dict						 =						'''funnel'''
       UpperCamelCase__  :   Any						 =						{
           '''hidden_size''': '''d_model''',
           '''num_attention_heads''': '''n_head''',
       }



       def __init__(		self							:					List[str]					,		__SCREAMING_SNAKE_CASE							:					Tuple=30_522					,		__SCREAMING_SNAKE_CASE							:					Union[str, Any]=[4, 4, 4]					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=None					,		__SCREAMING_SNAKE_CASE							:					Tuple=2					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=768					,		__SCREAMING_SNAKE_CASE							:					Dict=12					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=64					,		__SCREAMING_SNAKE_CASE							:					int=3_072					,		__SCREAMING_SNAKE_CASE							:					str="gelu_new"					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=0.1					,		__SCREAMING_SNAKE_CASE							:					Tuple=0.1					,		__SCREAMING_SNAKE_CASE							:					Optional[int]=0.0					,		__SCREAMING_SNAKE_CASE							:					List[str]=0.1					,		__SCREAMING_SNAKE_CASE							:					str=None					,		__SCREAMING_SNAKE_CASE							:					Tuple=1E-9					,		__SCREAMING_SNAKE_CASE							:					List[str]="mean"					,		__SCREAMING_SNAKE_CASE							:					Optional[int]="relative_shift"					,		__SCREAMING_SNAKE_CASE							:					str=True					,		__SCREAMING_SNAKE_CASE							:					int=True					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]=True					,		**__SCREAMING_SNAKE_CASE							:					Optional[Any]					,		):


           '''simple docstring'''

           __a							=    vocab_size
           __a							=    block_sizes
           __a							=    [1] * len(__SCREAMING_SNAKE_CASE) if block_repeats is None else block_repeats
           assert len(__SCREAMING_SNAKE_CASE) == len(
               self.block_repeats), "`block_sizes` and `block_repeats` should have the same length."
           __a							=    num_decoder_layers
           __a							=    d_model
           __a							=    n_head
           __a							=    d_head
           __a							=    d_inner
           __a							=    hidden_act
           __a							=    hidden_dropout
           __a							=    attention_dropout
           __a							=    activation_dropout
           __a							=    initializer_range
           __a							=    initializer_std
           __a							=    layer_norm_eps
           assert pooling_type in [
               "mean",
               "max",
           ], F'Got {pooling_type} for `pooling_type` but only \'mean\' and \'max\' are supported.'
           __a							=    pooling_type
           assert attention_type in [
               "relative_shift",
               "factorized",
           ], F'Got {attention_type} for `attention_type` but only \'relative_shift\' and \'factorized\' are supported.'
           __a							=    attention_type
           __a							=    separate_cls
           __a							=    truncate_seq
           __a							=    pool_q_only

           super().__init__(**__SCREAMING_SNAKE_CASE)



       @property
       def 		_lowerCamelCase      (		self							:					List[Any]):


           '''simple docstring'''

           return sum(self.block_sizes)



       @num_hidden_layers.setter
       def 		_lowerCamelCase      (		self							:					List[str]					,		__SCREAMING_SNAKE_CASE							:					Any):


           '''simple docstring'''

           raise NotImplementedError(
               '''This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`.''')



       @property
       def 		_lowerCamelCase      (		self							:					Any):


           '''simple docstring'''

           return len(self.block_sizes)





       @num_blocks.setter
       def 		_lowerCamelCase      (		self							:					List[str]					,		__SCREAMING_SNAKE_CASE							:					Optional[Any]):


           '''simple docstring'''

           raise NotImplementedError('''This model does not support the setting of `num_blocks`. Please set `block_sizes`.''')










def 					__snake_case     (      _UpperCAmelCase    ):
    if not isinstance(_UpperCAmelCase       ,			_UpperCAmelCase    ):
        raise TypeError('''Input value must be an \'int\' type'''    )

    __a							=    0
    while number:
        position += 1
        number >>= 1

    return position


if __name__ == "__main__":
 import doctest

 doctest.testmod()





