




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


lowercase__  		=		logging.get_logger(__name__)

lowercase__  		=		{
    'google/realm-cc-news-pretrained-embedder': (
        'https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/config.json'
    ),
    'google/realm-cc-news-pretrained-encoder': (
        'https://huggingface.co/google/realm-cc-news-pretrained-encoder/resolve/main/config.json'
    ),
    'google/realm-cc-news-pretrained-scorer': (
        'https://huggingface.co/google/realm-cc-news-pretrained-scorer/resolve/main/config.json'
    ),
    'google/realm-cc-news-pretrained-openqa': (
        'https://huggingface.co/google/realm-cc-news-pretrained-openqa/aresolve/main/config.json'
    ),
    'google/realm-orqa-nq-openqa': 'https://huggingface.co/google/realm-orqa-nq-openqa/resolve/main/config.json',
    'google/realm-orqa-nq-reader': 'https://huggingface.co/google/realm-orqa-nq-reader/resolve/main/config.json',
    'google/realm-orqa-wq-openqa': 'https://huggingface.co/google/realm-orqa-wq-openqa/resolve/main/config.json',
    'google/realm-orqa-wq-reader': 'https://huggingface.co/google/realm-orqa-wq-reader/resolve/main/config.json',
    # See all REALM models at https://huggingface.co/models?filter=realm
}






class lowerCAmelCase__			(  __lowercase		):






			'''simple docstring'''



			lowerCamelCase__   =    '''realm'''
			def __init__(						self						,   lowercase=30522						,   lowercase=768						,   lowercase=128						,   lowercase=12						,   lowercase=12						,   lowercase=8						,   lowercase=3072						,   lowercase="gelu_new"						,   lowercase=0.1						,   lowercase=0.1						,   lowercase=512						,   lowercase=2						,   lowercase=0.02						,   lowercase=1E-12						,   lowercase=256						,   lowercase=10						,   lowercase=1E-3						,   lowercase=5						,   lowercase=320						,   lowercase=13353718						,   lowercase=5000						,   lowercase=1						,   lowercase=0						,   lowercase=2						,   **lowercase						,   ):
							super().__init__(pad_token_id=__a						,   bos_token_id=__a						,   eos_token_id=__a						,   **__a						)

							# Common config
							_lowerCamelCase  :    Optional[Any]					=					vocab_size
							_lowerCamelCase  :    str					=					max_position_embeddings
							_lowerCamelCase  :    Dict					=					hidden_size
							_lowerCamelCase  :    Dict					=					retriever_proj_size
							_lowerCamelCase  :    Optional[Any]					=					num_hidden_layers
							_lowerCamelCase  :    List[str]					=					num_attention_heads
							_lowerCamelCase  :    Tuple					=					num_candidates
							_lowerCamelCase  :    int					=					intermediate_size
							_lowerCamelCase  :    Dict					=					hidden_act
							_lowerCamelCase  :    List[str]					=					hidden_dropout_prob
							_lowerCamelCase  :    Dict					=					attention_probs_dropout_prob
							_lowerCamelCase  :    Optional[int]					=					initializer_range
							_lowerCamelCase  :    Dict					=					type_vocab_size
							_lowerCamelCase  :    Optional[Any]					=					layer_norm_eps

							# Reader config
							_lowerCamelCase  :    List[str]					=					span_hidden_size
							_lowerCamelCase  :    Dict					=					max_span_width
							_lowerCamelCase  :    Optional[Any]					=					reader_layer_norm_eps
							_lowerCamelCase  :    Optional[int]					=					reader_beam_size
							_lowerCamelCase  :    List[Any]					=					reader_seq_len

							# Retrieval config
							_lowerCamelCase  :    int					=					num_block_records
							_lowerCamelCase  :    Dict					=					searcher_beam_size





"""simple docstring"""






from typing import Mapping

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


lowercase__  		=		logging.get_logger(__name__)

lowercase__  		=		{
    """google/umt5-small""": """https://huggingface.co/google/umt5-small/resolve/main/config.json""",
    # See all umt5 models at https://huggingface.co/models?filter=umt5
}






class lowerCAmelCase__			(  lowercase		):






			'''simple docstring'''



			lowerCamelCase__   =    """umt5"""
			lowerCamelCase__   =    ["""past_key_values"""]
			def __init__(						self						,   lowercase=250112						,   lowercase=512						,   lowercase=64						,   lowercase=1024						,   lowercase=8						,   lowercase=None						,   lowercase=6						,   lowercase=32						,   lowercase=128						,   lowercase=0.1						,   lowercase=1E-6						,   lowercase=1.0						,   lowercase="gated-gelu"						,   lowercase=True						,   lowercase=True						,   lowercase="T5Tokenizer"						,   lowercase=True						,   lowercase=0						,   lowercase=1						,   lowercase=0						,   **lowercase						,   ):
							super().__init__(
							    is_encoder_decoder=lowercase						,   tokenizer_class=lowercase						,   tie_word_embeddings=lowercase						,   pad_token_id=lowercase						,   eos_token_id=lowercase						,   decoder_start_token_id=lowercase						,   **lowercase						,   )
							_lowerCamelCase  :    Union[str, Any]					=					vocab_size
							_lowerCamelCase  :    Optional[Any]					=					d_model
							_lowerCamelCase  :    Optional[Any]					=					d_kv
							_lowerCamelCase  :    Optional[int]					=					d_ff
							_lowerCamelCase  :    List[str]					=					num_layers
							_lowerCamelCase  :    Union[str, Any]					=					(
							    num_decoder_layers if num_decoder_layers is not None else self.num_layers
							)  # default = symmetry
							_lowerCamelCase  :    List[str]					=					num_heads
							_lowerCamelCase  :    int					=					relative_attention_num_buckets
							_lowerCamelCase  :    Union[str, Any]					=					relative_attention_max_distance
							_lowerCamelCase  :    int					=					dropout_rate
							_lowerCamelCase  :    List[Any]					=					layer_norm_epsilon
							_lowerCamelCase  :    Union[str, Any]					=					initializer_factor
							_lowerCamelCase  :    List[Any]					=					feed_forward_proj
							_lowerCamelCase  :    Dict					=					use_cache

							_lowerCamelCase  :    Dict					=					self.feed_forward_proj.split('-'						)
							_lowerCamelCase  :    List[str]					=					act_info[-1]
							_lowerCamelCase  :    int					=					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\''						)

							if feed_forward_proj == "gated-gelu":
											_lowerCamelCase  :    Optional[int]					=					'gelu_new'
			@property
			def       A_					(						self						):
							return self.d_model
			@property
			def       A_					(						self						):
							return self.num_heads






			@property
			def       A_					(						self						):
							return self.num_layers






class lowerCAmelCase__			(  lowercase		):






			'''simple docstring'''



			@property
			# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs
			def       A_					(						self						):
							_lowerCamelCase  :    Tuple					=					{
							    'input_ids': {0: 'batch', 1: 'encoder_sequence'},
							    'attention_mask': {0: 'batch', 1: 'encoder_sequence'},
							}
							if self.use_past:
											_lowerCamelCase  :    Optional[int]					=					'past_encoder_sequence + sequence'
											_lowerCamelCase  :    int					=					{0: 'batch'}
											_lowerCamelCase  :    List[str]					=					{0: 'batch', 1: 'past_decoder_sequence + sequence'}
							else:
											_lowerCamelCase  :    Dict					=					{0: 'batch', 1: 'decoder_sequence'}
											_lowerCamelCase  :    str					=					{0: 'batch', 1: 'decoder_sequence'}

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

							return common_inputs
			@property
			# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
			def       A_					(						self						):
							return 13






			@property
			def       A_					(						self						):
							return 5E-4