"""simple docstring"""







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


__SCREAMING_SNAKE_CASE    	=logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE    	={
    "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        UpperCamelCase		(			lowercase_  ):
   lowercase							=  'funnel'
   lowercase							=  {
       'hidden_size': 'd_model',
       'num_attention_heads': 'n_head',
   }
   def __init__(			self     ,__UpperCamelCase=3_0522     ,__UpperCamelCase=[4, 4, 4]     ,__UpperCamelCase=None     ,__UpperCamelCase=2     ,__UpperCamelCase=768     ,__UpperCamelCase=12     ,__UpperCamelCase=64     ,__UpperCamelCase=3072     ,__UpperCamelCase="gelu_new"     ,__UpperCamelCase=0.1     ,__UpperCamelCase=0.1     ,__UpperCamelCase=0.0     ,__UpperCamelCase=0.1     ,__UpperCamelCase=None     ,__UpperCamelCase=1e-9     ,__UpperCamelCase="mean"     ,__UpperCamelCase="relative_shift"     ,__UpperCamelCase=True     ,__UpperCamelCase=True     ,__UpperCamelCase=True     ,**__UpperCamelCase     ,)	->      Dict:


        '''simple docstring'''


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

        super().__init__(**__UpperCamelCase			)
   @property
   def 			_UpperCAmelCase   (			self			)	->      Any:


        '''simple docstring'''


        return sum(self.block_sizes			)
   @num_hidden_layers.setter
   def 			_UpperCAmelCase   (			self     ,__UpperCamelCase			)	->      Tuple:


        '''simple docstring'''


        raise NotImplementedError(
            'This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`.'			)
   @property
   def 			_UpperCAmelCase   (			self			)	->      Any:


        '''simple docstring'''


        return len(self.block_sizes			)







   @num_blocks.setter
   def 			_UpperCAmelCase   (			self     ,__UpperCamelCase			)	->      Tuple:


        '''simple docstring'''


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


"""simple docstring"""







import sys

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

__SCREAMING_SNAKE_CASE    	="python tqdm regex requests packaging filelock numpy tokenizers".split()
if sys.version_info < (3, 7):
       pkgs_to_check_at_runtime.append("dataclasses")
if sys.version_info < (3, 8):
       pkgs_to_check_at_runtime.append("importlib_metadata")

for pkg in pkgs_to_check_at_runtime:
       if pkg in deps:
              if pkg == "tokenizers":
                     # must be loaded here, or else tqdm check may fail
                     from .utils import is_tokenizers_available

                     if not is_tokenizers_available():
                            continue  # not required, check version only if installed

              require_version_core(deps[pkg])
       else:
              raise ValueError(F"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py")



def 			lowercase__(       __SCREAMING_SNAKE_CASE							:     int     ,			__SCREAMING_SNAKE_CASE							:     Union[str, Any]=None      ):
     require_version(deps[pkg]     ,			__SCREAMING_SNAKE_CASE      )

