



from typing import Mapping

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


lowerCAmelCase__						:	List[str]					=logging.get_logger(__name__)

lowerCAmelCase__						:	Tuple					={
    '''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   UpperCAmelCase_    (  UpperCamelCase_			):

						'''simple docstring'''




						UpperCamelCase__     :					List[str]							    =    "umt5"
						UpperCamelCase__     :					List[Any]							    =    ["past_key_values"]






						def __init__(       self ,				_A=250_112 ,				_A=512 ,				_A=64 ,				_A=1_024 ,				_A=8 ,				_A=None ,				_A=6 ,				_A=32 ,				_A=128 ,				_A=0.1 ,				_A=1e-6 ,				_A=1.0 ,				_A="gated-gelu" ,				_A=True ,				_A=True ,				_A="T5Tokenizer" ,				_A=True ,				_A=0 ,				_A=1 ,				_A=0 ,				**_A ,				):







													'''simple docstring'''

													super().__init__(
													    is_encoder_decoder=_lowerCAmelCase ,				tokenizer_class=_lowerCAmelCase ,				tie_word_embeddings=_lowerCAmelCase ,				pad_token_id=_lowerCAmelCase ,				eos_token_id=_lowerCAmelCase ,				decoder_start_token_id=_lowerCAmelCase ,				**_lowerCAmelCase ,				)
													__SCREAMING_SNAKE_CASE										=   vocab_size
													__SCREAMING_SNAKE_CASE										=   d_model
													__SCREAMING_SNAKE_CASE										=   d_kv
													__SCREAMING_SNAKE_CASE										=   d_ff
													__SCREAMING_SNAKE_CASE										=   num_layers
													__SCREAMING_SNAKE_CASE										=   (
													    num_decoder_layers if num_decoder_layers is not None else self.num_layers
													)  # default = symmetry
													__SCREAMING_SNAKE_CASE										=   num_heads
													__SCREAMING_SNAKE_CASE										=   relative_attention_num_buckets
													__SCREAMING_SNAKE_CASE										=   relative_attention_max_distance
													__SCREAMING_SNAKE_CASE										=   dropout_rate
													__SCREAMING_SNAKE_CASE										=   layer_norm_epsilon
													__SCREAMING_SNAKE_CASE										=   initializer_factor
													__SCREAMING_SNAKE_CASE										=   feed_forward_proj
													__SCREAMING_SNAKE_CASE										=   use_cache

													__SCREAMING_SNAKE_CASE										=   self.feed_forward_proj.split('-'						)
													__SCREAMING_SNAKE_CASE										=   act_info[-1]
													__SCREAMING_SNAKE_CASE										=   act_info[0] == 'gated'

													if len(_lowerCAmelCase						) > 1 and act_info[0] != "gated" or len(_lowerCAmelCase						) > 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":
																				__SCREAMING_SNAKE_CASE										=   'gelu_new'






						@property
						def 			_A      (       self						):







													'''simple docstring'''

													return self.d_model






						@property
						def 			_A      (       self						):







													'''simple docstring'''

													return self.num_heads






						@property
						def 			_A      (       self						):







													'''simple docstring'''

													return self.num_layers







class   UpperCAmelCase_    (  UpperCamelCase_			):

						'''simple docstring'''




						@property
						# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs
						def 			_A      (       self						):







													'''simple docstring'''

													__SCREAMING_SNAKE_CASE										=   {
													    'input_ids': {0: 'batch', 1: 'encoder_sequence'},
													    'attention_mask': {0: 'batch', 1: 'encoder_sequence'},
													}
													if self.use_past:
																				__SCREAMING_SNAKE_CASE										=   'past_encoder_sequence + sequence'
																				__SCREAMING_SNAKE_CASE										=   {0: 'batch'}
																				__SCREAMING_SNAKE_CASE										=   {0: 'batch', 1: 'past_decoder_sequence + sequence'}
													else:
																				__SCREAMING_SNAKE_CASE										=   {0: 'batch', 1: 'decoder_sequence'}
																				__SCREAMING_SNAKE_CASE										=   {0: 'batch', 1: 'decoder_sequence'}

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

													return common_inputs






						@property
						# Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
						def 			_A      (       self						):







													'''simple docstring'''

													return 13






						@property
						def 			_A      (       self						):







													'''simple docstring'''

													return 5e-4













'''simple docstring'''


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


_SCREAMING_SNAKE_CASE									=				logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE									=				{
    "bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}

class  lowerCAmelCase_		(		__magic_name__		):
 __lowerCamelCase    :				str								=       "gpt_bigcode"
 __lowerCamelCase    :				Optional[int]								=       ["past_key_values"]
 __lowerCamelCase    :				List[str]								=       {
     "hidden_size": "n_embd",
     "max_position_embeddings": "n_positions",
     "num_attention_heads": "n_head",
     "num_hidden_layers": "n_layer",
 }




 def __init__(						self      ,  _lowerCAmelCase=50257      ,  _lowerCAmelCase=1024      ,  _lowerCAmelCase=768      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase="gelu_pytorch_tanh"      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=1E-5      ,  _lowerCAmelCase=0.02      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=50256      ,  _lowerCAmelCase=50256      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=True      ,  **_lowerCAmelCase      ,  )     ->				List[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						      =   attention_softmax_in_fpaa
     _lowerCAmelCase						      =   scale_attention_softmax_in_fpaa
     _lowerCAmelCase						      =   multi_query

     _lowerCAmelCase						      =   bos_token_id
     _lowerCAmelCase						      =   eos_token_id

     super().__init__(bos_token_id=_lowerCAmelCase      ,  eos_token_id=_lowerCAmelCase      ,  **_lowerCAmelCase		)


