
'''simple docstring'''
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 				UpperCAmelCase_			(		snake_case__   ):
 UpperCAmelCase_						      =  """vision-text-dual-encoder"""
 UpperCAmelCase_						      =  True





 def __init__(      self	,    lowercase_=5_12	,    lowercase_=2.6_592	,    **lowercase_):
     super().__init__(**lowercase_)

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

     snake_case_	:      int            =  kwargs.pop("vision_config")
     snake_case_	:      str            =  kwargs.pop("text_config")

     snake_case_	:      Union[str, Any]            =  vision_config.pop("model_type")
     snake_case_	:      Optional[Any]            =  text_config.pop("model_type")

     if vision_model_type == "clip":
         snake_case_	:      Dict            =  AutoConfig.for_model(lowercase_	,    **lowercase_).vision_config
     elif vision_model_type == "clip_vision_model":
         snake_case_	:      str            =  CLIPVisionConfig(**lowercase_)
     else:
         snake_case_	:      Optional[int]            =  AutoConfig.for_model(lowercase_	,    **lowercase_)

     snake_case_	:      Union[str, Any]            =  AutoConfig.for_model(lowercase_	,    **lowercase_)

     snake_case_	:      int            =  projection_dim
     snake_case_	:      List[Any]            =  logit_scale_init_value





 @classmethod
 def     snake_case__						(      cls	,    lowercase_	,    lowercase_	,    **lowercase_):
     return cls(vision_config=vision_config.to_dict()	,    text_config=text_config.to_dict()	,    **lowercase_)





 def     snake_case__						(      self):
     snake_case_	:      str            =  copy.deepcopy(self.__dict__)
     snake_case_	:      Union[str, Any]            =  self.vision_config.to_dict()
     snake_case_	:      str            =  self.text_config.to_dict()
     snake_case_	:      Tuple            =  self.__class__.model_type
     return output






'''simple docstring'''
def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE    ):
    """simple docstring"""






    snake_case_	:      Optional[int]            =  len(__SCREAMING_SNAKE_CASE    )

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

    # Continue sorting until the gap is 1
    while gap > 1:
        # Decrease the gap value
        snake_case_	:      Optional[Any]            =  int(gap / shrink    )

        # Sort the elements using insertion sort
        for i in range(__SCREAMING_SNAKE_CASE,						len(__SCREAMING_SNAKE_CASE    )    ):
            snake_case_	:      Any            =  collection[i]
            snake_case_	:      int            =  i
            while j >= gap and collection[j - gap] > temp:
                snake_case_	:      Dict            =  collection[j - gap]
                j -= gap
            snake_case_	:      Optional[int]            =  temp

    return collection


if __name__ == "__main__":
  import doctest

  doctest.testmod()




