



'''simple docstring'''

import copy

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


UpperCAmelCase			=    logging.get_logger(__name__)

UpperCAmelCase			=    {}

class __snake_case(      _lowerCAmelCase					):


						'''simple docstring'''



						UpperCAmelCase							:    Tuple           =		"fsmt_decoder"


						def __init__(					self	,       A_=0	,       A_=0      )	->	Union[str, Any]:
							super().__init__()
							lowerCAmelCase    =	vocab_size
							lowerCAmelCase    =	bos_token_id







class __snake_case(      _lowerCAmelCase					):


						'''simple docstring'''



						UpperCAmelCase							:    Optional[int]           =		"fsmt"
						UpperCAmelCase							:    Tuple           =		{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}


						def __init__(					self	,       A_=["en", "de"]	,       A_=4_2024	,       A_=4_2024	,       A_="relu"	,       A_=1024	,       A_=200	,       A_=1024	,       A_=4096	,       A_=12	,       A_=16	,       A_=0.0	,       A_=4096	,       A_=12	,       A_=16	,       A_=0.0	,       A_=0.0	,       A_=0.1	,       A_=0.0	,       A_=0.0_2	,       A_=2	,       A_=True	,       A_=True	,       A_=False	,       A_=5	,       A_=1.0	,       A_=False	,       A_=True	,       A_=1	,       A_=0	,       A_=2	,       A_=2	,       **A_	,       )	->	str:
							lowerCAmelCase    =	langs
							lowerCAmelCase    =	src_vocab_size
							lowerCAmelCase    =	tgt_vocab_size
							lowerCAmelCase    =	d_model  # encoder_embed_dim and decoder_embed_dim

							lowerCAmelCase    =	encoder_ffn_dim
							lowerCAmelCase    =	lowerCAmelCase    =	encoder_layers
							lowerCAmelCase    =	encoder_attention_heads
							lowerCAmelCase    =	encoder_layerdrop
							lowerCAmelCase    =	decoder_layerdrop
							lowerCAmelCase    =	decoder_ffn_dim
							lowerCAmelCase    =	decoder_layers
							lowerCAmelCase    =	decoder_attention_heads
							lowerCAmelCase    =	max_position_embeddings
							lowerCAmelCase    =	init_std  # Normal(0, this parameter)
							lowerCAmelCase    =	activation_function

							lowerCAmelCase    =	DecoderConfig(vocab_size=lowercase_	,       bos_token_id=lowercase_      )
							if "decoder" in common_kwargs:
								del common_kwargs["decoder"]

							lowerCAmelCase    =	scale_embedding  # scale factor will be sqrt(d_model) if True

							# 3 Types of Dropout
							lowerCAmelCase    =	attention_dropout
							lowerCAmelCase    =	activation_dropout
							lowerCAmelCase    =	dropout

							lowerCAmelCase    =	use_cache
							super().__init__(
							    pad_token_id=lowercase_	,       bos_token_id=lowercase_	,       eos_token_id=lowercase_	,       decoder_start_token_id=lowercase_	,       is_encoder_decoder=lowercase_	,       tie_word_embeddings=lowercase_	,       forced_eos_token_id=lowercase_	,       max_length=lowercase_	,       num_beams=lowercase_	,       length_penalty=lowercase_	,       early_stopping=lowercase_	,       **lowercase_	,       )




						def 				__snake_case    (					self      )	->	Optional[Any]:
							lowerCAmelCase    =	copy.deepcopy(self.__dict__      )
							lowerCAmelCase    =	self.decoder.to_dict()
							lowerCAmelCase    =	self.__class__.model_type
							return output
from collections import OrderedDict
from typing import Mapping

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


lowerCamelCase__   = logging.get_logger(__name__)

lowerCamelCase__   = {
    '''nghuyong/ernie-1.0-base-zh''': '''https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json''',
    '''nghuyong/ernie-2.0-base-en''': '''https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json''',
    '''nghuyong/ernie-2.0-large-en''': '''https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-base-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-medium-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-mini-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-micro-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json''',
    '''nghuyong/ernie-3.0-nano-zh''': '''https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json''',
    '''nghuyong/ernie-gram-zh''': '''https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json''',
    '''nghuyong/ernie-health-zh''': '''https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json''',
}




class  _UpperCAmelCase       (			lowerCAmelCase   ):



 '''simple docstring'''




 __A           = '''ernie'''







 def __init__(						self							:					Dict				,      lowercase_							:					List[Any]=30522				,      lowercase_							:					Optional[int]=768				,      lowercase_							:					Tuple=12				,      lowercase_							:					Optional[int]=12				,      lowercase_							:					Any=3072				,      lowercase_							:					int="gelu"				,      lowercase_							:					List[Any]=0.1				,      lowercase_							:					Any=0.1				,      lowercase_							:					str=512				,      lowercase_							:					Any=2				,      lowercase_							:					Any=3				,      lowercase_							:					List[Any]=False				,      lowercase_							:					List[Any]=0.02				,      lowercase_							:					str=1e-1_2				,      lowercase_							:					int=0				,      lowercase_							:					str="absolute"				,      lowercase_							:					Dict=True				,      lowercase_							:					List[str]=None				,      **lowercase_							:					Dict				,      )		->     Union[str, Any]:


   """simple docstring"""







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

   _UpperCamelCase				=  vocab_size
   _UpperCamelCase				=  hidden_size
   _UpperCamelCase				=  num_hidden_layers
   _UpperCamelCase				=  num_attention_heads
   _UpperCamelCase				=  hidden_act
   _UpperCamelCase				=  intermediate_size
   _UpperCamelCase				=  hidden_dropout_prob
   _UpperCamelCase				=  attention_probs_dropout_prob
   _UpperCamelCase				=  max_position_embeddings
   _UpperCamelCase				=  type_vocab_size
   _UpperCamelCase				=  task_type_vocab_size
   _UpperCamelCase				=  use_task_id
   _UpperCamelCase				=  initializer_range
   _UpperCamelCase				=  layer_norm_eps
   _UpperCamelCase				=  position_embedding_type
   _UpperCamelCase				=  use_cache
   _UpperCamelCase				=  classifier_dropout




class  _UpperCAmelCase       (			lowerCAmelCase   ):



 '''simple docstring'''




 @property
 def 						__UpperCAmelCase							(						self							:					Optional[int])		->     Mapping[str, Mapping[int, str]]:


   """simple docstring"""







   if self.task == "multiple-choice":
     _UpperCamelCase				=  {0: "batch", 1: "choice", 2: "sequence"}
   else:
     _UpperCamelCase				=  {0: "batch", 1: "sequence"}
   return OrderedDict(
       [
           ("input_ids", dynamic_axis),
           ("attention_mask", dynamic_axis),
           ("token_type_ids", dynamic_axis),
           ("task_type_ids", dynamic_axis),
       ])




