






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


lowerCamelCase      :       Tuple    =						logging.get_logger(__name__)

lowerCamelCase      :       List[str]    =						{
    '''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      (a_      ):
      snake_case_	=				"""funnel"""
      snake_case_	=				{
          """hidden_size""": """d_model""",
          """num_attention_heads""": """n_head""",
      }


      def __init__(						self       ,    __UpperCamelCase=3_0_5_2_2       ,    __UpperCamelCase=[4, 4, 4]       ,    __UpperCamelCase=None       ,    __UpperCamelCase=2       ,    __UpperCamelCase=7_6_8       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=6_4       ,    __UpperCamelCase=3_0_7_2       ,    __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       ,    )->						List[Any]:
           __lowerCAmelCase             =       vocab_size
           __lowerCAmelCase             =       block_sizes
           __lowerCAmelCase             =       [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."
           __lowerCAmelCase             =       num_decoder_layers
           __lowerCAmelCase             =       d_model
           __lowerCAmelCase             =       n_head
           __lowerCAmelCase             =       d_head
           __lowerCAmelCase             =       d_inner
           __lowerCAmelCase             =       hidden_act
           __lowerCAmelCase             =       hidden_dropout
           __lowerCAmelCase             =       attention_dropout
           __lowerCAmelCase             =       activation_dropout
           __lowerCAmelCase             =       initializer_range
           __lowerCAmelCase             =       initializer_std
           __lowerCAmelCase             =       layer_norm_eps
           assert pooling_type in [
               "mean",
               "max",
           ], F"""Got {pooling_type} for `pooling_type` but only 'mean' and 'max' are supported."""
           __lowerCAmelCase             =       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             =       attention_type
           __lowerCAmelCase             =       separate_cls
           __lowerCAmelCase             =       truncate_seq
           __lowerCAmelCase             =       pool_q_only

           super().__init__(**__UpperCamelCase						)


      @property
      def 			__UpperCAmelCase		(						self						)->						Dict:
           return sum(self.block_sizes						)


      @num_hidden_layers.setter
      def 			__UpperCAmelCase		(						self       ,    __UpperCamelCase						)->						List[str]:
           raise NotImplementedError(
               "This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`."						)


      @property
      def 			__UpperCAmelCase		(						self						)->						Tuple:
           return len(self.block_sizes						)


      @num_blocks.setter
      def 			__UpperCAmelCase		(						self       ,    __UpperCamelCase						)->						int:
           raise NotImplementedError("This model does not support the setting of `num_blocks`. Please set `block_sizes`."						)














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


lowerCamelCase      :       Optional[int]    =						logging.get_logger(__name__)

lowerCamelCase      :       Optional[Any]    =						{
    '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''',
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}



class 				_UpperCamelCase      (a_      ):
      snake_case_	=				"""pegasus"""
      snake_case_	=				["""past_key_values"""]
      snake_case_	=				{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}


      def __init__(						self       ,    __UpperCamelCase=5_0_2_6_5       ,    __UpperCamelCase=1_0_2_4       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=4_0_9_6       ,    __UpperCamelCase=1_6       ,    __UpperCamelCase=1_2       ,    __UpperCamelCase=4_0_9_6       ,    __UpperCamelCase=1_6       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=True       ,    __UpperCamelCase=True       ,    __UpperCamelCase="gelu"       ,    __UpperCamelCase=1_0_2_4       ,    __UpperCamelCase=0.1       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=0.0       ,    __UpperCamelCase=0.0_2       ,    __UpperCamelCase=0       ,    __UpperCamelCase=False       ,    __UpperCamelCase=0       ,    __UpperCamelCase=1       ,    __UpperCamelCase=1       ,    **__UpperCamelCase       ,    )->						Tuple:
           __lowerCAmelCase             =       vocab_size
           __lowerCAmelCase             =       max_position_embeddings
           __lowerCAmelCase             =       d_model
           __lowerCAmelCase             =       encoder_ffn_dim
           __lowerCAmelCase             =       encoder_layers
           __lowerCAmelCase             =       encoder_attention_heads
           __lowerCAmelCase             =       decoder_ffn_dim
           __lowerCAmelCase             =       decoder_layers
           __lowerCAmelCase             =       decoder_attention_heads
           __lowerCAmelCase             =       dropout
           __lowerCAmelCase             =       attention_dropout
           __lowerCAmelCase             =       activation_dropout
           __lowerCAmelCase             =       activation_function
           __lowerCAmelCase             =       init_std
           __lowerCAmelCase             =       encoder_layerdrop
           __lowerCAmelCase             =       decoder_layerdrop
           __lowerCAmelCase             =       use_cache
           __lowerCAmelCase             =       encoder_layers
           __lowerCAmelCase             =       scale_embedding  # scale factor will be sqrt(d_model) if True
           super().__init__(
               pad_token_id=__UpperCamelCase       ,    eos_token_id=__UpperCamelCase       ,    is_encoder_decoder=__UpperCamelCase       ,    decoder_start_token_id=__UpperCamelCase       ,    forced_eos_token_id=__UpperCamelCase       ,    **__UpperCamelCase       ,    )


      @property
      def 			__UpperCAmelCase		(						self						)->						int:
           return self.encoder_attention_heads


      @property
      def 			__UpperCAmelCase		(						self						)->						int:
           return self.d_model






