





import copy
import os
from typing import Union

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


__A							   =							logging.get_logger(__name__)

__A							   =							{
    "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   _SCREAMING_SNAKE_CASE		(      __SCREAMING_SNAKE_CASE       ):







 '''simple docstring'''
 lowercase_						=     "blip_text_model"

 def __init__(self							:  List[str]			,					UpperCAmelCase_							:  Any=30_524			,					UpperCAmelCase_							:  Any=768			,					UpperCAmelCase_							:  List[str]=768			,					UpperCAmelCase_							:  List[Any]=3_072			,					UpperCAmelCase_							:  Dict=768			,					UpperCAmelCase_							:  Optional[int]=12			,					UpperCAmelCase_							:  Any=8			,					UpperCAmelCase_							:  Union[str, Any]=512			,					UpperCAmelCase_							:  str="gelu"			,					UpperCAmelCase_							:  Tuple=1E-1_2			,					UpperCAmelCase_							:  List[str]=0.0			,					UpperCAmelCase_							:  str=0.0			,					UpperCAmelCase_							:  Optional[Any]=0.02			,					UpperCAmelCase_							:  Dict=30_522			,					UpperCAmelCase_							:  Optional[Any]=2			,					UpperCAmelCase_							:  List[Any]=0			,					UpperCAmelCase_							:  List[Any]=102			,					UpperCAmelCase_							:  List[str]=True			,					UpperCAmelCase_							:  Any=True			,					**UpperCAmelCase_							:  Optional[int]			,					)			->Optional[int]:



   '''simple docstring'''



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

   lowerCamelCase__: Union[str, Any]         =vocab_size
   lowerCamelCase__: List[str]         =hidden_size
   lowerCamelCase__: int         =encoder_hidden_size
   lowerCamelCase__: List[Any]         =intermediate_size
   lowerCamelCase__: List[str]         =projection_dim
   lowerCamelCase__: str         =hidden_dropout_prob
   lowerCamelCase__: int         =num_hidden_layers
   lowerCamelCase__: Union[str, Any]         =num_attention_heads
   lowerCamelCase__: List[str]         =max_position_embeddings
   lowerCamelCase__: Any         =layer_norm_eps
   lowerCamelCase__: Any         =hidden_act
   lowerCamelCase__: Tuple         =initializer_range
   lowerCamelCase__: Dict         =attention_probs_dropout_prob
   lowerCamelCase__: Dict         =is_decoder
   lowerCamelCase__: Dict         =use_cache







 @classmethod
 def 				SCREAMING_SNAKE_CASE_   (cls							:  Any			,					UpperCAmelCase_							:  Union[str, os.PathLike]			,					**UpperCAmelCase_							:  Any)			->"PretrainedConfig":



   '''simple docstring'''



   cls._set_token_in_kwargs(UpperCAmelCase_)

   lowerCamelCase__    ,   lowerCamelCase__: str         =cls.get_config_dict(UpperCAmelCase_			,					**UpperCAmelCase_)

   # get the text config dict if we are loading from BlipConfig
   if config_dict.get("model_type") == "blip":
     lowerCamelCase__: List[str]         =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   _SCREAMING_SNAKE_CASE		(      __SCREAMING_SNAKE_CASE       ):







 '''simple docstring'''
 lowercase_						=     "blip_vision_model"

 def __init__(self							:  List[str]			,					UpperCAmelCase_							:  Tuple=768			,					UpperCAmelCase_							:  Tuple=3_072			,					UpperCAmelCase_							:  List[Any]=512			,					UpperCAmelCase_							:  Optional[int]=12			,					UpperCAmelCase_							:  List[str]=12			,					UpperCAmelCase_							:  Union[str, Any]=384			,					UpperCAmelCase_							:  Any=16			,					UpperCAmelCase_							:  Union[str, Any]="gelu"			,					UpperCAmelCase_							:  str=1E-5			,					UpperCAmelCase_							:  Optional[int]=0.0			,					UpperCAmelCase_							:  str=1E-1_0			,					**UpperCAmelCase_							:  Union[str, Any]			,					)			->Any:



   '''simple docstring'''



   super().__init__(**UpperCAmelCase_)

   lowerCamelCase__: List[Any]         =hidden_size
   lowerCamelCase__: List[str]         =intermediate_size
   lowerCamelCase__: Dict         =projection_dim
   lowerCamelCase__: Any         =num_hidden_layers
   lowerCamelCase__: Tuple         =num_attention_heads
   lowerCamelCase__: Optional[int]         =patch_size
   lowerCamelCase__: Optional[int]         =image_size
   lowerCamelCase__: Any         =initializer_range
   lowerCamelCase__: str         =attention_dropout
   lowerCamelCase__: str         =layer_norm_eps
   lowerCamelCase__: Dict         =hidden_act







 @classmethod
 def 				SCREAMING_SNAKE_CASE_   (cls							:  Tuple			,					UpperCAmelCase_							:  Union[str, os.PathLike]			,					**UpperCAmelCase_							:  List[Any])			->"PretrainedConfig":



   '''simple docstring'''



   cls._set_token_in_kwargs(UpperCAmelCase_)

   lowerCamelCase__    ,   lowerCamelCase__: Dict         =cls.get_config_dict(UpperCAmelCase_			,					**UpperCAmelCase_)

   # get the vision config dict if we are loading from BlipConfig
   if config_dict.get("model_type") == "blip":
     lowerCamelCase__: Optional[int]         =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   _SCREAMING_SNAKE_CASE		(      __SCREAMING_SNAKE_CASE       ):







 '''simple docstring'''
 lowercase_						=     "blip"
 lowercase_						=     True

 def __init__(self							:  Any			,					UpperCAmelCase_							:  Dict=None			,					UpperCAmelCase_							:  List[str]=None			,					UpperCAmelCase_							:  Union[str, Any]=512			,					UpperCAmelCase_							:  str=2.6592			,					UpperCAmelCase_							:  List[Any]=256			,					**UpperCAmelCase_							:  Tuple			,					)			->int:



   '''simple docstring'''



   super().__init__(**UpperCAmelCase_)

   if text_config is None:
     lowerCamelCase__: Optional[int]         ={}
     logger.info("`text_config` is `None`. Initializing the `BlipTextConfig` with default values.")

   if vision_config is None:
     lowerCamelCase__: Optional[int]         ={}
     logger.info("`vision_config` is `None`. Initializing the `BlipVisionConfig` with default values.")

   lowerCamelCase__: List[str]         =BlipTextConfig(**UpperCAmelCase_)
   lowerCamelCase__: Optional[int]         =BlipVisionConfig(**UpperCAmelCase_)

   lowerCamelCase__: List[str]         =self.vision_config.hidden_size

   lowerCamelCase__: Optional[Any]         =projection_dim
   lowerCamelCase__: List[str]         =logit_scale_init_value
   lowerCamelCase__: str         =1.0
   lowerCamelCase__: Tuple         =0.02
   lowerCamelCase__: int         =image_text_hidden_size

 @classmethod
 def 				SCREAMING_SNAKE_CASE_   (cls							:  Any			,					UpperCAmelCase_							:  BlipTextConfig			,					UpperCAmelCase_							:  BlipVisionConfig			,					**UpperCAmelCase_							:  str)			->Any:



   '''simple docstring'''



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







 def 				SCREAMING_SNAKE_CASE_   (self							:  Dict)			->List[Any]:



   '''simple docstring'''



   lowerCamelCase__: str         =copy.deepcopy(self.__dict__)
   lowerCamelCase__: Dict         =self.text_config.to_dict()
   lowerCamelCase__: List[str]         =self.vision_config.to_dict()
   lowerCamelCase__: int         =self.__class__.model_type
   return output



'''simple docstring'''



def A ():
						for n in range(1					,      1000000						):
												yield n * (n + 1) // 2


def A (__lowerCamelCase :List[Any]						):
						_lowerCAmelCase    		=					1
						_lowerCAmelCase    		=					2
						while i * i <= n:
												_lowerCAmelCase    		=					0
												while n % i == 0:
																		n //= i
																		multiplicity += 1
												divisors_count *= multiplicity + 1
												i += 1
						if n > 1:
												divisors_count *= 2
						return divisors_count


def A ():
						return next(i for i in triangle_number_generator() if count_divisors(__lowerCamelCase						) > 500						)


if __name__ == "__main__":
						print(solution())
