


"""simple docstring"""






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


__snake_case												=							logging.get_logger(__name__)

__snake_case												=							{
    "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      __lowerCamelCase	(       lowercase_					):

     '''simple docstring'''
     A_							:						Tuple     =		"""opt"""
     A_							:						Union[str, Any]     =		["""past_key_values"""]


     def __init__(   self     ,					__UpperCAmelCase=50272     ,					__UpperCAmelCase=768     ,					__UpperCAmelCase=12     ,					__UpperCAmelCase=3072     ,					__UpperCAmelCase=2048     ,					__UpperCAmelCase=True     ,					__UpperCAmelCase=False     ,					__UpperCAmelCase=None     ,					__UpperCAmelCase=0.1     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=12     ,					__UpperCAmelCase="relu"     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=0.02     ,					__UpperCAmelCase=True     ,					__UpperCAmelCase=1     ,					__UpperCAmelCase=2     ,					__UpperCAmelCase=2     ,					__UpperCAmelCase=True     ,					__UpperCAmelCase=True     ,					**__UpperCAmelCase     ,					)							->				Dict:
          super().__init__(
              pad_token_id=__UpperCAmelCase     ,					bos_token_id=__UpperCAmelCase     ,					eos_token_id=__UpperCAmelCase     ,					**__UpperCAmelCase     ,					)
          _a     						=					vocab_size
          _a     						=					max_position_embeddings
          _a     						=					num_attention_heads
          _a     						=					word_embed_proj_dim if word_embed_proj_dim is not None else hidden_size
          _a     						=					ffn_dim
          _a     						=					hidden_size
          _a     						=					num_hidden_layers
          _a     						=					dropout
          _a     						=					attention_dropout
          _a     						=					activation_function
          _a     						=					init_std
          _a     						=					layerdrop
          _a     						=					use_cache
          _a     						=					do_layer_norm_before
          # We keep these variables at `True` for backward compatibility.
          _a     						=					enable_bias
          _a     						=					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
          _a     						=					_remove_final_layer_norm





"""simple docstring"""

import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig
from ..clip.configuration_clip import CLIPVisionConfig


UpperCamelCase__			:     Optional[Any]			       =				logging.get_logger(__name__)
class      A__   (   lowercase_  ):
	A_				:					List[str]      =   """vision-text-dual-encoder"""
	A_				:					Tuple      =   True




	def __init__( self	:						Tuple   ,     lowercase	:						List[Any]=512   ,     lowercase	:						Any=2.65_92   ,     **lowercase	:						int						)       ->			int:
						super().__init__(**lowercase						)

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

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

						__snake_case        =						kwargs.pop("""vision_config"""						)
						__snake_case        =						kwargs.pop("""text_config"""						)

						__snake_case        =						vision_config.pop("""model_type"""						)
						__snake_case        =						text_config.pop("""model_type"""						)

						if vision_model_type == "clip":
											__snake_case        =						AutoConfig.for_model(lowercase   ,     **lowercase						).vision_config
						elif vision_model_type == "clip_vision_model":
											__snake_case        =						CLIPVisionConfig(**lowercase						)
						else:
											__snake_case        =						AutoConfig.for_model(lowercase   ,     **lowercase						)

						__snake_case        =						AutoConfig.for_model(lowercase   ,     **lowercase						)

						__snake_case        =						projection_dim
						__snake_case        =						logit_scale_init_value




	@classmethod
	def 				a_		( cls	:						Union[str, Any]   ,     lowercase	:						PretrainedConfig   ,     lowercase	:						PretrainedConfig   ,     **lowercase	:						Optional[int]						)       ->			Dict:
						return cls(vision_config=vision_config.to_dict()   ,     text_config=text_config.to_dict()   ,     **lowercase						)




	def 				a_		( self	:						Dict						)       ->			Dict:
						__snake_case        =						copy.deepcopy(self.__dict__						)
						__snake_case        =						self.vision_config.to_dict()
						__snake_case        =						self.text_config.to_dict()
						__snake_case        =						self.__class__.model_type
						return output


