




'''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			     =					logging.get_logger(__name__)






class 						lowerCAmelCase_	(       UpperCAmelCase_							):







  '''simple docstring'''

  UpperCamelCase_			:      Dict										=				"""vision-text-dual-encoder"""
  UpperCamelCase_			:      Tuple										=				True



  def __init__( self				:							str					,  SCREAMING_SNAKE_CASE_				:							Optional[int]=5_12					,  SCREAMING_SNAKE_CASE_				:							Union[str, Any]=2.6592					,  **SCREAMING_SNAKE_CASE_				:							Tuple	)			->		Optional[Any]:







       '''simple docstring'''



       super().__init__(**SCREAMING_SNAKE_CASE_	)

       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`.'''	)

       A:		Dict          =		kwargs.pop('''vision_config'''	)
       A:		List[Any]          =		kwargs.pop('''text_config'''	)

       A:		str          =		vision_config.pop('''model_type'''	)
       A:		List[str]          =		text_config.pop('''model_type'''	)

       if vision_model_type == "clip":
            A:		str          =		AutoConfig.for_model(SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_	).vision_config
       elif vision_model_type == "clip_vision_model":
            A:		Any          =		CLIPVisionConfig(**SCREAMING_SNAKE_CASE_	)
       else:
            A:		Optional[Any]          =		AutoConfig.for_model(SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_	)

       A:		Tuple          =		AutoConfig.for_model(SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_	)

       A:		Any          =		projection_dim
       A:		Optional[Any]          =		logit_scale_init_value



  @classmethod
  def 					_snake_case     ( cls				:							Any					,  SCREAMING_SNAKE_CASE_				:							PretrainedConfig					,  SCREAMING_SNAKE_CASE_				:							PretrainedConfig					,  **SCREAMING_SNAKE_CASE_				:							Optional[Any]	)			->		str:







       '''simple docstring'''



       return cls(vision_config=vision_config.to_dict()					,  text_config=text_config.to_dict()					,  **SCREAMING_SNAKE_CASE_	)




  def 					_snake_case     ( self				:							Optional[Any]	)			->		int:







       '''simple docstring'''



       A:		Any          =		copy.deepcopy(self.__dict__	)
       A:		List[str]          =		self.vision_config.to_dict()
       A:		Dict          =		self.text_config.to_dict()
       A:		Dict          =		self.__class__.model_type
       return output












'''simple docstring'''


def 					SCREAMING_SNAKE_CASE(   __lowercase	)			-> int:
     if not isinstance(__lowercase		,				__lowercase	):
          raise ValueError('''double_factorial() only accepts integral values'''	)
     if n < 0:
          raise ValueError('''double_factorial() not defined for negative values'''	)
     return 1 if n <= 1 else n * double_factorial(n - 2	)


if __name__ == "__main__":
     import doctest

     doctest.testmod()






