





'''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


A_				     =							logging.get_logger(__name__)


class 		UpperCamelCase__     (       a							):
      '''simple docstring'''






      _snake_case           =				'''vision-text-dual-encoder'''
      _snake_case           =				True




      def __init__(     self     , SCREAMING_SNAKE_CASE=5_12     , SCREAMING_SNAKE_CASE=2.6_5_9_2     , **SCREAMING_SNAKE_CASE )				->  Dict:
        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`.' )

        __lowerCAmelCase		:    str			     =  kwargs.pop('vision_config' )
        __lowerCAmelCase		:    Optional[Any]			     =  kwargs.pop('text_config' )

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

        if vision_model_type == "clip":
          __lowerCAmelCase		:    str			     =  AutoConfig.for_model(SCREAMING_SNAKE_CASE     , **SCREAMING_SNAKE_CASE ).vision_config
        elif vision_model_type == "clip_vision_model":
          __lowerCAmelCase		:    int			     =  CLIPVisionConfig(**SCREAMING_SNAKE_CASE )
        else:
          __lowerCAmelCase		:    Any			     =  AutoConfig.for_model(SCREAMING_SNAKE_CASE     , **SCREAMING_SNAKE_CASE )

        __lowerCAmelCase		:    Union[str, Any]			     =  AutoConfig.for_model(SCREAMING_SNAKE_CASE     , **SCREAMING_SNAKE_CASE )

        __lowerCAmelCase		:    Tuple			     =  projection_dim
        __lowerCAmelCase		:    str			     =  logit_scale_init_value




      @classmethod
      def 	snake_case  (     cls     , SCREAMING_SNAKE_CASE     , SCREAMING_SNAKE_CASE     , **SCREAMING_SNAKE_CASE )				->  Tuple:
        return cls(vision_config=vision_config.to_dict()     , text_config=text_config.to_dict()     , **SCREAMING_SNAKE_CASE )







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












'''simple docstring'''


from typing import Callable




def       A							(      _UpperCAmelCase   :				Callable					)  ->				Dict:


  '''simple docstring'''




  def wrapper(_UpperCAmelCase   :				Optional[Any]					):
    __lowerCAmelCase		:    List[Any]			     =  function_with_docstring.__doc__
    return target_function

  return wrapper





