'''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


_lowerCamelCase :				str														= logging.get_logger(__name__)




class    lowerCamelCase__  (   __snake_case     ):
   __UpperCAmelCase           =						"""vision-text-dual-encoder"""
   __UpperCAmelCase           =						True



   def __init__(    self					,      lowerCAmelCase__=512					,      lowerCAmelCase__=2.6592					,      **lowerCAmelCase__     )				->     str:
        """simple docstring"""





        super().__init__(**lowerCAmelCase__     )

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

        _UpperCamelCase  :Optional[int]       =kwargs.pop("""vision_config"""     )
        _UpperCamelCase  :List[Any]       =kwargs.pop("""text_config"""     )

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

        if vision_model_type == "clip":
             _UpperCamelCase  :str       =AutoConfig.for_model(lowerCAmelCase__					,      **lowerCAmelCase__     ).vision_config
        elif vision_model_type == "clip_vision_model":
             _UpperCamelCase  :Union[str, Any]       =CLIPVisionConfig(**lowerCAmelCase__     )
        else:
             _UpperCamelCase  :List[str]       =AutoConfig.for_model(lowerCAmelCase__					,      **lowerCAmelCase__     )

        _UpperCamelCase  :int       =AutoConfig.for_model(lowerCAmelCase__					,      **lowerCAmelCase__     )

        _UpperCamelCase  :Any       =projection_dim
        _UpperCamelCase  :Tuple       =logit_scale_init_value



   @classmethod
   def  _UpperCamelCase		(    cls					,      lowerCAmelCase__					,      lowerCAmelCase__					,      **lowerCAmelCase__     )				->     List[Any]:
        """simple docstring"""





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




   def  _UpperCamelCase		(    self     )				->     Optional[int]:
        """simple docstring"""





        _UpperCamelCase  :Union[str, Any]       =copy.deepcopy(self.__dict__     )
        _UpperCamelCase  :List[Any]       =self.vision_config.to_dict()
        _UpperCamelCase  :Dict       =self.text_config.to_dict()
        _UpperCamelCase  :Any       =self.__class__.model_type
        return output



"""simple docstring"""





from collections.abc import Callable

snake_case__		:  Optional[int]     					=					Callable[[float], float]  # type alias for a real -> real function


def   _snake_case    (    _snake_case					:      RealFunc			, _snake_case					:      RealFunc			, _snake_case					:      int			, ):
      lowerCAmelCase       :						Dict							= float(_snake_case      )
      while True:
            try:
                  lowerCAmelCase       :						Optional[Any]							= prev_guess - function(_snake_case      ) / derivative(_snake_case      )
            except ZeroDivisionError:
                  raise ZeroDivisionError('''Could not find root'''      ) from None
            if abs(prev_guess - next_guess      ) < 10**-5:
                  return next_guess
            lowerCAmelCase       :						Optional[int]							= next_guess


def   _snake_case    (    _snake_case					:      float      ):
      return (x**3) - (2 * x) - 5


def   _snake_case    (    _snake_case					:      float      ):
      return 3 * (x**2) - 2


if __name__ == "__main__":
 print(newton(f, fa, 3))


