



import copy

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


A_		:  str										=  logging.get_logger(__name__)



class 		_lowercase		(							UpperCAmelCase__						):
   _UpperCAmelCase  						=      '''vision-text-dual-encoder'''
   _UpperCAmelCase  						=      True

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


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

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

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

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

    a							=		AutoConfig.for_model(__lowerCAmelCase				, **__lowerCAmelCase				)

    a							=		projection_dim
    a							=		logit_scale_init_value

   @classmethod
   def 		A				(   cls      :							str				, __lowerCAmelCase      :							PretrainedConfig				, __lowerCAmelCase      :							PretrainedConfig				, **__lowerCAmelCase      :							Optional[Any]				)							->					Union[str, Any]:


    """simple docstring"""






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




   def 		A				(   self      :							str				)							->					int:


    """simple docstring"""






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





def       lowerCAmelCase			(		lowerCAmelCase_			, lowerCAmelCase_			)->			set:
				assert isinstance(lowerCAmelCase_			, lowerCAmelCase_			), f"""The input value of [set_a={set_a}] is not a set"""
				assert isinstance(lowerCAmelCase_			, lowerCAmelCase_			), f"""The input value of [set_b={set_b}] is not a set"""

				return {a + b for a in set_a for b in set_b}


if __name__ == "__main__":
						from doctest import testmod

						testmod()