


import copy

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


snake_case       :					List[Any]        =  logging.get_logger(__name__)







class 	_snake_case						(   _snake_case							):
 SCREAMING_SNAKE_CASE__   = 'hybrid-clip'
 SCREAMING_SNAKE_CASE__   = True




 def __init__(	self      ,						_lowerCamelCase=512      ,						**_lowerCamelCase					):
       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`.'''					)

       a		:List[Any]											= kwargs.pop('''text_config'''					)
       a		:Dict											= kwargs.pop('''vision_config'''					)

       a		:Tuple											= text_config.pop('''model_type'''					)
       a		:Dict											= vision_config.pop('''model_type'''					)

       from transformers import AutoConfig

       a		:Optional[Any]											= AutoConfig.for_model(_lowerCamelCase      ,						**_lowerCamelCase					)

       if vision_model_type == "clip":
             a		:List[str]											= AutoConfig.for_model(_lowerCamelCase      ,						**_lowerCamelCase					).vision_config
       elif vision_model_type == "clip_vision_model":
             from transformers import CLIPVisionConfig

             a		:str											= CLIPVisionConfig(**_lowerCamelCase					)
       else:
             a		:Tuple											= AutoConfig.for_model(_lowerCamelCase      ,						**_lowerCamelCase					)

       a		:Any											= projection_dim
       a		:Optional[int]											= 1.0




 @classmethod
 def  SCREAMING_SNAKE_CASE__       (	cls      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						**_lowerCamelCase					):
       return cls(text_config=text_config.to_dict()      ,						vision_config=vision_config.to_dict()      ,						**_lowerCamelCase					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:List[str]											= copy.deepcopy(self.__dict__					)
       a		:Dict											= self.text_config.to_dict()
       a		:List[Any]											= self.vision_config.to_dict()
       a		:str											= self.__class__.model_type
       return output









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


snake_case       :					Dict        =  {
    '''configuration_align''': [
        '''ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''AlignConfig''',
        '''AlignTextConfig''',
        '''AlignVisionConfig''',
    ],
    '''processing_align''': ['''AlignProcessor'''],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     snake_case       :					List[str]        =  [
         '''ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''AlignModel''',
         '''AlignPreTrainedModel''',
         '''AlignTextModel''',
         '''AlignVisionModel''',
     ]

if TYPE_CHECKING:
     from .configuration_align import (
         ALIGN_PRETRAINED_CONFIG_ARCHIVE_MAP,
         AlignConfig,
         AlignTextConfig,
         AlignVisionConfig,
     )
     from .processing_align import AlignProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_align import (
              ALIGN_PRETRAINED_MODEL_ARCHIVE_LIST,
              AlignModel,
              AlignPreTrainedModel,
              AlignTextModel,
              AlignVisionModel,
          )

else:
     import sys

     snake_case       :					int        =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





