



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 	__lowerCAmelCase       (		lowerCAmelCase__				):
 lowerCAmelCase__       =					"""vision-text-dual-encoder"""
 lowerCAmelCase__       =					True




 def __init__(  self		,			__UpperCAmelCase=512		,			__UpperCAmelCase=2.6_592		,			**__UpperCAmelCase			):



    '''simple docstring'''
    super().__init__(**__UpperCAmelCase			)

    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  							=      kwargs.pop('''vision_config'''			)
    __lowerCamelCase  							=      kwargs.pop('''text_config'''			)

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

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

    __lowerCamelCase  							=      AutoConfig.for_model(__UpperCAmelCase		,			**__UpperCAmelCase			)

    __lowerCamelCase  							=      projection_dim
    __lowerCamelCase  							=      logit_scale_init_value




 @classmethod
 def     lowerCamelCase (  cls		,			__UpperCAmelCase		,			__UpperCAmelCase		,			**__UpperCAmelCase			):



    '''simple docstring'''
    return cls(vision_config=vision_config.to_dict()		,			text_config=text_config.to_dict()		,			**__UpperCAmelCase			)




 def     lowerCamelCase (  self			):



    '''simple docstring'''
    __lowerCamelCase  							=      copy.deepcopy(self.__dict__			)
    __lowerCamelCase  							=      self.vision_config.to_dict()
    __lowerCamelCase  							=      self.text_config.to_dict()
    __lowerCamelCase  							=      self.__class__.model_type
    return output











def 						a__     (						_UpperCamelCase     :	int							):
   if not isinstance(_UpperCamelCase	,_UpperCamelCase							):
      __lowerCamelCase  							=      (
          '''operation can not be conducted on a object of type '''
          F"""{type(_UpperCamelCase							).__name__}"""
      )
      raise TypeError(_UpperCamelCase							)
   __lowerCamelCase  							=      ''''''
   for _ in range(0	,32							):
      bit_string += str(number % 2							)
      __lowerCamelCase  							=      number >> 1
   return bit_string





def 						a__     (						_UpperCamelCase     :	int							):
   if number < 0:
      raise ValueError('''the value of input must be positive'''							)
   elif isinstance(_UpperCamelCase	,_UpperCamelCase							):
      raise TypeError('''Input value must be a \'int\' type'''							)
   elif isinstance(_UpperCamelCase	,_UpperCamelCase							):
      raise TypeError('''\'<\' not supported between instances of \'str\' and \'int\''''							)
   __lowerCamelCase  							=      0
   # iterator over [1 to 32],since we are dealing with 32 bit integer
   for _ in range(1	,33							):
      # left shift the bits by unity
      __lowerCamelCase  							=      result << 1
      # get the end bit
      __lowerCamelCase  							=      number % 2
      # right shift the bits by unity
      __lowerCamelCase  							=      number >> 1
      # add that bit to our ans
      __lowerCamelCase  							=      result | end_bit
   return get_reverse_bit_string(_UpperCamelCase							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()






