


'''simple docstring'''







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


lowerCAmelCase    :     List[str]					=						logging.get_logger(__name__)

lowerCAmelCase    :     Optional[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 	UpperCamelCase__					( SCREAMING_SNAKE_CASE_	):



     """simple docstring"""






     __magic_name__    			=    "funnel"
     __magic_name__    			=    {
         "hidden_size": "d_model",
         "num_attention_heads": "n_head",
     }







     def __init__( self      ,	snake_case__=3_0522      ,	snake_case__=[4, 4, 4]      ,	snake_case__=None      ,	snake_case__=2      ,	snake_case__=768      ,	snake_case__=12      ,	snake_case__=64      ,	snake_case__=3072      ,	snake_case__="gelu_new"      ,	snake_case__=0.1      ,	snake_case__=0.1      ,	snake_case__=0.0      ,	snake_case__=0.1      ,	snake_case__=None      ,	snake_case__=1E-9      ,	snake_case__="mean"      ,	snake_case__="relative_shift"      ,	snake_case__=True      ,	snake_case__=True      ,	snake_case__=True      ,	**snake_case__      ,	):

            '''simple docstring'''

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

            super().__init__(**snake_case__   )







     @property
     def a	( self   ):

            '''simple docstring'''

            return sum(self.block_sizes   )







     @num_hidden_layers.setter
     def a	( self      ,	snake_case__   ):

            '''simple docstring'''

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







     @property
     def a	( self   ):

            '''simple docstring'''

            return len(self.block_sizes   )







     @num_blocks.setter
     def a	( self      ,	snake_case__   ):

            '''simple docstring'''

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





'''simple docstring'''







import pytest

import datasets


# Import fixture modules as plugins
lowerCAmelCase    :     List[str]					=						["""tests.fixtures.files""", """tests.fixtures.hub""", """tests.fixtures.fsspec"""]






def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       for item in items:
              if any(marker in item.keywords for marker in ['integration', 'unit']					):
                     continue
              item.add_marker(pytest.mark.unit					)






def 			lowercase				(_A					):







       """simple docstring"""







       config.addinivalue_line('markers'   ,						'torchaudio_latest: mark test to run with torchaudio>=0.12'					)






@pytest.fixture(autouse=_A					)
def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _lowerCAmelCase    :							str   			=       tmp_path_factory.getbasetemp() / 'cache'
       _lowerCAmelCase    :							Dict   			=       test_hf_cache_home / 'datasets'
       _lowerCAmelCase    :							List[Any]   			=       test_hf_cache_home / 'metrics'
       _lowerCAmelCase    :							List[Any]   			=       test_hf_cache_home / 'modules'
       monkeypatch.setattr('datasets.config.HF_DATASETS_CACHE'   ,						str(_A					)					)
       monkeypatch.setattr('datasets.config.HF_METRICS_CACHE'   ,						str(_A					)					)
       monkeypatch.setattr('datasets.config.HF_MODULES_CACHE'   ,						str(_A					)					)
       _lowerCAmelCase    :							Dict   			=       test_hf_datasets_cache / 'downloads'
       monkeypatch.setattr('datasets.config.DOWNLOADED_DATASETS_PATH'   ,						str(_A					)					)
       _lowerCAmelCase    :							Union[str, Any]   			=       test_hf_datasets_cache / 'downloads' / 'extracted'
       monkeypatch.setattr('datasets.config.EXTRACTED_DATASETS_PATH'   ,						str(_A					)					)






@pytest.fixture(autouse=_A   ,						scope='session'					)
def 			lowercase				():







       """simple docstring"""







       datasets.disable_progress_bar()






@pytest.fixture(autouse=_A					)
def 			lowercase				(_A					):







       """simple docstring"""







       monkeypatch.setattr('datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'   ,						_A					)






@pytest.fixture
def 			lowercase				(_A					):







       """simple docstring"""







       monkeypatch.setattr('sqlalchemy.util.deprecations.SILENCE_UBER_WARNING'   ,						_A					)

