


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     __snake_case							(      _UpperCAmelCase):
					SCREAMING_SNAKE_CASE_		:					Any 				= "vision-text-dual-encoder"
					SCREAMING_SNAKE_CASE_		:					Union[str, Any] 				= True
					def __init__(	self					:	str  ,			_lowerCAmelCase					:	Optional[int]=5_1_2  ,			_lowerCAmelCase					:	int=2.6592  ,			**_lowerCAmelCase					:	Dict     )       ->				List[Any]:



											'''simple docstring'''





											super().__init__(**_lowerCAmelCase     )

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

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

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

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

											__magic_name__ 		=			AutoConfig.for_model(_lowerCAmelCase  ,			**_lowerCAmelCase     )

											__magic_name__ 		=			projection_dim
											__magic_name__ 		=			logit_scale_init_value
					@classmethod
					def   a (	cls					:	Any  ,			_lowerCAmelCase					:	PretrainedConfig  ,			_lowerCAmelCase					:	PretrainedConfig  ,			**_lowerCAmelCase					:	Any     )       ->				Tuple:



											'''simple docstring'''





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







					def   a (	self					:	List[Any]     )       ->				str:



											'''simple docstring'''





											__magic_name__ 		=			copy.deepcopy(self.__dict__     )
											__magic_name__ 		=			self.vision_config.to_dict()
											__magic_name__ 		=			self.text_config.to_dict()
											__magic_name__ 		=			self.__class__.model_type
											return output





def 							UpperCamelCase_  (				__snake_case			:						str     )->      int:




						'''simple docstring'''
						__magic_name__ 		=			__magic_name__ 		=			0
						for letter in data:
												__magic_name__ 		=			(hash_ << 4) + ord(__snake_case     )
												__magic_name__ 		=			hash_ & 0xf000_0000
												if x != 0:
																		hash_ ^= x >> 24
												hash_ &= ~x
						return hash_


if __name__ == "__main__":
					import doctest

					doctest.testmod()

