


from typing import Mapping

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


__a       =					logging.get_logger(__name__)

__a       =					{
    '''t5-small''': '''https://huggingface.co/t5-small/resolve/main/config.json''',
    '''t5-base''': '''https://huggingface.co/t5-base/resolve/main/config.json''',
    '''t5-large''': '''https://huggingface.co/t5-large/resolve/main/config.json''',
    '''t5-3b''': '''https://huggingface.co/t5-3b/resolve/main/config.json''',
    '''t5-11b''': '''https://huggingface.co/t5-11b/resolve/main/config.json''',
}







class  __SCREAMING_SNAKE_CASE      (	a_      ):
      A :							Optional[int]										=   't5'
      A :							Optional[Any]										=   ['past_key_values']
      A :							Optional[int]										=   {'hidden_size': 'd_model', 'num_attention_heads': 'num_heads', 'num_hidden_layers': 'num_layers'}


      def __init__(							self							,  SCREAMING_SNAKE_CASE__=32128							,  SCREAMING_SNAKE_CASE__=512							,  SCREAMING_SNAKE_CASE__=64							,  SCREAMING_SNAKE_CASE__=2048							,  SCREAMING_SNAKE_CASE__=6							,  SCREAMING_SNAKE_CASE__=None							,  SCREAMING_SNAKE_CASE__=8							,  SCREAMING_SNAKE_CASE__=32							,  SCREAMING_SNAKE_CASE__=128							,  SCREAMING_SNAKE_CASE__=0.1							,  SCREAMING_SNAKE_CASE__=1E-6							,  SCREAMING_SNAKE_CASE__=1.0							,  SCREAMING_SNAKE_CASE__="relu"							,  SCREAMING_SNAKE_CASE__=True							,  SCREAMING_SNAKE_CASE__=True							,  SCREAMING_SNAKE_CASE__=0							,  SCREAMING_SNAKE_CASE__=1							,  **SCREAMING_SNAKE_CASE__							,  ):
            lowercase	:      List[str]          =						vocab_size
            lowercase	:      Union[str, Any]          =						d_model
            lowercase	:      int          =						d_kv
            lowercase	:      str          =						d_ff
            lowercase	:      Optional[Any]          =						num_layers
            lowercase	:      Any          =						(
                num_decoder_layers if num_decoder_layers is not None else self.num_layers
            )  # default = symmetry
            lowercase	:      Dict          =						num_heads
            lowercase	:      Optional[Any]          =						relative_attention_num_buckets
            lowercase	:      Optional[Any]          =						relative_attention_max_distance
            lowercase	:      Any          =						dropout_rate
            lowercase	:      Optional[Any]          =						layer_norm_epsilon
            lowercase	:      Dict          =						initializer_factor
            lowercase	:      str          =						feed_forward_proj
            lowercase	:      List[Any]          =						use_cache

            lowercase	:      Optional[Any]          =						self.feed_forward_proj.split('''-'''						)
            lowercase	:      Tuple          =						act_info[-1]
            lowercase	:      List[Any]          =						act_info[0] == '''gated'''

            if len(lowercase_						) > 1 and act_info[0] != "gated" or len(lowercase_						) > 2:
                  raise ValueError(
                      f"""`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer."""
                      '''Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. '''
                      '''\'gated-gelu\' or \'relu\''''						)

            # for backwards compatibility
            if feed_forward_proj == "gated-gelu":
                  lowercase	:      Optional[Any]          =						'''gelu_new'''

            super().__init__(
                pad_token_id=lowercase_							,  eos_token_id=lowercase_							,  is_encoder_decoder=lowercase_							,  **lowercase_							,  )







class  __SCREAMING_SNAKE_CASE      (	a_      ):


      @property
      def 				__lowerCamelCase	(							self						):
            lowercase	:      List[Any]          =						{
                '''input_ids''': {0: '''batch''', 1: '''encoder_sequence'''},
                '''attention_mask''': {0: '''batch''', 1: '''encoder_sequence'''},
            }
            if self.use_past:
                  lowercase	:      Tuple          =						'''past_encoder_sequence + sequence'''
                  lowercase	:      List[Any]          =						{0: '''batch'''}
                  lowercase	:      List[str]          =						{0: '''batch''', 1: '''past_decoder_sequence + sequence'''}
            else:
                  lowercase	:      Optional[Any]          =						{0: '''batch''', 1: '''decoder_sequence'''}
                  lowercase	:      Dict          =						{0: '''batch''', 1: '''decoder_sequence'''}

            if self.use_past:
                  self.fill_with_past_key_values_(lowercase_							,  direction='''inputs'''						)

            return common_inputs






      @property
      def 				__lowerCamelCase	(							self						):
            return 13




"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


__UpperCamelCase  :      Dict							      =		{
    '''configuration_clip''': [
        '''CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''CLIPConfig''',
        '''CLIPOnnxConfig''',
        '''CLIPTextConfig''',
        '''CLIPVisionConfig''',
    ],
    '''processing_clip''': ['''CLIPProcessor'''],
    '''tokenization_clip''': ['''CLIPTokenizer'''],
}

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase  :      int							      =		['''CLIPTokenizerFast''']

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase  :      Optional[int]							      =		['''CLIPFeatureExtractor''']
							__UpperCamelCase  :      Optional[Any]							      =		['''CLIPImageProcessor''']

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase  :      Tuple							      =		[
							    '''CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''CLIPModel''',
							    '''CLIPPreTrainedModel''',
							    '''CLIPTextModel''',
							    '''CLIPTextModelWithProjection''',
							    '''CLIPVisionModel''',
							    '''CLIPVisionModelWithProjection''',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase  :      Optional[int]							      =		[
							    '''TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''TFCLIPModel''',
							    '''TFCLIPPreTrainedModel''',
							    '''TFCLIPTextModel''',
							    '''TFCLIPVisionModel''',
							]

try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__UpperCamelCase  :      Optional[Any]							      =		[
							    '''FlaxCLIPModel''',
							    '''FlaxCLIPPreTrainedModel''',
							    '''FlaxCLIPTextModel''',
							    '''FlaxCLIPTextPreTrainedModel''',
							    '''FlaxCLIPVisionModel''',
							    '''FlaxCLIPVisionPreTrainedModel''',
							]


if TYPE_CHECKING:
							from .configuration_clip import (
							    CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    CLIPConfig,
							    CLIPOnnxConfig,
							    CLIPTextConfig,
							    CLIPVisionConfig,
							)
							from .processing_clip import CLIPProcessor
							from .tokenization_clip import CLIPTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_clip_fast import CLIPTokenizerFast

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .feature_extraction_clip import CLIPFeatureExtractor
														from .image_processing_clip import CLIPImageProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_clip import (
														    CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
														    CLIPModel,
														    CLIPPreTrainedModel,
														    CLIPTextModel,
														    CLIPTextModelWithProjection,
														    CLIPVisionModel,
														    CLIPVisionModelWithProjection,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_clip import (
														    TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFCLIPModel,
														    TFCLIPPreTrainedModel,
														    TFCLIPTextModel,
														    TFCLIPVisionModel,
														)

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_clip import (
														    FlaxCLIPModel,
														    FlaxCLIPPreTrainedModel,
														    FlaxCLIPTextModel,
														    FlaxCLIPTextPreTrainedModel,
														    FlaxCLIPVisionModel,
														    FlaxCLIPVisionPreTrainedModel,
														)


else:
							import sys

							__UpperCamelCase  :      Tuple							      =		_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




