



"""simple docstring"""
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional

from packaging import version


if TYPE_CHECKING:
  from ... import PreTrainedTokenizer, TensorType

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWithPast, PatchingSpec
from ...utils import is_torch_available, logging


UpperCAmelCase						:		Any			= logging.get_logger(__name__)

UpperCAmelCase						:		str			= {
    "bigscience/bloom": "https://huggingface.co/bigscience/bloom/resolve/main/config.json",
    "bigscience/bloom-560m": "https://huggingface.co/bigscience/bloom-560m/blob/main/config.json",
    "bigscience/bloom-1b1": "https://huggingface.co/bigscience/bloom-1b1/blob/main/config.json",
    "bigscience/bloom-1b7": "https://huggingface.co/bigscience/bloom-1b7/blob/main/config.json",
    "bigscience/bloom-3b": "https://huggingface.co/bigscience/bloom-3b/blob/main/config.json",
    "bigscience/bloom-7b1": "https://huggingface.co/bigscience/bloom-7b1/blob/main/config.json",
}


class    SCREAMING_SNAKE_CASE__ (							UpperCAmelCase__   ):
    lowercase__      =   "bloom"
    lowercase__      =   ["past_key_values"]
    lowercase__      =   {
        "num_hidden_layers": "n_layer",
        "num_attention_heads": "n_head",
    }

    def __init__(				self			:				Any ,  lowerCAmelCase_			:				List[Any]=2_5_0_8_8_0 ,  lowerCAmelCase_			:				List[str]=6_4 ,  lowerCAmelCase_			:				List[str]=2 ,  lowerCAmelCase_			:				List[Any]=8 ,  lowerCAmelCase_			:				Any=1E-5 ,  lowerCAmelCase_			:				str=0.02 ,  lowerCAmelCase_			:				List[Any]=True ,  lowerCAmelCase_			:				str=1 ,  lowerCAmelCase_			:				Tuple=2 ,  lowerCAmelCase_			:				Any=False ,  lowerCAmelCase_			:				Union[str, Any]=0.0 ,  lowerCAmelCase_			:				Optional[Any]=0.0 ,  lowerCAmelCase_			:				Optional[Any]=1 ,  lowerCAmelCase_			:				List[str]=False ,  **lowerCAmelCase_			:				Union[str, Any] ,  ):







      """simple docstring"""







      lowercase_								= vocab_size
      # Backward compatibility with n_embed kwarg
      lowercase_								= kwargs.pop("""n_embed""" ,  lowerCamelCase__)
      lowercase_								= hidden_size if n_embed is None else n_embed
      lowercase_								= n_layer
      lowercase_								= n_head
      lowercase_								= layer_norm_epsilon
      lowercase_								= initializer_range
      lowercase_								= use_cache
      lowercase_								= pretraining_tp
      lowercase_								= apply_residual_connection_post_layernorm
      lowercase_								= hidden_dropout
      lowercase_								= attention_dropout

      lowercase_								= bos_token_id
      lowercase_								= eos_token_id
      lowercase_								= slow_but_exact

      super().__init__(bos_token_id=lowerCamelCase__ ,  eos_token_id=lowerCamelCase__ ,  **lowerCamelCase__)







class    SCREAMING_SNAKE_CASE__ (							UpperCAmelCase__   ):
    lowercase__      =   version.parse("1.12"   )

    def __init__(				self			:				List[Any] ,  lowerCAmelCase_			:				PretrainedConfig ,  lowerCAmelCase_			:				str = "default" ,  lowerCAmelCase_			:				List[PatchingSpec] = None ,  lowerCAmelCase_			:				bool = False ,  ):







      """simple docstring"""







      super().__init__(lowerCamelCase__ ,  task=lowerCamelCase__ ,  patching_specs=lowerCamelCase__ ,  use_past=lowerCamelCase__)
      if not getattr(self._config ,  """pad_token_id""" ,  lowerCamelCase__):
        # TODO: how to do that better?
        lowercase_								= 0

    @property
    def 					_UpperCAmelCase	(				self			:				Optional[int]):







      """simple docstring"""







      lowercase_								= OrderedDict({"""input_ids""": {0: """batch""", 1: """sequence"""}})
      if self.use_past:
        # BLOOM stores values on dynamic axis 2. For more details see: https://github.com/huggingface/transformers/pull/18344
        self.fill_with_past_key_values_(lowerCamelCase__ ,  direction="""inputs""" ,  inverted_values_shape=lowerCamelCase__)
        lowercase_								= {0: "batch", 1: "past_sequence + sequence"}
      else:
        lowercase_								= {0: "batch", 1: "sequence"}

      return common_inputs

    @property
    def 					_UpperCAmelCase	(				self			:				Dict):







      """simple docstring"""







      return self._config.n_layer

    @property
    def 					_UpperCAmelCase	(				self			:				Union[str, Any]):







      """simple docstring"""







      return self._config.n_head

    @property
    def 					_UpperCAmelCase	(				self			:				Any):







      """simple docstring"""







      return 1E-3

    def 					_UpperCAmelCase	(				self			:				Union[str, Any] ,  lowerCAmelCase_			:				"PreTrainedTokenizer" ,  lowerCAmelCase_			:				int = -1 ,  lowerCAmelCase_			:				int = -1 ,  lowerCAmelCase_			:				bool = False ,  lowerCAmelCase_			:				Optional["TensorType"] = None ,  ):







      """simple docstring"""







      lowercase_								= super(lowerCamelCase__ ,  self).generate_dummy_inputs(
          lowerCamelCase__ ,  batch_size=lowerCamelCase__ ,  seq_length=lowerCamelCase__ ,  is_pair=lowerCamelCase__ ,  framework=lowerCamelCase__)

      # We need to order the input in the way they appears in the forward()
      lowercase_								= OrderedDict({"""input_ids""": common_inputs["""input_ids"""]})

      # Need to add the past_keys
      if self.use_past:
        if not is_torch_available():
          raise ValueError("""Cannot generate dummy past_keys inputs without PyTorch installed.""")
        else:
          import torch

          lowercase_								= common_inputs["input_ids"].shape
          # Not using the same length for past_key_values
          lowercase_								= seqlen + 2
          lowercase_								= self._config.hidden_size // self.num_attention_heads
          lowercase_								= (
              batch * self.num_attention_heads,
              head_dim,
              past_key_values_length,
          )
          lowercase_								= (
              batch * self.num_attention_heads,
              past_key_values_length,
              head_dim,
          )
          lowercase_								= [
              (torch.zeros(lowerCamelCase__), torch.zeros(lowerCamelCase__)) for _ in range(self.num_layers)
          ]

      lowercase_								= common_inputs["attention_mask"]
      if self.use_past:
        lowercase_								= ordered_inputs["attention_mask"].dtype
        lowercase_								= torch.cat(
            [ordered_inputs["""attention_mask"""], torch.ones(lowerCamelCase__ ,  lowerCamelCase__ ,  dtype=lowerCamelCase__)] ,  dim=1)

      return ordered_inputs




    @property
    def 					_UpperCAmelCase	(				self			:				List[Any]):







      """simple docstring"""







      return 1_3






"""simple docstring"""
def 			_SCREAMING_SNAKE_CASE						(__lowerCAmelCase=2_81_23							) ->						Optional[Any]:







  '''simple docstring'''


  lowercase_								= [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

  lowercase_								= set()
  lowercase_								= 0

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

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

  return res


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

