
'''simple docstring'''
import copy

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


lowercase__		    =	logging.get_logger(__name__)






class      snake_case__    (	__SCREAMING_SNAKE_CASE ):







		"""simple docstring"""

		lowerCamelCase							=		"""hybrid-clip"""
		lowerCamelCase							=		True



		def __init__(	self							:       Any   ,     UpperCamelCase__							:       Optional[int]=512   ,     **UpperCamelCase__							:       Dict	)		->       str:






				"""simple docstring"""







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

				snake_case   :    List[Any]			       =		kwargs.pop('''text_config'''	)
				snake_case   :    Optional[int]			       =		kwargs.pop('''vision_config'''	)

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

				from transformers import AutoConfig

				snake_case   :    Optional[int]			       =		AutoConfig.for_model(UpperCamelCase__   ,     **UpperCamelCase__	)

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

						snake_case   :    List[str]			       =		CLIPVisionConfig(**UpperCamelCase__	)
				else:
						snake_case   :    Optional[int]			       =		AutoConfig.for_model(UpperCamelCase__   ,     **UpperCamelCase__	)

				snake_case   :    Any			       =		projection_dim
				snake_case   :    Dict			       =		1.0



		@classmethod
		def 	lowerCAmelCase							(	cls							:       Optional[int]   ,     UpperCamelCase__							:       PretrainedConfig   ,     UpperCamelCase__							:       PretrainedConfig   ,     **UpperCamelCase__							:       str	)		->       List[str]:






				"""simple docstring"""







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



		def 	lowerCAmelCase							(	self							:       int	)		->       str:






				"""simple docstring"""







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





'''simple docstring'''
from transformers import PretrainedConfig
class  _snake_case						(__SCREAMING_SNAKE_CASE):
			__A   :     Optional[Any]          ="custom"






			def __init__(   self       ,_snake_case=1       ,**_snake_case			):
				UpperCAmelCase_			:	Optional[int]      =   attribute
				super().__init__(**_snake_case			)




class  _snake_case						(__SCREAMING_SNAKE_CASE):
			__A   :     Dict          ="custom"






			def __init__(   self       ,_snake_case=1       ,**_snake_case			):
				UpperCAmelCase_			:	Optional[int]      =   attribute




