

import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig
from ..clip.configuration_clip import CLIPVisionConfig


lowerCamelCase 	=   logging.get_logger(__name__)







class 		__magic_name__     (				lowerCamelCase__				):

   '''simple docstring'''




   lowerCamelCase__					:      str        =  "vision-text-dual-encoder"
   lowerCamelCase__					:      List[Any]        =  True



   def __init__(							self,       lowercase_=512,       lowercase_=2.6592,       **lowercase_			)				->       str:






     """simple docstring"""






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

     a__    =kwargs.pop('''vision_config'''			)
     a__    =kwargs.pop('''text_config'''			)

     a__    =vision_config.pop('''model_type'''			)
     a__    =text_config.pop('''model_type'''			)

     if vision_model_type == "clip":
       a__    =AutoConfig.for_model(lowercase_,       **lowercase_			).vision_config
     elif vision_model_type == "clip_vision_model":
       a__    =CLIPVisionConfig(**lowercase_			)
     else:
       a__    =AutoConfig.for_model(lowercase_,       **lowercase_			)

     a__    =AutoConfig.for_model(lowercase_,       **lowercase_			)

     a__    =projection_dim
     a__    =logit_scale_init_value



   @classmethod
   def 					_UpperCAmelCase					(							cls,       lowercase_,       lowercase_,       **lowercase_			)				->       List[str]:






     """simple docstring"""






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



   def 					_UpperCAmelCase					(							self			)				->       List[str]:






     """simple docstring"""






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

'''simple docstring'''
from __future__ import annotations

import math
import random







def 				__UpperCamelCase (					__UpperCAmelCase  :					int ,   __UpperCAmelCase  :					int ,   __UpperCAmelCase  :					int			)							->	list[int]:
  lowercase				:							Union[str, Any]									=   d * e - 1
  lowercase				:							List[str]									=   0
  lowercase				:							Tuple									=   0
  while p == 0:
    lowercase				:							Optional[Any]									=   random.randint(2 ,   n - 1			)
    lowercase				:							Dict									=   k
    while True:
      if t % 2 == 0:
        lowercase				:							List[Any]									=   t // 2
        lowercase				:							Union[str, Any]									=   (g**t) % n
        lowercase				:							Optional[Any]									=   math.gcd(x - 1 ,   __UpperCAmelCase			)
        if x > 1 and y > 1:
          lowercase				:							Dict									=   y
          lowercase				:							Any									=   n // y
          break  # find the correct factors
      else:
        break  # t is not divisible by 2, break and choose another g
  return sorted([p, q]			)


if __name__ == "__main__":
 import doctest

 doctest.testmod()