



import copy

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


A__  :  Any       = logging.get_logger(__name__)

A__  :  List[str]       = {}



class     __snake_case						(					UpperCamelCase_						):
							_a      				=			'''fsmt_decoder'''




							def __init__(	self					:	str    ,    A_					:	Optional[int]=0    ,    A_					:	str=0):
									super().__init__()
									lowerCAmelCase_      :					Optional[Any]     =			vocab_size
									lowerCAmelCase_      :					Dict     =			bos_token_id





class     __snake_case						(					UpperCamelCase_						):
							_a      				=			'''fsmt'''
							_a      				=			{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}




							def __init__(	self					:	int    ,    A_					:	Any=["en", "de"]    ,    A_					:	str=4_2_0_2_4    ,    A_					:	List[str]=4_2_0_2_4    ,    A_					:	Optional[Any]="relu"    ,    A_					:	int=1_0_2_4    ,    A_					:	Tuple=2_0_0    ,    A_					:	List[Any]=1_0_2_4    ,    A_					:	Dict=4_0_9_6    ,    A_					:	str=1_2    ,    A_					:	Union[str, Any]=1_6    ,    A_					:	str=0.0    ,    A_					:	List[str]=4_0_9_6    ,    A_					:	List[str]=1_2    ,    A_					:	List[str]=1_6    ,    A_					:	Union[str, Any]=0.0    ,    A_					:	Optional[Any]=0.0    ,    A_					:	str=0.1    ,    A_					:	Union[str, Any]=0.0    ,    A_					:	int=0.02    ,    A_					:	List[str]=2    ,    A_					:	List[Any]=True    ,    A_					:	Optional[int]=True    ,    A_					:	Optional[int]=False    ,    A_					:	str=5    ,    A_					:	List[str]=1.0    ,    A_					:	Optional[Any]=False    ,    A_					:	Union[str, Any]=True    ,    A_					:	List[Any]=1    ,    A_					:	int=0    ,    A_					:	int=2    ,    A_					:	int=2    ,    **A_					:	Tuple    ,    ):
									lowerCAmelCase_      :					Optional[Any]     =			langs
									lowerCAmelCase_      :					Dict     =			src_vocab_size
									lowerCAmelCase_      :					Tuple     =			tgt_vocab_size
									lowerCAmelCase_      :					Dict     =			d_model  # encoder_embed_dim and decoder_embed_dim

									lowerCAmelCase_      :					Dict     =			encoder_ffn_dim
									lowerCAmelCase_      :					Dict     =			encoder_layers
									lowerCAmelCase_      :					Tuple     =			encoder_attention_heads
									lowerCAmelCase_      :					List[str]     =			encoder_layerdrop
									lowerCAmelCase_      :					List[Any]     =			decoder_layerdrop
									lowerCAmelCase_      :					Tuple     =			decoder_ffn_dim
									lowerCAmelCase_      :					Optional[Any]     =			decoder_layers
									lowerCAmelCase_      :					List[Any]     =			decoder_attention_heads
									lowerCAmelCase_      :					Tuple     =			max_position_embeddings
									lowerCAmelCase_      :					Any     =			init_std  # Normal(0, this parameter)
									lowerCAmelCase_      :					List[Any]     =			activation_function

									lowerCAmelCase_      :					str     =			DecoderConfig(vocab_size=A_    ,    bos_token_id=A_)
									if "decoder" in common_kwargs:
											del common_kwargs["decoder"]

									lowerCAmelCase_      :					List[str]     =			scale_embedding  # scale factor will be sqrt(d_model) if True

									# 3 Types of Dropout
									lowerCAmelCase_      :					Any     =			attention_dropout
									lowerCAmelCase_      :					Tuple     =			activation_dropout
									lowerCAmelCase_      :					int     =			dropout

									lowerCAmelCase_      :					Optional[Any]     =			use_cache
									super().__init__(
									    pad_token_id=A_    ,    bos_token_id=A_    ,    eos_token_id=A_    ,    decoder_start_token_id=A_    ,    is_encoder_decoder=A_    ,    tie_word_embeddings=A_    ,    forced_eos_token_id=A_    ,    max_length=A_    ,    num_beams=A_    ,    length_penalty=A_    ,    early_stopping=A_    ,    **A_    ,    )







							def        UpperCAmelCase__      (	self					:	Tuple):
									lowerCAmelCase_      :					Dict     =			copy.deepcopy(self.__dict__)
									lowerCAmelCase_      :					int     =			self.decoder.to_dict()
									lowerCAmelCase_      :					Union[str, Any]     =			self.__class__.model_type
									return output










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


A__  :  Tuple       = logging.get_logger(__name__)

A__  :  Tuple       = {
    '''facebook/opt-125m''': '''https://huggingface.co/facebook/opt-125m/blob/main/config.json''',
    '''facebook/opt-350m''': '''https://huggingface.co/facebook/opt-350m/blob/main/config.json''',
    '''facebook/opt-1.3b''': '''https://huggingface.co/facebook/opt-1.3b/blob/main/config.json''',
    '''facebook/opt-2.7b''': '''https://huggingface.co/facebook/opt-2.7b/blob/main/config.json''',
    '''facebook/opt-6.7b''': '''https://huggingface.co/facebook/opt-6.7b/blob/main/config.json''',
    '''facebook/opt-13b''': '''https://huggingface.co/facebook/opt-13b/blob/main/config.json''',
}



class     __snake_case						(					UpperCamelCase_						):
							_a      				=			'''opt'''
							_a      				=			['''past_key_values''']




							def __init__(	self					:	Optional[int]    ,    A_					:	Any=5_0_2_7_2    ,    A_					:	Tuple=7_6_8    ,    A_					:	Optional[Any]=1_2    ,    A_					:	str=3_0_7_2    ,    A_					:	Dict=2_0_4_8    ,    A_					:	List[Any]=True    ,    A_					:	Optional[int]=False    ,    A_					:	Optional[int]=None    ,    A_					:	Dict=0.1    ,    A_					:	str=0.0    ,    A_					:	Union[str, Any]=1_2    ,    A_					:	List[str]="relu"    ,    A_					:	Dict=0.0    ,    A_					:	Union[str, Any]=0.02    ,    A_					:	Optional[Any]=True    ,    A_					:	Optional[Any]=1    ,    A_					:	List[Any]=2    ,    A_					:	Dict=2    ,    A_					:	Optional[int]=True    ,    A_					:	Optional[int]=True    ,    **A_					:	List[Any]    ,    ):
									super().__init__(
									    pad_token_id=A_    ,    bos_token_id=A_    ,    eos_token_id=A_    ,    **A_    ,    )
									lowerCAmelCase_      :					List[Any]     =			vocab_size
									lowerCAmelCase_      :					Union[str, Any]     =			max_position_embeddings
									lowerCAmelCase_      :					Optional[int]     =			num_attention_heads
									lowerCAmelCase_      :					int     =			word_embed_proj_dim if word_embed_proj_dim is not None else hidden_size
									lowerCAmelCase_      :					List[Any]     =			ffn_dim
									lowerCAmelCase_      :					Any     =			hidden_size
									lowerCAmelCase_      :					Union[str, Any]     =			num_hidden_layers
									lowerCAmelCase_      :					str     =			dropout
									lowerCAmelCase_      :					List[str]     =			attention_dropout
									lowerCAmelCase_      :					Any     =			activation_function
									lowerCAmelCase_      :					Union[str, Any]     =			init_std
									lowerCAmelCase_      :					int     =			layerdrop
									lowerCAmelCase_      :					Optional[int]     =			use_cache
									lowerCAmelCase_      :					int     =			do_layer_norm_before
									# We keep these variables at `True` for backward compatibility.
									lowerCAmelCase_      :					Optional[Any]     =			enable_bias
									lowerCAmelCase_      :					Optional[int]     =			layer_norm_elementwise_affine

									# Note that the only purpose of `_remove_final_layer_norm` is to keep backward compatibility
									# with checkpoints that have been fine-tuned before transformers v4.20.1
									# see https://github.com/facebookresearch/metaseq/pull/164
									lowerCAmelCase_      :					Optional[Any]     =			_remove_final_layer_norm





