import copy

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


UpperCAmelCase     						=			logging.get_logger(__name__)




class 				__lowerCAmelCase					(    a_  ):



 '''simple docstring'''
 _lowerCamelCase  :		int			      =	'hybrid-clip'
 _lowerCamelCase  :		List[Any]			      =	True

 def __init__(     self    :						int    ,     lowerCamelCase    :						Union[str, Any]=5_1_2    ,     **lowerCamelCase    :						Optional[int]					)	->							Any:
        super().__init__(**lowerCamelCase					)

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

        _UpperCamelCase       :    str					  =					kwargs.pop('text_config'					)
        _UpperCamelCase       :    List[Any]					  =					kwargs.pop('vision_config'					)

        _UpperCamelCase       :    Union[str, Any]					  =					text_config.pop('model_type'					)
        _UpperCamelCase       :    List[Any]					  =					vision_config.pop('model_type'					)

        from transformers import AutoConfig

        _UpperCamelCase       :    List[Any]					  =					AutoConfig.for_model(lowerCamelCase    ,     **lowerCamelCase					)

        if vision_model_type == "clip":
               _UpperCamelCase       :    str					  =					AutoConfig.for_model(lowerCamelCase    ,     **lowerCamelCase					).vision_config
        elif vision_model_type == "clip_vision_model":
               from transformers import CLIPVisionConfig

               _UpperCamelCase       :    Dict					  =					CLIPVisionConfig(**lowerCamelCase					)
        else:
               _UpperCamelCase       :    List[str]					  =					AutoConfig.for_model(lowerCamelCase    ,     **lowerCamelCase					)

        _UpperCamelCase       :    Tuple					  =					projection_dim
        _UpperCamelCase       :    int					  =					1.0

 @classmethod
 def    __snake_case   (     cls    :						Dict    ,     lowerCamelCase    :						PretrainedConfig    ,     lowerCamelCase    :						PretrainedConfig    ,     **lowerCamelCase    :						str					)	->							Any:
        return cls(text_config=text_config.to_dict()    ,     vision_config=vision_config.to_dict()    ,     **lowerCamelCase					)

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




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


def SCREAMING_SNAKE_CASE			(       lowercase_:		int			):
       if number < 0:
              raise ValueError('the value of input must be positive'			)
       elif isinstance(lowercase_						,  lowercase_			):
              raise TypeError('Input value must be a \'int\' type'			)
       elif isinstance(lowercase_						,  lowercase_			):
              raise TypeError('\'<\' not supported between instances of \'str\' and \'int\''			)
       _UpperCamelCase       :    List[Any]					  =					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
              _UpperCamelCase       :    Tuple					  =					result << 1
              # get the end bit
              _UpperCamelCase       :    List[Any]					  =					number % 2
              # right shift the bits by unity
              _UpperCamelCase       :    Dict					  =					number >> 1
              # add that bit to our ans
              _UpperCamelCase       :    int					  =					result | end_bit
       return get_reverse_bit_string(lowercase_			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()



