
"""simple docstring"""

import copy
import os
from typing import Union

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


UpperCamelCase     :    Tuple       =			logging.get_logger(__name__)

UpperCamelCase     :    Optional[int]       =			{
    "Salesforce/blip-vqa-base": "https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/config.json",
    "Salesforce/blip-vqa-capfit-large": (
        "https://huggingface.co/Salesforce/blip-vqa-base-capfit/resolve/main/config.json"
    ),
    "Salesforce/blip-image-captioning-base": (
        "https://huggingface.co/Salesforce/blip-image-captioning-base/resolve/main/config.json"
    ),
    "Salesforce/blip-image-captioning-large": (
        "https://huggingface.co/Salesforce/blip-image-captioning-large/resolve/main/config.json"
    ),
    "Salesforce/blip-itm-base-coco": "https://huggingface.co/Salesforce/blip-itm-base-coco/resolve/main/config.json",
    "Salesforce/blip-itm-large-coco": "https://huggingface.co/Salesforce/blip-itm-large-coco/resolve/main/config.json",
    "Salesforce/blip-itm-base-flikr": "https://huggingface.co/Salesforce/blip-itm-base-flikr/resolve/main/config.json",
    "Salesforce/blip-itm-large-flikr": (
        "https://huggingface.co/Salesforce/blip-itm-large-flikr/resolve/main/config.json"
    ),
}

class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ):
     lowercase						       =						"blip_text_model"





     def __init__(     self     ,					__UpperCAmelCase=3_0524     ,					__UpperCAmelCase=768     ,					__UpperCAmelCase=768     ,					__UpperCAmelCase=3072     ,					__UpperCAmelCase=768     ,					__UpperCAmelCase=12     ,					__UpperCAmelCase=8     ,					__UpperCAmelCase=512     ,					__UpperCAmelCase="gelu"     ,					__UpperCAmelCase=1E-12     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=0.0_2     ,					__UpperCAmelCase=3_0522     ,					__UpperCAmelCase=2     ,					__UpperCAmelCase=0     ,					__UpperCAmelCase=102     ,					__UpperCAmelCase=True     ,					__UpperCAmelCase=True     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      super().__init__(
          pad_token_id=__UpperCAmelCase     ,					bos_token_id=__UpperCAmelCase     ,					eos_token_id=__UpperCAmelCase     ,					sep_token_id=__UpperCAmelCase     ,					**__UpperCAmelCase     ,					)

      __UpperCamelCase      =	vocab_size
      __UpperCamelCase      =	hidden_size
      __UpperCamelCase      =	encoder_hidden_size
      __UpperCamelCase      =	intermediate_size
      __UpperCamelCase      =	projection_dim
      __UpperCamelCase      =	hidden_dropout_prob
      __UpperCamelCase      =	num_hidden_layers
      __UpperCamelCase      =	num_attention_heads
      __UpperCamelCase      =	max_position_embeddings
      __UpperCamelCase      =	layer_norm_eps
      __UpperCamelCase      =	hidden_act
      __UpperCamelCase      =	initializer_range
      __UpperCamelCase      =	attention_probs_dropout_prob
      __UpperCamelCase      =	is_decoder
      __UpperCamelCase      =	use_cache







     @classmethod
     def 						UpperCAmelCase (     cls     ,					__UpperCAmelCase     ,					**__UpperCAmelCase				):

      '''simple docstring'''




      cls._set_token_in_kwargs(__UpperCAmelCase				)

      __UpperCamelCase  ,     __UpperCamelCase      =	cls.get_config_dict(__UpperCAmelCase     ,					**__UpperCAmelCase				)

      # get the text config dict if we are loading from BlipConfig
      if config_dict.get('model_type'				) == "blip":
       __UpperCamelCase      =	config_dict['text_config']

      if "model_type" in config_dict and hasattr(cls     ,					'model_type'				) and config_dict["model_type"] != cls.model_type:
       logger.warning(
           F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
           F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'				)

      return cls.from_dict(__UpperCAmelCase     ,					**__UpperCAmelCase				)


class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ):
     lowercase						       =						"blip_vision_model"





     def __init__(     self     ,					__UpperCAmelCase=768     ,					__UpperCAmelCase=3072     ,					__UpperCAmelCase=512     ,					__UpperCAmelCase=12     ,					__UpperCAmelCase=12     ,					__UpperCAmelCase=384     ,					__UpperCAmelCase=16     ,					__UpperCAmelCase="gelu"     ,					__UpperCAmelCase=1E-5     ,					__UpperCAmelCase=0.0     ,					__UpperCAmelCase=1E-10     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      super().__init__(**__UpperCAmelCase				)

      __UpperCamelCase      =	hidden_size
      __UpperCamelCase      =	intermediate_size
      __UpperCamelCase      =	projection_dim
      __UpperCamelCase      =	num_hidden_layers
      __UpperCamelCase      =	num_attention_heads
      __UpperCamelCase      =	patch_size
      __UpperCamelCase      =	image_size
      __UpperCamelCase      =	initializer_range
      __UpperCamelCase      =	attention_dropout
      __UpperCamelCase      =	layer_norm_eps
      __UpperCamelCase      =	hidden_act







     @classmethod
     def 						UpperCAmelCase (     cls     ,					__UpperCAmelCase     ,					**__UpperCAmelCase				):

      '''simple docstring'''




      cls._set_token_in_kwargs(__UpperCAmelCase				)

      __UpperCamelCase  ,     __UpperCamelCase      =	cls.get_config_dict(__UpperCAmelCase     ,					**__UpperCAmelCase				)

      # get the vision config dict if we are loading from BlipConfig
      if config_dict.get('model_type'				) == "blip":
       __UpperCamelCase      =	config_dict['vision_config']

      if "model_type" in config_dict and hasattr(cls     ,					'model_type'				) and config_dict["model_type"] != cls.model_type:
       logger.warning(
           F'You are using a model of type {config_dict["model_type"]} to instantiate a model of type '
           F'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'				)

      return cls.from_dict(__UpperCAmelCase     ,					**__UpperCAmelCase				)


class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ):
     lowercase						       =						"blip"
     lowercase						       =						True





     def __init__(     self     ,					__UpperCAmelCase=None     ,					__UpperCAmelCase=None     ,					__UpperCAmelCase=512     ,					__UpperCAmelCase=2.6_5_9_2     ,					__UpperCAmelCase=256     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      super().__init__(**__UpperCAmelCase				)

      if text_config is None:
       __UpperCamelCase      =	{}
       logger.info('`text_config` is `None`. Initializing the `BlipTextConfig` with default values.'				)

      if vision_config is None:
       __UpperCamelCase      =	{}
       logger.info('`vision_config` is `None`. Initializing the `BlipVisionConfig` with default values.'				)

      __UpperCamelCase      =	BlipTextConfig(**__UpperCAmelCase				)
      __UpperCamelCase      =	BlipVisionConfig(**__UpperCAmelCase				)

      __UpperCamelCase      =	self.vision_config.hidden_size

      __UpperCamelCase      =	projection_dim
      __UpperCamelCase      =	logit_scale_init_value
      __UpperCamelCase      =	1.0
      __UpperCamelCase      =	0.0_2
      __UpperCamelCase      =	image_text_hidden_size





     @classmethod
     def 						UpperCAmelCase (     cls     ,					__UpperCAmelCase     ,					__UpperCAmelCase     ,					**__UpperCAmelCase				):

      '''simple docstring'''




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







     def 						UpperCAmelCase (     self				):

      '''simple docstring'''




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





"""simple docstring"""

def 							A						(    snake_case				:int		)				->     bool:
 return sum(i for i in range(1    , number // 2 + 1		) if number % i == 0		) == number


if __name__ == "__main__":
      print("Program to check whether a number is a Perfect number or not...")
      UpperCamelCase     :    Union[str, Any]       =			int(input("Enter number: ").strip())
      print(f'''{number} is {"" if perfect(number) else "not "}a Perfect Number.''')



