


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


a			:			Union[str, Any]												=					logging.get_logger(__name__)

a			:			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 						lowerCamelCase_							(					lowerCAmelCase__					):



					'''simple docstring'''







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






					def __init__(					self			,							snake_case_=3_0_5_2_2			,							snake_case_=[4, 4, 4]			,							snake_case_=None			,							snake_case_=2			,							snake_case_=7_6_8			,							snake_case_=1_2			,							snake_case_=6_4			,							snake_case_=3_0_7_2			,							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_			,							) ->      int:







								'''simple docstring'''

								__lowercase			       = vocab_size
								__lowercase			       = block_sizes
								__lowercase			       = [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."
								__lowercase			       = num_decoder_layers
								__lowercase			       = d_model
								__lowercase			       = n_head
								__lowercase			       = d_head
								__lowercase			       = d_inner
								__lowercase			       = hidden_act
								__lowercase			       = hidden_dropout
								__lowercase			       = attention_dropout
								__lowercase			       = activation_dropout
								__lowercase			       = initializer_range
								__lowercase			       = initializer_std
								__lowercase			       = layer_norm_eps
								assert pooling_type in [
								    "mean",
								    "max",
								], F'Got {pooling_type} for `pooling_type` but only \'mean\' and \'max\' are supported.'
								__lowercase			       = 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			       = attention_type
								__lowercase			       = separate_cls
								__lowercase			       = truncate_seq
								__lowercase			       = pool_q_only

								super().__init__(**snake_case_    )






					@property
					def A   (					self    ) ->      Dict:







								'''simple docstring'''

								return sum(self.block_sizes    )






					@num_hidden_layers.setter
					def A   (					self			,							snake_case_    ) ->      Tuple:







								'''simple docstring'''

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






					@property
					def A   (					self    ) ->      Dict:







								'''simple docstring'''

								return len(self.block_sizes    )






					@num_blocks.setter
					def A   (					self			,							snake_case_    ) ->      Tuple:







								'''simple docstring'''

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






from typing import Optional

from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader
class 						lowerCamelCase_							(					lowerCAmelCase__					):



					'''simple docstring'''







					def __init__(					self			,							snake_case_			,							snake_case_ = None			,							snake_case_ = None			,							snake_case_ = None			,							snake_case_ = False			,							snake_case_ = False			,							snake_case_ = None			,							**snake_case_			,							) ->      Dict:







								'''simple docstring'''

								super().__init__(
								    snake_case_			,							split=snake_case_			,							features=snake_case_			,							cache_dir=snake_case_			,							keep_in_memory=snake_case_			,							streaming=snake_case_			,							num_proc=snake_case_			,							**snake_case_			,							)
								__lowercase			       = path_or_paths if isinstance(snake_case_			,							snake_case_    ) else {self.split: path_or_paths}
								__lowercase			       = Text(
								    cache_dir=snake_case_			,							data_files=snake_case_			,							features=snake_case_			,							**snake_case_			,							)






					def A   (					self    ) ->      int:







								'''simple docstring'''

								if self.streaming:
											__lowercase			       = self.builder.as_streaming_dataset(split=self.split    )
								# Build regular (map-style) dataset
								else:
											__lowercase			       = None
											__lowercase			       = None
											__lowercase			       = None
											__lowercase			       = None

											self.builder.download_and_prepare(
											    download_config=snake_case_			,							download_mode=snake_case_			,							verification_mode=snake_case_			,							base_path=snake_case_			,							num_proc=self.num_proc			,							)
											__lowercase			       = self.builder.as_dataset(
											    split=self.split			,							verification_mode=snake_case_			,							in_memory=self.keep_in_memory    )
								return dataset


