


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


a					  =     logging.get_logger(__name__)

a					  =     {
    '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        UpperCamelCase__   (	__magic_name__   ):
					__SCREAMING_SNAKE_CASE       :  Union[str, Any]						=   'bloom'
					__SCREAMING_SNAKE_CASE       :  Any						=   ['past_key_values']
					__SCREAMING_SNAKE_CASE       :  List[Any]						=   {
					    'num_hidden_layers': 'n_layer',
					    'num_attention_heads': 'n_head',
					}

					def __init__(     self       :   Any							,					UpperCamelCase__       :   Dict=250_880							,					UpperCamelCase__       :   str=64							,					UpperCamelCase__       :   str=2							,					UpperCamelCase__       :   Union[str, Any]=8							,					UpperCamelCase__       :   Optional[int]=1e-5							,					UpperCamelCase__       :   str=0.02							,					UpperCamelCase__       :   Any=True							,					UpperCamelCase__       :   Dict=1							,					UpperCamelCase__       :   str=2							,					UpperCamelCase__       :   List[Any]=False							,					UpperCamelCase__       :   List[str]=0.0							,					UpperCamelCase__       :   List[Any]=0.0							,					UpperCamelCase__       :   List[str]=1							,					UpperCamelCase__       :   str=False							,					**UpperCamelCase__       :   Tuple							,					):






										'''simple docstring'''






										lowercase_  							=			vocab_size
										# Backward compatibility with n_embed kwarg
										lowercase_  							=			kwargs.pop("""n_embed"""							,					UpperCamelCase__       )
										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=UpperCamelCase__							,					eos_token_id=UpperCamelCase__							,					**UpperCamelCase__       )







class        UpperCamelCase__   (	__magic_name__   ):
					__SCREAMING_SNAKE_CASE       :  Optional[int]						=   version.parse('1.12'   )

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






										'''simple docstring'''






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

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






										'''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_(UpperCamelCase__							,					direction="""inputs"""							,					inverted_values_shape=UpperCamelCase__       )
															lowercase_  							=			{0: """batch""", 1: """past_sequence + sequence"""}
										else:
															lowercase_  							=			{0: """batch""", 1: """sequence"""}

										return common_inputs

					@property
					def   UpperCAmelCase__       (     self       :   Any       ):






										'''simple docstring'''






										return self._config.n_layer

					@property
					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										return self._config.n_head

					@property
					def   UpperCAmelCase__       (     self       :   Tuple       ):






										'''simple docstring'''






										return 1e-3

					def   UpperCAmelCase__       (     self       :   int							,					UpperCamelCase__       :   "PreTrainedTokenizer"							,					UpperCamelCase__       :   int = -1							,					UpperCamelCase__       :   int = -1							,					UpperCamelCase__       :   bool = False							,					UpperCamelCase__       :   Optional["TensorType"] = None							,					):






										'''simple docstring'''






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

										# 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_							,					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(UpperCamelCase__       ), torch.zeros(UpperCamelCase__       )) 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(UpperCamelCase__							,					UpperCamelCase__							,					dtype=UpperCamelCase__       )]							,					dim=1       )

										return ordered_inputs







					@property
					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										return 13






def 			UpperCAmelCase_				(      UpperCAmelCase__=2_8_1_2_3  ):
					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(UpperCAmelCase__  )

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

					return res


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


