

import copy

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


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





class    __UpperCAmelCase	(			lowerCamelCase__		):
   UpperCamelCase  	=	"""hybrid-clip"""
   UpperCamelCase  	=	True



   def __init__(				self				:	str,						__A				:	List[Any]=5_1_2,						**__A				:	Dict		):
     super().__init__(**__A		)

     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			:				Optional[Any]										=					kwargs.pop('''text_config'''		)
     UpperCAmelCase			:				List[Any]										=					kwargs.pop('''vision_config'''		)

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

     from transformers import AutoConfig

     UpperCAmelCase			:				Any										=					AutoConfig.for_model(__A,						**__A		)

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

       UpperCAmelCase			:				Dict										=					CLIPVisionConfig(**__A		)
     else:
       UpperCAmelCase			:				Optional[Any]										=					AutoConfig.for_model(__A,						**__A		)

     UpperCAmelCase			:				str										=					projection_dim
     UpperCAmelCase			:				str										=					1.0



   @classmethod
   def 			__magic_name__       (				cls				:	List[Any],						__A				:	PretrainedConfig,						__A				:	PretrainedConfig,						**__A				:	Union[str, Any]		):
     return cls(text_config=text_config.to_dict(),						vision_config=vision_config.to_dict(),						**__A		)





   def 			__magic_name__       (				self				:	int		):
     UpperCAmelCase			:				List[Any]										=					copy.deepcopy(self.__dict__		)
     UpperCAmelCase			:				Dict										=					self.text_config.to_dict()
     UpperCAmelCase			:				Optional[Any]										=					self.vision_config.to_dict()
     UpperCAmelCase			:				Optional[int]										=					self.__class__.model_type
     return output








def      a__	(						UpperCAmelCase				:     list     )    ->		list:
  UpperCAmelCase			:				Tuple										=					len(UpperCAmelCase     )

  # Set the gap value to be decreased by a factor of 1.3
  # after each iteration
  UpperCAmelCase			:				Optional[Any]										=					1.3

  # Continue sorting until the gap is 1
  while gap > 1:
    # Decrease the gap value
    UpperCAmelCase			:				int										=					int(gap / shrink     )

    # Sort the elements using insertion sort
    for i in range(UpperCAmelCase							,					len(UpperCAmelCase     )     ):
      UpperCAmelCase			:				Union[str, Any]										=					collection[i]
      UpperCAmelCase			:				List[Any]										=					i
      while j >= gap and collection[j - gap] > temp:
        UpperCAmelCase			:				int										=					collection[j - gap]
        j -= gap
      UpperCAmelCase			:				List[Any]										=					temp

  return collection


if __name__ == "__main__":
     import doctest

     doctest.testmod()





