
"""simple docstring"""


from typing import Callable, Optional, Union

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


A_						       =				logging.get_logger(__name__)

A_						       =				{
    """microsoft/prophetnet-large-uncased""": (
        """https://huggingface.co/microsoft/prophetnet-large-uncased/resolve/main/config.json"""
    ),
}




class    __lowerCamelCase     (   lowerCAmelCase ):
				a__:			Optional[Any]									=						'prophetnet'
				a__:			Dict									=						['past_key_values']
				a__:			Optional[Any]									=						{
				    'num_attention_heads': 'num_encoder_attention_heads',
				}




				def __init__(							self       ,	UpperCAmelCase = 0.1       ,	UpperCAmelCase = "gelu"       ,	UpperCAmelCase = 3_0522       ,	UpperCAmelCase = 1024       ,	UpperCAmelCase = 4096       ,	UpperCAmelCase = 12       ,	UpperCAmelCase = 16       ,	UpperCAmelCase = 4096       ,	UpperCAmelCase = 12       ,	UpperCAmelCase = 16       ,	UpperCAmelCase = 0.1       ,	UpperCAmelCase = 0.1       ,	UpperCAmelCase = 512       ,	UpperCAmelCase = 0.0_2       ,	UpperCAmelCase = True       ,	UpperCAmelCase = True       ,	UpperCAmelCase = 0       ,	UpperCAmelCase = 2       ,	UpperCAmelCase = 32       ,	UpperCAmelCase = 128       ,	UpperCAmelCase = False       ,	UpperCAmelCase = 0.0       ,	UpperCAmelCase = True       ,	UpperCAmelCase = 0       ,	UpperCAmelCase = 1       ,	UpperCAmelCase = 2       ,	**UpperCAmelCase       ,	):
							lowerCamelCase_ 		=     vocab_size
							lowerCamelCase_ 		=     hidden_size
							lowerCamelCase_ 		=     encoder_ffn_dim
							lowerCamelCase_ 		=     num_encoder_layers
							lowerCamelCase_ 		=     num_encoder_attention_heads
							lowerCamelCase_ 		=     decoder_ffn_dim
							lowerCamelCase_ 		=     num_decoder_layers
							lowerCamelCase_ 		=     num_decoder_attention_heads
							lowerCamelCase_ 		=     max_position_embeddings
							lowerCamelCase_ 		=     init_std  # Normal(0, this parameter)
							lowerCamelCase_ 		=     activation_function

							# parameters for prophetnet
							lowerCamelCase_ 		=     ngram
							lowerCamelCase_ 		=     num_buckets
							lowerCamelCase_ 		=     relative_max_distance
							lowerCamelCase_ 		=     disable_ngram_loss
							lowerCamelCase_ 		=     eps

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

							lowerCamelCase_ 		=     use_cache

							super().__init__(
							    pad_token_id=UpperCAmelCase       ,	bos_token_id=UpperCAmelCase       ,	eos_token_id=UpperCAmelCase       ,	is_encoder_decoder=UpperCAmelCase       ,	add_cross_attention=UpperCAmelCase       ,	decoder_start_token_id=UpperCAmelCase       ,	**UpperCAmelCase       ,	)




				@property
				def 					UpperCAmelCase__	(							self      ):
							return self.num_encoder_layers + self.num_decoder_layers





				@num_hidden_layers.setter
				def 					UpperCAmelCase__	(							self       ,	UpperCAmelCase      ):
							raise NotImplementedError(
							    '''This model does not support the setting of `num_hidden_layers`. Please set `num_encoder_layers` and'''
							    ''' `num_decoder_layers`.'''      )





"""simple docstring"""


import copy

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


A_						       =				logging.get_logger(__name__)




class    __lowerCamelCase     (   lowerCAmelCase ):
				a__:			List[str]									=						'hybrid-clip'
				a__:			List[Any]									=						True




				def __init__(							self       ,	UpperCAmelCase=512       ,	**UpperCAmelCase      ):
							super().__init__(**UpperCAmelCase      )

							if "text_config" not in kwargs:
										raise ValueError('''`text_config` can not be `None`.'''      )

							if "vision_config" not in kwargs:
										raise ValueError('''`vision_config` can not be `None`.'''      )

							lowerCamelCase_ 		=     kwargs.pop('''text_config'''      )
							lowerCamelCase_ 		=     kwargs.pop('''vision_config'''      )

							lowerCamelCase_ 		=     text_config.pop('''model_type'''      )
							lowerCamelCase_ 		=     vision_config.pop('''model_type'''      )

							from transformers import AutoConfig

							lowerCamelCase_ 		=     AutoConfig.for_model(UpperCAmelCase       ,	**UpperCAmelCase      )

							if vision_model_type == "clip":
										lowerCamelCase_ 		=     AutoConfig.for_model(UpperCAmelCase       ,	**UpperCAmelCase      ).vision_config
							elif vision_model_type == "clip_vision_model":
										from transformers import CLIPVisionConfig

										lowerCamelCase_ 		=     CLIPVisionConfig(**UpperCAmelCase      )
							else:
										lowerCamelCase_ 		=     AutoConfig.for_model(UpperCAmelCase       ,	**UpperCAmelCase      )

							lowerCamelCase_ 		=     projection_dim
							lowerCamelCase_ 		=     1.0




				@classmethod
				def 					UpperCAmelCase__	(							cls       ,	UpperCAmelCase       ,	UpperCAmelCase       ,	**UpperCAmelCase      ):
							return cls(text_config=text_config.to_dict()       ,	vision_config=vision_config.to_dict()       ,	**UpperCAmelCase      )





				def 					UpperCAmelCase__	(							self      ):
							lowerCamelCase_ 		=     copy.deepcopy(self.__dict__      )
							lowerCamelCase_ 		=     self.text_config.to_dict()
							lowerCamelCase_ 		=     self.vision_config.to_dict()
							lowerCamelCase_ 		=     self.__class__.model_type
							return output



