

"""simple docstring"""




import warnings

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


SCREAMING_SNAKE_CASE_     :			Union[str, Any]	  =			logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_     :			List[str]	  =			{
    '''RUCAIBox/mvp''': '''https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json''',
}


class 		_A       (			__a					):
      __a								=	"mvp"
      __a								=	["past_key_values"]
      __a								=	{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}





      def __init__(  self    ,						SCREAMING_SNAKE_CASE__=50267    ,						SCREAMING_SNAKE_CASE__=1024    ,						SCREAMING_SNAKE_CASE__=12    ,						SCREAMING_SNAKE_CASE__=4096    ,						SCREAMING_SNAKE_CASE__=16    ,						SCREAMING_SNAKE_CASE__=12    ,						SCREAMING_SNAKE_CASE__=4096    ,						SCREAMING_SNAKE_CASE__=16    ,						SCREAMING_SNAKE_CASE__=0.0    ,						SCREAMING_SNAKE_CASE__=0.0    ,						SCREAMING_SNAKE_CASE__="gelu"    ,						SCREAMING_SNAKE_CASE__=1024    ,						SCREAMING_SNAKE_CASE__=0.1    ,						SCREAMING_SNAKE_CASE__=0.0    ,						SCREAMING_SNAKE_CASE__=0.0    ,						SCREAMING_SNAKE_CASE__=0.02    ,						SCREAMING_SNAKE_CASE__=0.0    ,						SCREAMING_SNAKE_CASE__=False    ,						SCREAMING_SNAKE_CASE__=True    ,						SCREAMING_SNAKE_CASE__=1    ,						SCREAMING_SNAKE_CASE__=0    ,						SCREAMING_SNAKE_CASE__=2    ,						SCREAMING_SNAKE_CASE__=True    ,						SCREAMING_SNAKE_CASE__=2    ,						SCREAMING_SNAKE_CASE__=2    ,						SCREAMING_SNAKE_CASE__=False    ,						SCREAMING_SNAKE_CASE__=100    ,						SCREAMING_SNAKE_CASE__=800    ,						**SCREAMING_SNAKE_CASE__    ,						)   ->					Any:
         lowerCamelCase__						=			vocab_size
         lowerCamelCase__						=			max_position_embeddings
         lowerCamelCase__						=			d_model
         lowerCamelCase__						=			encoder_ffn_dim
         lowerCamelCase__						=			encoder_layers
         lowerCamelCase__						=			encoder_attention_heads
         lowerCamelCase__						=			decoder_ffn_dim
         lowerCamelCase__						=			decoder_layers
         lowerCamelCase__						=			decoder_attention_heads
         lowerCamelCase__						=			dropout
         lowerCamelCase__						=			attention_dropout
         lowerCamelCase__						=			activation_dropout
         lowerCamelCase__						=			activation_function
         lowerCamelCase__						=			init_std
         lowerCamelCase__						=			encoder_layerdrop
         lowerCamelCase__						=			decoder_layerdrop
         lowerCamelCase__						=			classifier_dropout
         lowerCamelCase__						=			use_cache
         lowerCamelCase__						=			encoder_layers
         lowerCamelCase__						=			scale_embedding  # scale factor will be sqrt(d_model) if True
         lowerCamelCase__						=			use_prompt
         lowerCamelCase__						=			prompt_length
         lowerCamelCase__						=			prompt_mid_dim

         super().__init__(
             pad_token_id=lowerCAmelCase_    ,						bos_token_id=lowerCAmelCase_    ,						eos_token_id=lowerCAmelCase_    ,						is_encoder_decoder=lowerCAmelCase_    ,						decoder_start_token_id=lowerCAmelCase_    ,						forced_eos_token_id=lowerCAmelCase_    ,						**lowerCAmelCase_    ,						)

         if self.forced_bos_token_id is None and kwargs.get("force_bos_token_to_be_generated"    ,						lowerCAmelCase_		):
            lowerCamelCase__						=			self.bos_token_id
            warnings.warn(
                f'Please make sure the config includes `forced_bos_token_id={self.bos_token_id}` in future versions. '
                "The config can simply be saved and uploaded again to be fixed."		)







"""simple docstring"""




import copy

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


SCREAMING_SNAKE_CASE_     :			Dict	  =			logging.get_logger(__name__)


class 		_A       (			__a					):
      __a								=	'encoder-decoder'
      __a								=	True





      def __init__(  self    ,						**SCREAMING_SNAKE_CASE__		)   ->					Optional[int]:
         super().__init__(**SCREAMING_SNAKE_CASE__		)
         assert (
             "encoder" in kwargs and "decoder" in kwargs
         ), "Config has to be initialized with encoder and decoder config"
         lowerCamelCase__						=			kwargs.pop("encoder"		)
         lowerCamelCase__						=			encoder_config.pop("model_type"		)
         lowerCamelCase__						=			kwargs.pop("decoder"		)
         lowerCamelCase__						=			decoder_config.pop("model_type"		)

         from ..auto.configuration_auto import AutoConfig

         lowerCamelCase__						=			AutoConfig.for_model(SCREAMING_SNAKE_CASE__    ,						**SCREAMING_SNAKE_CASE__		)
         lowerCamelCase__						=			AutoConfig.for_model(SCREAMING_SNAKE_CASE__    ,						**SCREAMING_SNAKE_CASE__		)
         lowerCamelCase__						=			True





      @classmethod
      def 					_lowerCamelCase  (  cls    ,						SCREAMING_SNAKE_CASE__    ,						SCREAMING_SNAKE_CASE__    ,						**SCREAMING_SNAKE_CASE__		)   ->					PretrainedConfig:
         logger.info("Set `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config"		)
         lowerCamelCase__						=			True
         lowerCamelCase__						=			True

         return cls(encoder=encoder_config.to_dict()    ,						decoder=decoder_config.to_dict()    ,						**SCREAMING_SNAKE_CASE__		)





      def 					_lowerCamelCase  (  self		)   ->					int:
         lowerCamelCase__						=			copy.deepcopy(self.__dict__		)
         lowerCamelCase__						=			self.encoder.to_dict()
         lowerCamelCase__						=			self.decoder.to_dict()
         lowerCamelCase__						=			self.__class__.model_type
         return output




