





import copy
import os
from typing import Union

from ...configuration_utils import PretrainedConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from ...utils import logging
from ..auto import CONFIG_MAPPING


_snake_case    :       str		       =    logging.get_logger(__name__)

_snake_case    :       Union[str, Any]		       =    {
    'Salesforce/instruct-blip-flan-t5': 'https://huggingface.co/Salesforce/instruct-blip-flan-t5/resolve/main/config.json',
}



class 							_UpperCAmelCase       (       _UpperCamelCase       ):

  """simple docstring"""


  a_              =					"""instructblip_vision_model"""






  def __init__(							self					:						Union[str, Any]   ,    lowerCAmelCase_					:						str=1_4_0_8   ,    lowerCAmelCase_					:						List[str]=6_1_4_4   ,    lowerCAmelCase_					:						Any=3_9   ,    lowerCAmelCase_					:						int=1_6   ,    lowerCAmelCase_					:						Optional[int]=2_2_4   ,    lowerCAmelCase_					:						Union[str, Any]=1_4   ,    lowerCAmelCase_					:						str="gelu"   ,    lowerCAmelCase_					:						Tuple=1e-6   ,    lowerCAmelCase_					:						List[str]=0.0   ,    lowerCAmelCase_					:						Tuple=1e-10   ,    lowerCAmelCase_					:						List[Any]=True   ,    **lowerCAmelCase_					:						Dict   ,    )				->		str:
     super().__init__(**lowerCAmelCase_	)

     __lowerCAmelCase				      =      hidden_size
     __lowerCAmelCase				      =      intermediate_size
     __lowerCAmelCase				      =      num_hidden_layers
     __lowerCAmelCase				      =      num_attention_heads
     __lowerCAmelCase				      =      patch_size
     __lowerCAmelCase				      =      image_size
     __lowerCAmelCase				      =      initializer_range
     __lowerCAmelCase				      =      attention_dropout
     __lowerCAmelCase				      =      layer_norm_eps
     __lowerCAmelCase				      =      hidden_act
     __lowerCAmelCase				      =      qkv_bias






  @classmethod
  def 							lowercase						(							cls					:						List[str]   ,    lowerCAmelCase_					:						Union[str, os.PathLike]   ,    **lowerCAmelCase_					:						str	)				->		"PretrainedConfig":
     cls._set_token_in_kwargs(lowerCAmelCase_	)

     __lowerCAmelCase      ,      __lowerCAmelCase				      =      cls.get_config_dict(lowerCAmelCase_   ,    **lowerCAmelCase_	)

     # get the vision config dict if we are loading from InstructBlipConfig
     if config_dict.get('model_type'	) == "instructblip":
        __lowerCAmelCase				      =      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(lowerCAmelCase_   ,    **lowerCAmelCase_	)





class 							_UpperCAmelCase       (       _UpperCamelCase       ):

  """simple docstring"""


  a_              =					"""instructblip_qformer"""






  def __init__(							self					:						Tuple   ,    lowerCAmelCase_					:						Optional[Any]=3_0_5_2_2   ,    lowerCAmelCase_					:						Any=7_6_8   ,    lowerCAmelCase_					:						Optional[int]=1_2   ,    lowerCAmelCase_					:						Tuple=1_2   ,    lowerCAmelCase_					:						Tuple=3_0_7_2   ,    lowerCAmelCase_					:						List[str]="gelu"   ,    lowerCAmelCase_					:						Optional[int]=0.1   ,    lowerCAmelCase_					:						str=0.1   ,    lowerCAmelCase_					:						List[str]=5_1_2   ,    lowerCAmelCase_					:						Optional[int]=0.02   ,    lowerCAmelCase_					:						Optional[Any]=1e-12   ,    lowerCAmelCase_					:						Any=0   ,    lowerCAmelCase_					:						Any="absolute"   ,    lowerCAmelCase_					:						Any=2   ,    lowerCAmelCase_					:						List[Any]=1_4_0_8   ,    **lowerCAmelCase_					:						Optional[Any]   ,    )				->		int:
     super().__init__(pad_token_id=lowerCAmelCase_   ,    **lowerCAmelCase_	)

     __lowerCAmelCase				      =      vocab_size
     __lowerCAmelCase				      =      hidden_size
     __lowerCAmelCase				      =      num_hidden_layers
     __lowerCAmelCase				      =      num_attention_heads
     __lowerCAmelCase				      =      hidden_act
     __lowerCAmelCase				      =      intermediate_size
     __lowerCAmelCase				      =      hidden_dropout_prob
     __lowerCAmelCase				      =      attention_probs_dropout_prob
     __lowerCAmelCase				      =      max_position_embeddings
     __lowerCAmelCase				      =      initializer_range
     __lowerCAmelCase				      =      layer_norm_eps
     __lowerCAmelCase				      =      position_embedding_type
     __lowerCAmelCase				      =      cross_attention_frequency
     __lowerCAmelCase				      =      encoder_hidden_size






  @classmethod
  def 							lowercase						(							cls					:						int   ,    lowerCAmelCase_					:						Union[str, os.PathLike]   ,    **lowerCAmelCase_					:						Tuple	)				->		"PretrainedConfig":
     cls._set_token_in_kwargs(lowerCAmelCase_	)

     __lowerCAmelCase      ,      __lowerCAmelCase				      =      cls.get_config_dict(lowerCAmelCase_   ,    **lowerCAmelCase_	)

     # get the qformer config dict if we are loading from InstructBlipConfig
     if config_dict.get('model_type'	) == "instructblip":
        __lowerCAmelCase				      =      config_dict['qformer_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(lowerCAmelCase_   ,    **lowerCAmelCase_	)





class 							_UpperCAmelCase       (       _UpperCamelCase       ):

  """simple docstring"""


  a_              =					"""instructblip"""
  a_              =					True






  def __init__(							self					:						Dict   ,    lowerCAmelCase_					:						str=None   ,    lowerCAmelCase_					:						int=None   ,    lowerCAmelCase_					:						Dict=None   ,    lowerCAmelCase_					:						Optional[Any]=3_2   ,    **lowerCAmelCase_					:						Tuple	)				->		int:
     super().__init__(**lowerCAmelCase_	)

     if vision_config is None:
        __lowerCAmelCase				      =      {}
        logger.info('vision_config is None. initializing the InstructBlipVisionConfig with default values.'	)

     if qformer_config is None:
        __lowerCAmelCase				      =      {}
        logger.info('qformer_config is None. Initializing the InstructBlipQFormerConfig with default values.'	)

     if text_config is None:
        __lowerCAmelCase				      =      {}
        logger.info('text_config is None. Initializing the text config with default values (`OPTConfig`).'	)

     __lowerCAmelCase				      =      InstructBlipVisionConfig(**lowerCAmelCase_	)
     __lowerCAmelCase				      =      InstructBlipQFormerConfig(**lowerCAmelCase_	)
     __lowerCAmelCase				      =      text_config['model_type'] if 'model_type' in text_config else 'opt'
     __lowerCAmelCase				      =      CONFIG_MAPPING[text_model_type](**lowerCAmelCase_	)

     __lowerCAmelCase				      =      self.text_config.tie_word_embeddings
     __lowerCAmelCase				      =      self.text_config.is_encoder_decoder

     __lowerCAmelCase				      =      num_query_tokens
     __lowerCAmelCase				      =      self.vision_config.hidden_size
     __lowerCAmelCase				      =      self.text_config.model_type in MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
     __lowerCAmelCase				      =      1.0
     __lowerCAmelCase				      =      0.02






  @classmethod
  def 							lowercase						(							cls					:						Dict   ,    lowerCAmelCase_					:						InstructBlipVisionConfig   ,    lowerCAmelCase_					:						InstructBlipQFormerConfig   ,    lowerCAmelCase_					:						PretrainedConfig   ,    **lowerCAmelCase_					:						Tuple   ,    )				->		Union[str, Any]:
     return cls(
         vision_config=vision_config.to_dict()   ,    qformer_config=qformer_config.to_dict()   ,    text_config=text_config.to_dict()   ,    **lowerCAmelCase_   ,    )






  def 							lowercase						(							self					:						Dict	)				->		Dict:
     __lowerCAmelCase				      =      copy.deepcopy(self.__dict__	)
     __lowerCAmelCase				      =      self.vision_config.to_dict()
     __lowerCAmelCase				      =      self.qformer_config.to_dict()
     __lowerCAmelCase				      =      self.text_config.to_dict()
     __lowerCAmelCase				      =      self.__class__.model_type
     return output




def 							__lowerCAmelCase     (							_UpperCamelCase		:	List[str]=2_81_23						)		->				str:
 '''simple docstring'''


 SCREAMING_SNAKE_CASE		    =      [1] * (limit + 1)

 for i in range(2		,				int(limit**0.5						) + 1						):
  sum_divs[i * i] += i
  for k in range(i + 1		,				limit // i + 1						):
   sum_divs[k * i] += k + i

 SCREAMING_SNAKE_CASE		    =      set()
 SCREAMING_SNAKE_CASE		    =      0

 for n in range(1		,				limit + 1						):
  if sum_divs[n] > n:
   abundants.add(_UpperCamelCase						)

  if not any((n - a in abundants) for a in abundants						):
   res += n

 return res


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

