





"""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 		lowercase					(					_UpperCAmelCase					):
      _SCREAMING_SNAKE_CASE					=      'funnel'
      _SCREAMING_SNAKE_CASE					=      {
          'hidden_size': 'd_model',
          'num_attention_heads': 'n_head',
      }





      def __init__(       self      ,						lowercase=30_522      ,						lowercase=[4, 4, 4]      ,						lowercase=None      ,						lowercase=2      ,						lowercase=768      ,						lowercase=12      ,						lowercase=64      ,						lowercase=3_072      ,						lowercase="gelu_new"      ,						lowercase=0.1      ,						lowercase=0.1      ,						lowercase=0.0      ,						lowercase=0.1      ,						lowercase=None      ,						lowercase=1e-9      ,						lowercase="mean"      ,						lowercase="relative_shift"      ,						lowercase=True      ,						lowercase=True      ,						lowercase=True      ,						**lowercase      ,						)		->     Optional[Any]:
            lowerCAmelCase  						=       vocab_size
            lowerCAmelCase  						=       block_sizes
            lowerCAmelCase  						=       [1] * len(lowercase ) if block_repeats is None else block_repeats
            assert len(lowercase ) == 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__(**lowercase )





      @property
      def     _snake_case			(       self )		->     Tuple:
            return sum(self.block_sizes )





      @num_hidden_layers.setter
      def     _snake_case			(       self      ,						lowercase )		->     Any:
            raise NotImplementedError(
                """This model does not support the setting of `num_hidden_layers`. Please set `block_sizes`.""" )





      @property
      def     _snake_case			(       self )		->     Optional[Any]:
            return len(self.block_sizes )





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













"""simple docstring"""





from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


if TYPE_CHECKING:
       from ... import FeatureExtractionMixin, TensorType

SCREAMING_SNAKE_CASE__					=   logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__					=   {
    "openai/imagegpt-small": "",
    "openai/imagegpt-medium": "",
    "openai/imagegpt-large": "",
}

class 		lowercase					(					_UpperCAmelCase					):
      _SCREAMING_SNAKE_CASE					=      'imagegpt'
      _SCREAMING_SNAKE_CASE					=      ['past_key_values']
      _SCREAMING_SNAKE_CASE					=      {
          'hidden_size': 'n_embd',
          'max_position_embeddings': 'n_positions',
          'num_attention_heads': 'n_head',
          'num_hidden_layers': 'n_layer',
      }





      def __init__(       self      ,						lowercase=512 + 1      ,						lowercase=32 * 32      ,						lowercase=512      ,						lowercase=24      ,						lowercase=8      ,						lowercase=None      ,						lowercase="quick_gelu"      ,						lowercase=0.1      ,						lowercase=0.1      ,						lowercase=0.1      ,						lowercase=1e-5      ,						lowercase=0.02      ,						lowercase=True      ,						lowercase=True      ,						lowercase=False      ,						lowercase=False      ,						lowercase=False      ,						**lowercase      ,						)		->     Any:
            lowerCAmelCase  						=       vocab_size
            lowerCAmelCase  						=       n_positions
            lowerCAmelCase  						=       n_embd
            lowerCAmelCase  						=       n_layer
            lowerCAmelCase  						=       n_head
            lowerCAmelCase  						=       n_inner
            lowerCAmelCase  						=       activation_function
            lowerCAmelCase  						=       resid_pdrop
            lowerCAmelCase  						=       embd_pdrop
            lowerCAmelCase  						=       attn_pdrop
            lowerCAmelCase  						=       layer_norm_epsilon
            lowerCAmelCase  						=       initializer_range
            lowerCAmelCase  						=       scale_attn_weights
            lowerCAmelCase  						=       use_cache
            lowerCAmelCase  						=       scale_attn_by_inverse_layer_idx
            lowerCAmelCase  						=       reorder_and_upcast_attn
            lowerCAmelCase  						=       tie_word_embeddings

            super().__init__(tie_word_embeddings=lowercase      ,						**lowercase )







class 		lowercase					(					_UpperCAmelCase					):





      @property
      def     _snake_case			(       self )		->     Mapping[str, Mapping[int, str]]:
            return OrderedDict(
                [
                    ("""input_ids""", {0: """batch""", 1: """sequence"""}),
                ] )





      def     _snake_case			(       self      ,						lowercase      ,						lowercase = 1      ,						lowercase = -1      ,						lowercase = False      ,						lowercase = None      ,						lowercase = 3      ,						lowercase = 32      ,						lowercase = 32      ,						)		->     Mapping[str, Any]:
            lowerCAmelCase  						=       self._generate_dummy_images(lowercase      ,						lowercase      ,						lowercase      ,						lowercase )
            lowerCAmelCase  						=       dict(preprocessor(images=lowercase      ,						return_tensors=lowercase ) )

            return inputs






