






from __future__ import annotations

from enum import Enum, unique
from typing import TypeVar

# Create a generic variable that can be 'Enum', or any subclass.
__a :    Optional[int]								=				TypeVar("T", bound="Enum")


@unique
class  __lowercase (		UpperCAmelCase__					):







     '''simple docstring'''
     SCREAMING_SNAKE_CASE				  =			80
     SCREAMING_SNAKE_CASE				  =			70
     SCREAMING_SNAKE_CASE				  =			60
     SCREAMING_SNAKE_CASE				  =			50
     SCREAMING_SNAKE_CASE				  =			40
     SCREAMING_SNAKE_CASE				  =			30
     SCREAMING_SNAKE_CASE				  =			20
     SCREAMING_SNAKE_CASE				  =			10


@unique
class  __lowercase (		UpperCAmelCase__					):







     '''simple docstring'''
     SCREAMING_SNAKE_CASE				  =			24
     SCREAMING_SNAKE_CASE				  =			21
     SCREAMING_SNAKE_CASE				  =			18
     SCREAMING_SNAKE_CASE				  =			15
     SCREAMING_SNAKE_CASE				  =			12
     SCREAMING_SNAKE_CASE				  =			9
     SCREAMING_SNAKE_CASE				  =			6
     SCREAMING_SNAKE_CASE				  =			3
     SCREAMING_SNAKE_CASE				  =			2
     SCREAMING_SNAKE_CASE				  =			1
     SCREAMING_SNAKE_CASE				  =			-1
     SCREAMING_SNAKE_CASE				  =			-2
     SCREAMING_SNAKE_CASE				  =			-3
     SCREAMING_SNAKE_CASE				  =			-6
     SCREAMING_SNAKE_CASE				  =			-9
     SCREAMING_SNAKE_CASE				  =			-12
     SCREAMING_SNAKE_CASE				  =			-15
     SCREAMING_SNAKE_CASE				  =			-18
     SCREAMING_SNAKE_CASE				  =			-21
     SCREAMING_SNAKE_CASE				  =			-24




     @classmethod
     def 						lowerCAmelCase_       (			cls    :     type[T]			):


            """simple docstring"""



            return {unit.name: unit.value for unit in cls if unit.value > 0}





     @classmethod
     def 						lowerCAmelCase_       (			cls    :     type[T]			):


            """simple docstring"""



            return {unit.name: unit.value for unit in cls if unit.value < 0}



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     Tuple      )  -> Any:





       """simple docstring"""

       __A             =		SIUnit.get_positive() if value > 0 else SIUnit.get_negative()
       for name_prefix, value_prefix in prefixes.items():
              __A             =		value / (1_0**value_prefix)
              if numerical_part > 1:
                     return f"{numerical_part!s} {name_prefix}"
       return str(_A      )



def      _SCREAMING_SNAKE_CASE  (	__lowercase				:     str      )  -> Union[str, Any]:





       """simple docstring"""

       for prefix in BinaryUnit:
              __A             =		value / (2**prefix.value)
              if numerical_part > 1:
                     return f"{numerical_part!s} {prefix.name}"
       return str(_A      )


if __name__ == "__main__":
  import doctest

  doctest.testmod()












import copy

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


__a :    Tuple								=				logging.get_logger(__name__)


class  __lowercase (		lowercase_					):







     '''simple docstring'''
     SCREAMING_SNAKE_CASE				  =			"hybrid-clip"
     SCREAMING_SNAKE_CASE				  =			True




     def __init__(			self    :     Optional[Any]	,		UpperCamelCase_    :     Optional[Any]=512	,		**UpperCamelCase_    :     List[Any]			):


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

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

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

         from transformers import AutoConfig

         __A             =		AutoConfig.for_model(UpperCamelCase_	,		**UpperCamelCase_			)

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

             __A             =		CLIPVisionConfig(**UpperCamelCase_			)
         else:
             __A             =		AutoConfig.for_model(UpperCamelCase_	,		**UpperCamelCase_			)

         __A             =		projection_dim
         __A             =		1.0




     @classmethod
     def 						lowerCAmelCase_       (			cls    :     int	,		UpperCamelCase_    :     PretrainedConfig	,		UpperCamelCase_    :     PretrainedConfig	,		**UpperCamelCase_    :     Union[str, Any]			):


         """simple docstring"""



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





     def 						lowerCAmelCase_       (			self    :     Tuple			):


         """simple docstring"""



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




